ata change for 6.4-rc1
* Many cleanups of the pata_parport driver and of its protocol modules, from Ondrej. * Remove unused code (ata_id_xxx() functions), from Sergey. * Add Add UniPhier SATA controller DT bindings, from Kunihiko. * Fix dependencies for the Freescale QorIQ AHCI SATA controller driver, from Geert. * DT property handling improvements, from Rob. -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSRPv8tYSvhwAzJdzjdoc3SxdoYdgUCZEfg+AAKCRDdoc3SxdoY dl+WAQDypaM0OuXFqVin9s49pR2UsOE7TKNrlPUsjN2p+gCBNAEA1bFLzuTWVriA qlzl3/3gU33aeBqrAnxkH7k6gf0q2gY= =8CO+ -----END PGP SIGNATURE----- Merge tag 'ata-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata Pull ata updates from Damien Le Moal: - Many cleanups of the pata_parport driver and of its protocol modules (Ondrej) - Remove unused code (ata_id_xxx() functions) (Sergey) - Add Add UniPhier SATA controller DT bindings (Kunihiko) - Fix dependencies for the Freescale QorIQ AHCI SATA controller driver (Geert) - DT property handling improvements (Rob) * tag 'ata-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata: (57 commits) ata: pata_parport-bpck6: Declare mode_map as static ata: pata_parport-bpck6: Remove dependency on 64BIT ata: pata_parport-bpck6: reduce indents in bpck6_open ata: pata_parport-bpck6: delete ppc6lnx.c ata: pata_parport-bpck6: move defines and mode_map to bpck6.c ata: pata_parport-bpck6: move ppc6_wr_data_byte to bpck6.c and rename ata: pata_parport-bpck6: move ppc6_rd_data_byte to bpck6.c and rename ata: pata_parport-bpck6: move ppc6_send_cmd to bpck6.c and rename ata: pata_parport-bpck6: move ppc6_deselect to bpck6.c and rename ata: pata_parport-bpck6: merge ppc6_select into bpck6_open ata: pata_parport-bpck6: move ppc6_open to bpck6.c and rename ata: pata_parport-bpck6: move ppc6_wr_extout to bpck6.c and rename ata: pata_parport-bpck6: move ppc6_wait_for_fifo to bpck6.c and rename ata: pata_parport-bpck6: merge ppc6_wr_data_blk into bpck6_write_block ata: pata_parport-bpck6: merge ppc6_rd_data_blk into bpck6_read_block ata: pata_parport-bpck6: merge ppc6_wr_port16_blk into bpck6_write_block ata: pata_parport-bpck6: merge ppc6_rd_port16_blk into bpck6_read_block ata: pata_parport-bpck6: merge ppc6_wr_port into bpck6_write_regr ata: pata_parport-bpck6: merge ppc6_rd_port into bpck6_read_regr ata: pata_parport-bpck6: remove ppc6_close ...
This commit is contained in:
commit
36006b1d5c
|
@ -30,12 +30,12 @@ select:
|
|||
- marvell,armada-3700-ahci
|
||||
- marvell,armada-8k-ahci
|
||||
- marvell,berlin2q-ahci
|
||||
- socionext,uniphier-pro4-ahci
|
||||
- socionext,uniphier-pxs2-ahci
|
||||
- socionext,uniphier-pxs3-ahci
|
||||
required:
|
||||
- compatible
|
||||
|
||||
allOf:
|
||||
- $ref: "ahci-common.yaml#"
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
oneOf:
|
||||
|
@ -45,6 +45,9 @@ properties:
|
|||
- marvell,armada-8k-ahci
|
||||
- marvell,berlin2-ahci
|
||||
- marvell,berlin2q-ahci
|
||||
- socionext,uniphier-pro4-ahci
|
||||
- socionext,uniphier-pxs2-ahci
|
||||
- socionext,uniphier-pxs3-ahci
|
||||
- const: generic-ahci
|
||||
- enum:
|
||||
- cavium,octeon-7130-ahci
|
||||
|
@ -74,7 +77,8 @@ properties:
|
|||
maxItems: 1
|
||||
|
||||
resets:
|
||||
maxItems: 1
|
||||
minItems: 1
|
||||
maxItems: 3
|
||||
|
||||
patternProperties:
|
||||
"^sata-port@[0-9a-f]+$":
|
||||
|
@ -91,6 +95,43 @@ required:
|
|||
- reg
|
||||
- interrupts
|
||||
|
||||
allOf:
|
||||
- $ref: ahci-common.yaml#
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: socionext,uniphier-pro4-ahci
|
||||
then:
|
||||
properties:
|
||||
resets:
|
||||
items:
|
||||
- description: reset line for the parent
|
||||
- description: reset line for the glue logic
|
||||
- description: reset line for the controller
|
||||
required:
|
||||
- resets
|
||||
else:
|
||||
if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
enum:
|
||||
- socionext,uniphier-pxs2-ahci
|
||||
- socionext,uniphier-pxs3-ahci
|
||||
then:
|
||||
properties:
|
||||
resets:
|
||||
items:
|
||||
- description: reset for the glue logic
|
||||
- description: reset for the controller
|
||||
required:
|
||||
- resets
|
||||
else:
|
||||
properties:
|
||||
resets:
|
||||
maxItems: 1
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
examples:
|
||||
|
|
|
@ -276,6 +276,7 @@ config AHCI_XGENE
|
|||
config AHCI_QORIQ
|
||||
tristate "Freescale QorIQ AHCI SATA support"
|
||||
depends on OF
|
||||
depends on SOC_LS1021A || ARCH_LAYERSCAPE || COMPILE_TEST
|
||||
select SATA_HOST
|
||||
help
|
||||
This option enables support for the Freescale QorIQ AHCI SoC's
|
||||
|
|
|
@ -106,7 +106,7 @@ static int mtk_ahci_parse_property(struct ahci_host_priv *hpriv,
|
|||
struct device_node *np = dev->of_node;
|
||||
|
||||
/* enable SATA function if needed */
|
||||
if (of_find_property(np, "mediatek,phy-mode", NULL)) {
|
||||
if (of_property_present(np, "mediatek,phy-mode")) {
|
||||
plat->mode = syscon_regmap_lookup_by_phandle(
|
||||
np, "mediatek,phy-mode");
|
||||
if (IS_ERR(plat->mode)) {
|
||||
|
|
|
@ -363,7 +363,7 @@ static int ahci_platform_get_phy(struct ahci_host_priv *hpriv, u32 port,
|
|||
switch (rc) {
|
||||
case -ENOSYS:
|
||||
/* No PHY support. Check if PHY is required. */
|
||||
if (of_find_property(node, "phys", NULL)) {
|
||||
if (of_property_present(node, "phys")) {
|
||||
dev_err(dev,
|
||||
"couldn't get PHY in node %pOFn: ENOSYS\n",
|
||||
node);
|
||||
|
|
|
@ -25,7 +25,7 @@ config PATA_PARPORT_BPCK
|
|||
|
||||
config PATA_PARPORT_BPCK6
|
||||
tristate "MicroSolutions backpack (Series 6) protocol"
|
||||
depends on (PATA_PARPORT) && !64BIT
|
||||
depends on PATA_PARPORT
|
||||
help
|
||||
This option enables support for the Micro Solutions BACKPACK
|
||||
parallel port Series 6 IDE protocol. (Most BACKPACK drives made
|
||||
|
|
|
@ -9,14 +9,6 @@
|
|||
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.05.05 init_proto, release_proto
|
||||
|
||||
*/
|
||||
|
||||
#define ATEN_VERSION "1.01"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -24,8 +16,7 @@
|
|||
#include <linux/wait.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#define j44(a,b) ((((a>>4)&0x0f)|(b&0xf0))^0x88)
|
||||
|
||||
|
@ -35,7 +26,7 @@
|
|||
|
||||
static int cont_map[2] = { 0x08, 0x20 };
|
||||
|
||||
static void aten_write_regr( PIA *pi, int cont, int regr, int val)
|
||||
static void aten_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -44,7 +35,7 @@ static void aten_write_regr( PIA *pi, int cont, int regr, int val)
|
|||
w0(r); w2(0xe); w2(6); w0(val); w2(7); w2(6); w2(0xc);
|
||||
}
|
||||
|
||||
static int aten_read_regr( PIA *pi, int cont, int regr )
|
||||
static int aten_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int a, b, r;
|
||||
|
||||
|
@ -67,7 +58,7 @@ static int aten_read_regr( PIA *pi, int cont, int regr )
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void aten_read_block( PIA *pi, char * buf, int count )
|
||||
static void aten_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k, a, b, c, d;
|
||||
|
||||
|
@ -95,7 +86,7 @@ static void aten_read_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void aten_write_block( PIA *pi, char * buf, int count )
|
||||
static void aten_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -107,28 +98,25 @@ static void aten_write_block( PIA *pi, char * buf, int count )
|
|||
w2(0xc);
|
||||
}
|
||||
|
||||
static void aten_connect ( PIA *pi )
|
||||
static void aten_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
w2(0xc);
|
||||
}
|
||||
|
||||
static void aten_disconnect ( PIA *pi )
|
||||
static void aten_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ w0(pi->saved_r0);
|
||||
w2(pi->saved_r2);
|
||||
}
|
||||
|
||||
static void aten_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void aten_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ char *mode_string[2] = {"4-bit","8-bit"};
|
||||
|
||||
printk("%s: aten %s, ATEN EH-100 at 0x%x, ",
|
||||
pi->device,ATEN_VERSION,pi->port);
|
||||
printk("mode %d (%s), delay %d\n",pi->mode,
|
||||
mode_string[pi->mode],pi->delay);
|
||||
|
||||
dev_info(&pi->dev, "ATEN EH-100 at 0x%x, mode %d (%s), delay %d\n",
|
||||
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol aten = {
|
||||
|
@ -147,16 +135,5 @@ static struct pi_protocol aten = {
|
|||
.log_adapter = aten_log_adapter,
|
||||
};
|
||||
|
||||
static int __init aten_init(void)
|
||||
{
|
||||
return paride_register(&aten);
|
||||
}
|
||||
|
||||
static void __exit aten_exit(void)
|
||||
{
|
||||
paride_unregister( &aten );
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(aten_init)
|
||||
module_exit(aten_exit)
|
||||
module_pata_parport_driver(aten);
|
||||
|
|
|
@ -7,15 +7,6 @@
|
|||
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.05.05 init_proto, release_proto, pi->delay
|
||||
1.02 GRG 1998.08.15 default pi->delay returned to 4
|
||||
|
||||
*/
|
||||
|
||||
#define BPCK_VERSION "1.02"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -23,8 +14,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#undef r2
|
||||
#undef w2
|
||||
|
@ -46,7 +36,7 @@
|
|||
|
||||
static int cont_map[3] = { 0x40, 0x48, 0 };
|
||||
|
||||
static int bpck_read_regr( PIA *pi, int cont, int regr )
|
||||
static int bpck_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int r, l, h;
|
||||
|
||||
|
@ -77,7 +67,7 @@ static int bpck_read_regr( PIA *pi, int cont, int regr )
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void bpck_write_regr( PIA *pi, int cont, int regr, int val )
|
||||
static void bpck_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -106,7 +96,7 @@ static void bpck_write_regr( PIA *pi, int cont, int regr, int val )
|
|||
#define WR(r,v) bpck_write_regr(pi,2,r,v)
|
||||
#define RR(r) (bpck_read_regr(pi,2,r))
|
||||
|
||||
static void bpck_write_block( PIA *pi, char * buf, int count )
|
||||
static void bpck_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int i;
|
||||
|
||||
|
@ -147,7 +137,7 @@ static void bpck_write_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void bpck_read_block( PIA *pi, char * buf, int count )
|
||||
static void bpck_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int i, l, h;
|
||||
|
||||
|
@ -194,7 +184,7 @@ static void bpck_read_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static int bpck_probe_unit ( PIA *pi )
|
||||
static int bpck_probe_unit(struct pi_adapter *pi)
|
||||
|
||||
{ int o1, o0, f7, id;
|
||||
int t, s;
|
||||
|
@ -217,7 +207,7 @@ static int bpck_probe_unit ( PIA *pi )
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void bpck_connect ( PIA *pi )
|
||||
static void bpck_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
w0(0xff-pi->unit); w2(4); w0(pi->unit);
|
||||
|
@ -241,24 +231,24 @@ static void bpck_connect ( PIA *pi )
|
|||
|
||||
WR(5,8);
|
||||
|
||||
if (pi->devtype == PI_PCD) {
|
||||
/* if (pi->devtype == PI_PCD) { possibly wrong, purpose unknown */
|
||||
WR(0x46,0x10); /* fiddle with ESS logic ??? */
|
||||
WR(0x4c,0x38);
|
||||
WR(0x4d,0x88);
|
||||
WR(0x46,0xa0);
|
||||
WR(0x41,0);
|
||||
WR(0x4e,8);
|
||||
}
|
||||
/* }*/
|
||||
}
|
||||
|
||||
static void bpck_disconnect ( PIA *pi )
|
||||
static void bpck_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ w0(0);
|
||||
if (pi->mode >= 2) { w2(9); w2(0); } else t2(2);
|
||||
w2(0x4c); w0(pi->saved_r0);
|
||||
}
|
||||
|
||||
static void bpck_force_spp ( PIA *pi )
|
||||
static void bpck_force_spp(struct pi_adapter *pi)
|
||||
|
||||
/* This fakes the EPP protocol to turn off EPP ... */
|
||||
|
||||
|
@ -276,7 +266,7 @@ static void bpck_force_spp ( PIA *pi )
|
|||
|
||||
#define TEST_LEN 16
|
||||
|
||||
static int bpck_test_proto( PIA *pi, char * scratch, int verbose )
|
||||
static int bpck_test_proto(struct pi_adapter *pi)
|
||||
|
||||
{ int i, e, l, h, om;
|
||||
char buf[TEST_LEN];
|
||||
|
@ -334,19 +324,16 @@ static int bpck_test_proto( PIA *pi, char * scratch, int verbose )
|
|||
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
printk("%s: bpck: 0x%x unit %d mode %d: ",
|
||||
pi->device,pi->port,pi->unit,pi->mode);
|
||||
for (i=0;i<TEST_LEN;i++) printk("%3d",buf[i]);
|
||||
printk("\n");
|
||||
}
|
||||
dev_dbg(&pi->dev, "bpck: 0x%x unit %d mode %d: ",
|
||||
pi->port, pi->unit, pi->mode);
|
||||
print_hex_dump_debug("bpck: ", DUMP_PREFIX_NONE, TEST_LEN, 1, buf, TEST_LEN, false);
|
||||
|
||||
e = 0;
|
||||
for (i=0;i<TEST_LEN;i++) if (buf[i] != (i+1)) e++;
|
||||
return e;
|
||||
}
|
||||
|
||||
static void bpck_read_eeprom ( PIA *pi, char * buf )
|
||||
static void bpck_read_eeprom(struct pi_adapter *pi, char *buf)
|
||||
|
||||
{ int i, j, k, p, v, f, om, od;
|
||||
|
||||
|
@ -397,7 +384,7 @@ static void bpck_read_eeprom ( PIA *pi, char * buf )
|
|||
pi->mode = om; pi->delay = od;
|
||||
}
|
||||
|
||||
static int bpck_test_port ( PIA *pi ) /* check for 8-bit port */
|
||||
static int bpck_test_port(struct pi_adapter *pi) /* check for 8-bit port */
|
||||
|
||||
{ int i, r, m;
|
||||
|
||||
|
@ -416,31 +403,17 @@ static int bpck_test_port ( PIA *pi ) /* check for 8-bit port */
|
|||
return 5;
|
||||
}
|
||||
|
||||
static void bpck_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void bpck_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ char *mode_string[5] = { "4-bit","8-bit","EPP-8",
|
||||
"EPP-16","EPP-32" };
|
||||
|
||||
#ifdef DUMP_EEPROM
|
||||
int i;
|
||||
#endif
|
||||
char scratch[128];
|
||||
|
||||
bpck_read_eeprom(pi,scratch);
|
||||
|
||||
#ifdef DUMP_EEPROM
|
||||
if (verbose) {
|
||||
for(i=0;i<128;i++)
|
||||
if ((scratch[i] < ' ') || (scratch[i] > '~'))
|
||||
scratch[i] = '.';
|
||||
printk("%s: bpck EEPROM: %64.64s\n",pi->device,scratch);
|
||||
printk("%s: %64.64s\n",pi->device,&scratch[64]);
|
||||
}
|
||||
#endif
|
||||
|
||||
printk("%s: bpck %s, backpack %8.8s unit %d",
|
||||
pi->device,BPCK_VERSION,&scratch[110],pi->unit);
|
||||
printk(" at 0x%x, mode %d (%s), delay %d\n",pi->port,
|
||||
pi->mode,mode_string[pi->mode],pi->delay);
|
||||
print_hex_dump_bytes("bpck EEPROM: ", DUMP_PREFIX_NONE, scratch, 128);
|
||||
dev_info(&pi->dev, "backpack %8.8s unit %d at 0x%x, mode %d (%s), delay %d\n",
|
||||
&scratch[110], pi->unit, pi->port, pi->mode,
|
||||
mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol bpck = {
|
||||
|
@ -462,16 +435,5 @@ static struct pi_protocol bpck = {
|
|||
.log_adapter = bpck_log_adapter,
|
||||
};
|
||||
|
||||
static int __init bpck_init(void)
|
||||
{
|
||||
return paride_register(&bpck);
|
||||
}
|
||||
|
||||
static void __exit bpck_exit(void)
|
||||
{
|
||||
paride_unregister(&bpck);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(bpck_init)
|
||||
module_exit(bpck_exit)
|
||||
module_pata_parport_driver(bpck);
|
||||
|
|
|
@ -11,219 +11,430 @@
|
|||
|
||||
*/
|
||||
|
||||
/*
|
||||
This is Ken's linux wrapper for the PPC library
|
||||
Version 1.0.0 is the backpack driver for which source is not available
|
||||
Version 2.0.0 is the first to have source released
|
||||
Version 2.0.1 is the "Cox-ified" source code
|
||||
Version 2.0.2 - fixed version string usage, and made ppc functions static
|
||||
*/
|
||||
|
||||
|
||||
#define BACKPACK_VERSION "2.0.2"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#include "ppc6lnx.c"
|
||||
#include <linux/pata_parport.h>
|
||||
/* 60772 Commands */
|
||||
#define ACCESS_REG 0x00
|
||||
#define ACCESS_PORT 0x40
|
||||
|
||||
/* PARAMETERS */
|
||||
static bool verbose; /* set this to 1 to see debugging messages and whatnot */
|
||||
|
||||
#define ACCESS_READ 0x00
|
||||
#define ACCESS_WRITE 0x20
|
||||
|
||||
#define PPCSTRUCT(pi) ((Interface *)(pi->private))
|
||||
/* 60772 Command Prefix */
|
||||
#define CMD_PREFIX_SET 0xe0 // Special command that modifies next command's operation
|
||||
#define CMD_PREFIX_RESET 0xc0 // Resets current cmd modifier reg bits
|
||||
#define PREFIX_IO16 0x01 // perform 16-bit wide I/O
|
||||
#define PREFIX_FASTWR 0x04 // enable PPC mode fast-write
|
||||
#define PREFIX_BLK 0x08 // enable block transfer mode
|
||||
|
||||
/****************************************************************/
|
||||
/*
|
||||
ATAPI CDROM DRIVE REGISTERS
|
||||
*/
|
||||
#define ATAPI_DATA 0 /* data port */
|
||||
#define ATAPI_ERROR 1 /* error register (read) */
|
||||
#define ATAPI_FEATURES 1 /* feature register (write) */
|
||||
#define ATAPI_INT_REASON 2 /* interrupt reason register */
|
||||
#define ATAPI_COUNT_LOW 4 /* byte count register (low) */
|
||||
#define ATAPI_COUNT_HIGH 5 /* byte count register (high) */
|
||||
#define ATAPI_DRIVE_SEL 6 /* drive select register */
|
||||
#define ATAPI_STATUS 7 /* status port (read) */
|
||||
#define ATAPI_COMMAND 7 /* command port (write) */
|
||||
#define ATAPI_ALT_STATUS 0x0e /* alternate status reg (read) */
|
||||
#define ATAPI_DEVICE_CONTROL 0x0e /* device control (write) */
|
||||
/****************************************************************/
|
||||
/* 60772 Registers */
|
||||
#define REG_STATUS 0x00 // status register
|
||||
#define STATUS_IRQA 0x01 // Peripheral IRQA line
|
||||
#define STATUS_EEPROM_DO 0x40 // Serial EEPROM data bit
|
||||
#define REG_VERSION 0x01 // PPC version register (read)
|
||||
#define REG_HWCFG 0x02 // Hardware Config register
|
||||
#define REG_RAMSIZE 0x03 // Size of RAM Buffer
|
||||
#define RAMSIZE_128K 0x02
|
||||
#define REG_EEPROM 0x06 // EEPROM control register
|
||||
#define EEPROM_SK 0x01 // eeprom SK bit
|
||||
#define EEPROM_DI 0x02 // eeprom DI bit
|
||||
#define EEPROM_CS 0x04 // eeprom CS bit
|
||||
#define EEPROM_EN 0x08 // eeprom output enable
|
||||
#define REG_BLKSIZE 0x08 // Block transfer len (24 bit)
|
||||
|
||||
static int bpck6_read_regr(PIA *pi, int cont, int reg)
|
||||
/* flags */
|
||||
#define fifo_wait 0x10
|
||||
|
||||
/* DONT CHANGE THESE LEST YOU BREAK EVERYTHING - BIT FIELD DEPENDENCIES */
|
||||
#define PPCMODE_UNI_SW 0
|
||||
#define PPCMODE_UNI_FW 1
|
||||
#define PPCMODE_BI_SW 2
|
||||
#define PPCMODE_BI_FW 3
|
||||
#define PPCMODE_EPP_BYTE 4
|
||||
#define PPCMODE_EPP_WORD 5
|
||||
#define PPCMODE_EPP_DWORD 6
|
||||
|
||||
static int mode_map[] = { PPCMODE_UNI_FW, PPCMODE_BI_FW, PPCMODE_EPP_BYTE,
|
||||
PPCMODE_EPP_WORD, PPCMODE_EPP_DWORD };
|
||||
|
||||
static void bpck6_send_cmd(struct pi_adapter *pi, u8 cmd)
|
||||
{
|
||||
unsigned int out;
|
||||
|
||||
/* check for bad settings */
|
||||
if (reg<0 || reg>7 || cont<0 || cont>2)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
out=ppc6_rd_port(PPCSTRUCT(pi),cont?reg|8:reg);
|
||||
return(out);
|
||||
}
|
||||
|
||||
static void bpck6_write_regr(PIA *pi, int cont, int reg, int val)
|
||||
{
|
||||
/* check for bad settings */
|
||||
if (reg>=0 && reg<=7 && cont>=0 && cont<=1)
|
||||
{
|
||||
ppc6_wr_port(PPCSTRUCT(pi),cont?reg|8:reg,(u8)val);
|
||||
switch (mode_map[pi->mode]) {
|
||||
case PPCMODE_UNI_SW:
|
||||
case PPCMODE_UNI_FW:
|
||||
case PPCMODE_BI_SW:
|
||||
case PPCMODE_BI_FW:
|
||||
parport_write_data(pi->pardev->port, cmd);
|
||||
parport_frob_control(pi->pardev->port, 0, PARPORT_CONTROL_AUTOFD);
|
||||
break;
|
||||
case PPCMODE_EPP_BYTE:
|
||||
case PPCMODE_EPP_WORD:
|
||||
case PPCMODE_EPP_DWORD:
|
||||
pi->pardev->port->ops->epp_write_addr(pi->pardev->port, &cmd, 1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void bpck6_write_block( PIA *pi, char * buf, int len )
|
||||
static u8 bpck6_rd_data_byte(struct pi_adapter *pi)
|
||||
{
|
||||
ppc6_wr_port16_blk(PPCSTRUCT(pi),ATAPI_DATA,buf,(u32)len>>1);
|
||||
u8 data = 0;
|
||||
|
||||
switch (mode_map[pi->mode]) {
|
||||
case PPCMODE_UNI_SW:
|
||||
case PPCMODE_UNI_FW:
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE,
|
||||
PARPORT_CONTROL_INIT);
|
||||
data = parport_read_status(pi->pardev->port);
|
||||
data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3);
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE,
|
||||
PARPORT_CONTROL_STROBE);
|
||||
data |= parport_read_status(pi->pardev->port) & 0xB8;
|
||||
break;
|
||||
case PPCMODE_BI_SW:
|
||||
case PPCMODE_BI_FW:
|
||||
parport_data_reverse(pi->pardev->port);
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE,
|
||||
PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT);
|
||||
data = parport_read_data(pi->pardev->port);
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0);
|
||||
parport_data_forward(pi->pardev->port);
|
||||
break;
|
||||
case PPCMODE_EPP_BYTE:
|
||||
case PPCMODE_EPP_WORD:
|
||||
case PPCMODE_EPP_DWORD:
|
||||
pi->pardev->port->ops->epp_read_data(pi->pardev->port, &data, 1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static void bpck6_read_block( PIA *pi, char * buf, int len )
|
||||
static void bpck6_wr_data_byte(struct pi_adapter *pi, u8 data)
|
||||
{
|
||||
ppc6_rd_port16_blk(PPCSTRUCT(pi),ATAPI_DATA,buf,(u32)len>>1);
|
||||
switch (mode_map[pi->mode]) {
|
||||
case PPCMODE_UNI_SW:
|
||||
case PPCMODE_UNI_FW:
|
||||
case PPCMODE_BI_SW:
|
||||
case PPCMODE_BI_FW:
|
||||
parport_write_data(pi->pardev->port, data);
|
||||
parport_frob_control(pi->pardev->port, 0, PARPORT_CONTROL_INIT);
|
||||
break;
|
||||
case PPCMODE_EPP_BYTE:
|
||||
case PPCMODE_EPP_WORD:
|
||||
case PPCMODE_EPP_DWORD:
|
||||
pi->pardev->port->ops->epp_write_data(pi->pardev->port, &data, 1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void bpck6_connect ( PIA *pi )
|
||||
static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg)
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
printk(KERN_DEBUG "connect\n");
|
||||
}
|
||||
u8 port = cont ? reg | 8 : reg;
|
||||
|
||||
if(pi->mode >=2)
|
||||
{
|
||||
PPCSTRUCT(pi)->mode=4+pi->mode-2;
|
||||
}
|
||||
else if(pi->mode==1)
|
||||
{
|
||||
PPCSTRUCT(pi)->mode=3;
|
||||
}
|
||||
else
|
||||
{
|
||||
PPCSTRUCT(pi)->mode=1;
|
||||
}
|
||||
|
||||
ppc6_open(PPCSTRUCT(pi));
|
||||
ppc6_wr_extout(PPCSTRUCT(pi),0x3);
|
||||
bpck6_send_cmd(pi, port | ACCESS_PORT | ACCESS_READ);
|
||||
return bpck6_rd_data_byte(pi);
|
||||
}
|
||||
|
||||
static void bpck6_disconnect ( PIA *pi )
|
||||
static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val)
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
printk("disconnect\n");
|
||||
}
|
||||
ppc6_wr_extout(PPCSTRUCT(pi),0x0);
|
||||
ppc6_close(PPCSTRUCT(pi));
|
||||
u8 port = cont ? reg | 8 : reg;
|
||||
|
||||
bpck6_send_cmd(pi, port | ACCESS_PORT | ACCESS_WRITE);
|
||||
bpck6_wr_data_byte(pi, val);
|
||||
}
|
||||
|
||||
static int bpck6_test_port ( PIA *pi ) /* check for 8-bit port */
|
||||
static void bpck6_wait_for_fifo(struct pi_adapter *pi)
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
printk(KERN_DEBUG "PARPORT indicates modes=%x for lp=0x%lx\n",
|
||||
((struct pardevice*)(pi->pardev))->port->modes,
|
||||
((struct pardevice *)(pi->pardev))->port->base);
|
||||
int i;
|
||||
|
||||
if (pi->private & fifo_wait) {
|
||||
for (i = 0; i < 20; i++)
|
||||
parport_read_status(pi->pardev->port);
|
||||
}
|
||||
}
|
||||
|
||||
static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len)
|
||||
{
|
||||
u8 this, last;
|
||||
|
||||
bpck6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE);
|
||||
bpck6_wr_data_byte(pi, (u8)len);
|
||||
bpck6_wr_data_byte(pi, (u8)(len >> 8));
|
||||
bpck6_wr_data_byte(pi, 0);
|
||||
|
||||
bpck6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK);
|
||||
bpck6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_WRITE);
|
||||
|
||||
switch (mode_map[pi->mode]) {
|
||||
case PPCMODE_UNI_SW:
|
||||
case PPCMODE_BI_SW:
|
||||
while (len--) {
|
||||
parport_write_data(pi->pardev->port, *buf++);
|
||||
parport_frob_control(pi->pardev->port, 0,
|
||||
PARPORT_CONTROL_INIT);
|
||||
}
|
||||
break;
|
||||
case PPCMODE_UNI_FW:
|
||||
case PPCMODE_BI_FW:
|
||||
bpck6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_FASTWR);
|
||||
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE,
|
||||
PARPORT_CONTROL_STROBE);
|
||||
|
||||
last = *buf;
|
||||
|
||||
parport_write_data(pi->pardev->port, last);
|
||||
|
||||
while (len) {
|
||||
this = *buf++;
|
||||
len--;
|
||||
|
||||
if (this == last) {
|
||||
parport_frob_control(pi->pardev->port, 0,
|
||||
PARPORT_CONTROL_INIT);
|
||||
} else {
|
||||
parport_write_data(pi->pardev->port, this);
|
||||
last = this;
|
||||
}
|
||||
}
|
||||
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE,
|
||||
0);
|
||||
bpck6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_FASTWR);
|
||||
break;
|
||||
case PPCMODE_EPP_BYTE:
|
||||
pi->pardev->port->ops->epp_write_data(pi->pardev->port, buf,
|
||||
len, PARPORT_EPP_FAST_8);
|
||||
bpck6_wait_for_fifo(pi);
|
||||
break;
|
||||
case PPCMODE_EPP_WORD:
|
||||
pi->pardev->port->ops->epp_write_data(pi->pardev->port, buf,
|
||||
len, PARPORT_EPP_FAST_16);
|
||||
bpck6_wait_for_fifo(pi);
|
||||
break;
|
||||
case PPCMODE_EPP_DWORD:
|
||||
pi->pardev->port->ops->epp_write_data(pi->pardev->port, buf,
|
||||
len, PARPORT_EPP_FAST_32);
|
||||
bpck6_wait_for_fifo(pi);
|
||||
break;
|
||||
}
|
||||
|
||||
/*copy over duplicate stuff.. initialize state info*/
|
||||
PPCSTRUCT(pi)->ppc_id=pi->unit;
|
||||
PPCSTRUCT(pi)->lpt_addr=pi->port;
|
||||
bpck6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK);
|
||||
}
|
||||
|
||||
/* look at the parport device to see if what modes we can use */
|
||||
if(((struct pardevice *)(pi->pardev))->port->modes &
|
||||
(PARPORT_MODE_EPP)
|
||||
)
|
||||
{
|
||||
return 5; /* Can do EPP*/
|
||||
static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len)
|
||||
{
|
||||
bpck6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE);
|
||||
bpck6_wr_data_byte(pi, (u8)len);
|
||||
bpck6_wr_data_byte(pi, (u8)(len >> 8));
|
||||
bpck6_wr_data_byte(pi, 0);
|
||||
|
||||
bpck6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK);
|
||||
bpck6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_READ);
|
||||
|
||||
switch (mode_map[pi->mode]) {
|
||||
case PPCMODE_UNI_SW:
|
||||
case PPCMODE_UNI_FW:
|
||||
while (len) {
|
||||
u8 d;
|
||||
|
||||
parport_frob_control(pi->pardev->port,
|
||||
PARPORT_CONTROL_STROBE,
|
||||
PARPORT_CONTROL_INIT); /* DATA STROBE */
|
||||
d = parport_read_status(pi->pardev->port);
|
||||
d = ((d & 0x80) >> 1) | ((d & 0x38) >> 3);
|
||||
parport_frob_control(pi->pardev->port,
|
||||
PARPORT_CONTROL_STROBE,
|
||||
PARPORT_CONTROL_STROBE);
|
||||
d |= parport_read_status(pi->pardev->port) & 0xB8;
|
||||
*buf++ = d;
|
||||
len--;
|
||||
}
|
||||
break;
|
||||
case PPCMODE_BI_SW:
|
||||
case PPCMODE_BI_FW:
|
||||
parport_data_reverse(pi->pardev->port);
|
||||
while (len) {
|
||||
parport_frob_control(pi->pardev->port,
|
||||
PARPORT_CONTROL_STROBE,
|
||||
PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT);
|
||||
*buf++ = parport_read_data(pi->pardev->port);
|
||||
len--;
|
||||
}
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE,
|
||||
0);
|
||||
parport_data_forward(pi->pardev->port);
|
||||
break;
|
||||
case PPCMODE_EPP_BYTE:
|
||||
pi->pardev->port->ops->epp_read_data(pi->pardev->port, buf, len,
|
||||
PARPORT_EPP_FAST_8);
|
||||
break;
|
||||
case PPCMODE_EPP_WORD:
|
||||
pi->pardev->port->ops->epp_read_data(pi->pardev->port, buf, len,
|
||||
PARPORT_EPP_FAST_16);
|
||||
break;
|
||||
case PPCMODE_EPP_DWORD:
|
||||
pi->pardev->port->ops->epp_read_data(pi->pardev->port, buf, len,
|
||||
PARPORT_EPP_FAST_32);
|
||||
break;
|
||||
}
|
||||
else if(((struct pardevice *)(pi->pardev))->port->modes &
|
||||
(PARPORT_MODE_TRISTATE)
|
||||
)
|
||||
{
|
||||
|
||||
bpck6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK);
|
||||
}
|
||||
|
||||
static int bpck6_open(struct pi_adapter *pi)
|
||||
{
|
||||
u8 i, j, k;
|
||||
|
||||
pi->saved_r0 = parport_read_data(pi->pardev->port);
|
||||
pi->saved_r2 = parport_read_control(pi->pardev->port) & 0x5F;
|
||||
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT,
|
||||
PARPORT_CONTROL_SELECT);
|
||||
if (pi->saved_r0 == 'b')
|
||||
parport_write_data(pi->pardev->port, 'x');
|
||||
parport_write_data(pi->pardev->port, 'b');
|
||||
parport_write_data(pi->pardev->port, 'p');
|
||||
parport_write_data(pi->pardev->port, pi->unit);
|
||||
parport_write_data(pi->pardev->port, ~pi->unit);
|
||||
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, 0);
|
||||
parport_write_control(pi->pardev->port, PARPORT_CONTROL_INIT);
|
||||
|
||||
i = mode_map[pi->mode] & 0x0C;
|
||||
if (i == 0)
|
||||
i = (mode_map[pi->mode] & 2) | 1;
|
||||
parport_write_data(pi->pardev->port, i);
|
||||
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT,
|
||||
PARPORT_CONTROL_SELECT);
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD,
|
||||
PARPORT_CONTROL_AUTOFD);
|
||||
|
||||
j = ((i & 0x08) << 4) | ((i & 0x07) << 3);
|
||||
k = parport_read_status(pi->pardev->port) & 0xB8;
|
||||
if (j != k)
|
||||
goto fail;
|
||||
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, 0);
|
||||
k = (parport_read_status(pi->pardev->port) & 0xB8) ^ 0xB8;
|
||||
if (j != k)
|
||||
goto fail;
|
||||
|
||||
if (i & 4) // EPP
|
||||
parport_frob_control(pi->pardev->port,
|
||||
PARPORT_CONTROL_SELECT | PARPORT_CONTROL_INIT, 0);
|
||||
else // PPC/ECP
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, 0);
|
||||
|
||||
pi->private = 0;
|
||||
|
||||
bpck6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE);
|
||||
bpck6_wr_data_byte(pi, RAMSIZE_128K);
|
||||
|
||||
bpck6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION);
|
||||
if ((bpck6_rd_data_byte(pi) & 0x3F) == 0x0C)
|
||||
pi->private |= fifo_wait;
|
||||
|
||||
return 1;
|
||||
|
||||
fail:
|
||||
parport_write_control(pi->pardev->port, pi->saved_r2);
|
||||
parport_write_data(pi->pardev->port, pi->saved_r0);
|
||||
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
static void bpck6_deselect(struct pi_adapter *pi)
|
||||
{
|
||||
if (mode_map[pi->mode] & 4) // EPP
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_INIT,
|
||||
PARPORT_CONTROL_INIT);
|
||||
else // PPC/ECP
|
||||
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT,
|
||||
PARPORT_CONTROL_SELECT);
|
||||
|
||||
parport_write_data(pi->pardev->port, pi->saved_r0);
|
||||
parport_write_control(pi->pardev->port,
|
||||
pi->saved_r2 | PARPORT_CONTROL_SELECT);
|
||||
parport_write_control(pi->pardev->port, pi->saved_r2);
|
||||
}
|
||||
|
||||
static void bpck6_wr_extout(struct pi_adapter *pi, u8 regdata)
|
||||
{
|
||||
bpck6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE);
|
||||
bpck6_wr_data_byte(pi, (u8)((regdata & 0x03) << 6));
|
||||
}
|
||||
|
||||
static void bpck6_connect(struct pi_adapter *pi)
|
||||
{
|
||||
dev_dbg(&pi->dev, "connect\n");
|
||||
|
||||
bpck6_open(pi);
|
||||
bpck6_wr_extout(pi, 0x3);
|
||||
}
|
||||
|
||||
static void bpck6_disconnect(struct pi_adapter *pi)
|
||||
{
|
||||
dev_dbg(&pi->dev, "disconnect\n");
|
||||
bpck6_wr_extout(pi, 0x0);
|
||||
bpck6_deselect(pi);
|
||||
}
|
||||
|
||||
static int bpck6_test_port(struct pi_adapter *pi) /* check for 8-bit port */
|
||||
{
|
||||
dev_dbg(&pi->dev, "PARPORT indicates modes=%x for lp=0x%lx\n",
|
||||
pi->pardev->port->modes, pi->pardev->port->base);
|
||||
|
||||
/* look at the parport device to see what modes we can use */
|
||||
if (pi->pardev->port->modes & PARPORT_MODE_EPP)
|
||||
return 5; /* Can do EPP */
|
||||
if (pi->pardev->port->modes & PARPORT_MODE_TRISTATE)
|
||||
return 2;
|
||||
}
|
||||
else /*Just flat SPP*/
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 1; /* Just flat SPP */
|
||||
}
|
||||
|
||||
static int bpck6_probe_unit ( PIA *pi )
|
||||
static int bpck6_probe_unit(struct pi_adapter *pi)
|
||||
{
|
||||
int out;
|
||||
int out, saved_mode;
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
printk(KERN_DEBUG "PROBE UNIT %x on port:%x\n",pi->unit,pi->port);
|
||||
}
|
||||
|
||||
/*SET PPC UNIT NUMBER*/
|
||||
PPCSTRUCT(pi)->ppc_id=pi->unit;
|
||||
dev_dbg(&pi->dev, "PROBE UNIT %x on port:%x\n", pi->unit, pi->port);
|
||||
|
||||
saved_mode = pi->mode;
|
||||
/*LOWER DOWN TO UNIDIRECTIONAL*/
|
||||
PPCSTRUCT(pi)->mode=1;
|
||||
pi->mode = 0;
|
||||
|
||||
out=ppc6_open(PPCSTRUCT(pi));
|
||||
out = bpck6_open(pi);
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
printk(KERN_DEBUG "ppc_open returned %2x\n",out);
|
||||
}
|
||||
dev_dbg(&pi->dev, "ppc_open returned %2x\n", out);
|
||||
|
||||
if(out)
|
||||
{
|
||||
ppc6_close(PPCSTRUCT(pi));
|
||||
if(verbose)
|
||||
{
|
||||
printk(KERN_DEBUG "leaving probe\n");
|
||||
}
|
||||
bpck6_deselect(pi);
|
||||
dev_dbg(&pi->dev, "leaving probe\n");
|
||||
pi->mode = saved_mode;
|
||||
return(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(verbose)
|
||||
{
|
||||
printk(KERN_DEBUG "Failed open\n");
|
||||
}
|
||||
dev_dbg(&pi->dev, "Failed open\n");
|
||||
pi->mode = saved_mode;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void bpck6_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void bpck6_log_adapter(struct pi_adapter *pi)
|
||||
{
|
||||
char *mode_string[5]=
|
||||
{"4-bit","8-bit","EPP-8","EPP-16","EPP-32"};
|
||||
|
||||
printk("%s: BACKPACK Protocol Driver V"BACKPACK_VERSION"\n",pi->device);
|
||||
printk("%s: Copyright 2001 by Micro Solutions, Inc., DeKalb IL.\n",pi->device);
|
||||
printk("%s: BACKPACK %s, Micro Solutions BACKPACK Drive at 0x%x\n",
|
||||
pi->device,BACKPACK_VERSION,pi->port);
|
||||
printk("%s: Unit: %d Mode:%d (%s) Delay %d\n",pi->device,
|
||||
pi->unit,pi->mode,mode_string[pi->mode],pi->delay);
|
||||
}
|
||||
|
||||
static int bpck6_init_proto(PIA *pi)
|
||||
{
|
||||
Interface *p = kzalloc(sizeof(Interface), GFP_KERNEL);
|
||||
|
||||
if (p) {
|
||||
pi->private = (unsigned long)p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk(KERN_ERR "%s: ERROR COULDN'T ALLOCATE MEMORY\n", pi->device);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void bpck6_release_proto(PIA *pi)
|
||||
{
|
||||
kfree((void *)(pi->private));
|
||||
dev_info(&pi->dev, "Micro Solutions BACKPACK Drive unit %d at 0x%x, mode:%d (%s), delay %d\n",
|
||||
pi->unit, pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol bpck6 = {
|
||||
|
@ -241,27 +452,9 @@ static struct pi_protocol bpck6 = {
|
|||
.test_port = bpck6_test_port,
|
||||
.probe_unit = bpck6_probe_unit,
|
||||
.log_adapter = bpck6_log_adapter,
|
||||
.init_proto = bpck6_init_proto,
|
||||
.release_proto = bpck6_release_proto,
|
||||
};
|
||||
|
||||
static int __init bpck6_init(void)
|
||||
{
|
||||
printk(KERN_INFO "bpck6: BACKPACK Protocol Driver V"BACKPACK_VERSION"\n");
|
||||
printk(KERN_INFO "bpck6: Copyright 2001 by Micro Solutions, Inc., DeKalb IL. USA\n");
|
||||
if(verbose)
|
||||
printk(KERN_DEBUG "bpck6: verbose debug enabled.\n");
|
||||
return paride_register(&bpck6);
|
||||
}
|
||||
|
||||
static void __exit bpck6_exit(void)
|
||||
{
|
||||
paride_unregister(&bpck6);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Micro Solutions Inc.");
|
||||
MODULE_DESCRIPTION("BACKPACK Protocol module, compatible with PARIDE");
|
||||
module_param(verbose, bool, 0644);
|
||||
module_init(bpck6_init)
|
||||
module_exit(bpck6_exit)
|
||||
module_pata_parport_driver(bpck6);
|
||||
|
|
|
@ -8,14 +8,6 @@
|
|||
use this adapter.
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.05.05 init_proto, release_proto
|
||||
|
||||
*/
|
||||
|
||||
#define COMM_VERSION "1.01"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -23,8 +15,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
/* mode codes: 0 nybble reads, 8-bit writes
|
||||
1 8-bit reads and writes
|
||||
|
@ -42,7 +33,7 @@
|
|||
|
||||
static int cont_map[2] = { 0x08, 0x10 };
|
||||
|
||||
static int comm_read_regr( PIA *pi, int cont, int regr )
|
||||
static int comm_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int l, h, r;
|
||||
|
||||
|
@ -68,7 +59,7 @@ static int comm_read_regr( PIA *pi, int cont, int regr )
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void comm_write_regr( PIA *pi, int cont, int regr, int val )
|
||||
static void comm_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -87,7 +78,7 @@ static void comm_write_regr( PIA *pi, int cont, int regr, int val )
|
|||
}
|
||||
}
|
||||
|
||||
static void comm_connect ( PIA *pi )
|
||||
static void comm_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
|
@ -98,14 +89,14 @@ static void comm_connect ( PIA *pi )
|
|||
w2(4); w0(0xe0); w2(0xc); w2(0xc); w2(4);
|
||||
}
|
||||
|
||||
static void comm_disconnect ( PIA *pi )
|
||||
static void comm_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ w2(0); w2(0); w2(0); w2(4);
|
||||
w0(pi->saved_r0);
|
||||
w2(pi->saved_r2);
|
||||
}
|
||||
|
||||
static void comm_read_block( PIA *pi, char * buf, int count )
|
||||
static void comm_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int i, l, h;
|
||||
|
||||
|
@ -146,7 +137,7 @@ static void comm_read_block( PIA *pi, char * buf, int count )
|
|||
|
||||
/* NB: Watch out for the byte swapped writes ! */
|
||||
|
||||
static void comm_write_block( PIA *pi, char * buf, int count )
|
||||
static void comm_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -165,26 +156,26 @@ static void comm_write_block( PIA *pi, char * buf, int count )
|
|||
break;
|
||||
|
||||
case 3: w3(0x48); (void)r1();
|
||||
for (k=0;k<count/2;k++) w4w(pi_swab16(buf,k));
|
||||
for (k = 0; k < count / 2; k++)
|
||||
w4w(swab16(((u16 *)buf)[k]));
|
||||
break;
|
||||
|
||||
case 4: w3(0x48); (void)r1();
|
||||
for (k=0;k<count/4;k++) w4l(pi_swab32(buf,k));
|
||||
for (k = 0; k < count / 4; k++)
|
||||
w4l(swab16(((u16 *)buf)[2 * k]) |
|
||||
swab16(((u16 *)buf)[2 * k + 1]) << 16);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void comm_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void comm_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ char *mode_string[5] = {"4-bit","8-bit","EPP-8","EPP-16","EPP-32"};
|
||||
|
||||
printk("%s: comm %s, DataStor Commuter at 0x%x, ",
|
||||
pi->device,COMM_VERSION,pi->port);
|
||||
printk("mode %d (%s), delay %d\n",pi->mode,
|
||||
mode_string[pi->mode],pi->delay);
|
||||
|
||||
dev_info(&pi->dev, "DataStor Commuter at 0x%x, mode %d (%s), delay %d\n",
|
||||
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol comm = {
|
||||
|
@ -203,16 +194,5 @@ static struct pi_protocol comm = {
|
|||
.log_adapter = comm_log_adapter,
|
||||
};
|
||||
|
||||
static int __init comm_init(void)
|
||||
{
|
||||
return paride_register(&comm);
|
||||
}
|
||||
|
||||
static void __exit comm_exit(void)
|
||||
{
|
||||
paride_unregister(&comm);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(comm_init)
|
||||
module_exit(comm_exit)
|
||||
module_pata_parport_driver(comm);
|
||||
|
|
|
@ -7,14 +7,6 @@
|
|||
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.05.06 init_proto, release_proto
|
||||
|
||||
*/
|
||||
|
||||
#define DSTR_VERSION "1.01"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -22,8 +14,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
/* mode codes: 0 nybble reads, 8-bit writes
|
||||
1 8-bit reads and writes
|
||||
|
@ -44,7 +35,7 @@
|
|||
|
||||
static int cont_map[2] = { 0x20, 0x40 };
|
||||
|
||||
static int dstr_read_regr( PIA *pi, int cont, int regr )
|
||||
static int dstr_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int a, b, r;
|
||||
|
||||
|
@ -71,7 +62,7 @@ static int dstr_read_regr( PIA *pi, int cont, int regr )
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void dstr_write_regr( PIA *pi, int cont, int regr, int val )
|
||||
static void dstr_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -98,21 +89,21 @@ static void dstr_write_regr( PIA *pi, int cont, int regr, int val )
|
|||
w0(0xaa);w0(0x55);w0(0);w0(0xff);w0(0x87);w0(0x78);\
|
||||
w0(x);w2(5);w2(4);
|
||||
|
||||
static void dstr_connect ( PIA *pi )
|
||||
static void dstr_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
w2(4); CCP(0xe0); w0(0xff);
|
||||
}
|
||||
|
||||
static void dstr_disconnect ( PIA *pi )
|
||||
static void dstr_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ CCP(0x30);
|
||||
w0(pi->saved_r0);
|
||||
w2(pi->saved_r2);
|
||||
}
|
||||
|
||||
static void dstr_read_block( PIA *pi, char * buf, int count )
|
||||
static void dstr_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k, a, b;
|
||||
|
||||
|
@ -154,7 +145,7 @@ static void dstr_read_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void dstr_write_block( PIA *pi, char * buf, int count )
|
||||
static void dstr_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -190,16 +181,13 @@ static void dstr_write_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
|
||||
|
||||
static void dstr_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void dstr_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ char *mode_string[5] = {"4-bit","8-bit","EPP-8",
|
||||
"EPP-16","EPP-32"};
|
||||
|
||||
printk("%s: dstr %s, DataStor EP2000 at 0x%x, ",
|
||||
pi->device,DSTR_VERSION,pi->port);
|
||||
printk("mode %d (%s), delay %d\n",pi->mode,
|
||||
mode_string[pi->mode],pi->delay);
|
||||
|
||||
dev_info(&pi->dev, "DataStor EP2000 at 0x%x, mode %d (%s), delay %d\n",
|
||||
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol dstr = {
|
||||
|
@ -218,16 +206,5 @@ static struct pi_protocol dstr = {
|
|||
.log_adapter = dstr_log_adapter,
|
||||
};
|
||||
|
||||
static int __init dstr_init(void)
|
||||
{
|
||||
return paride_register(&dstr);
|
||||
}
|
||||
|
||||
static void __exit dstr_exit(void)
|
||||
{
|
||||
paride_unregister(&dstr);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(dstr_init)
|
||||
module_exit(dstr_exit)
|
||||
module_pata_parport_driver(dstr);
|
||||
|
|
|
@ -9,15 +9,6 @@
|
|||
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.05.06 init_proto, release_proto
|
||||
1.02 Joshua b. Jore CPP(renamed), epat_connect, epat_disconnect
|
||||
|
||||
*/
|
||||
|
||||
#define EPAT_VERSION "1.02"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -25,8 +16,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#define j44(a,b) (((a>>4)&0x0f)+(b&0xf0))
|
||||
#define j53(a,b) (((a>>3)&0x1f)+((b<<4)&0xe0))
|
||||
|
@ -44,7 +34,7 @@ MODULE_PARM_DESC(epatc8, "support for the Shuttle EP1284 chip, "
|
|||
|
||||
static int cont_map[3] = { 0x18, 0x10, 0 };
|
||||
|
||||
static void epat_write_regr( PIA *pi, int cont, int regr, int val)
|
||||
static void epat_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -65,7 +55,7 @@ static void epat_write_regr( PIA *pi, int cont, int regr, int val)
|
|||
}
|
||||
}
|
||||
|
||||
static int epat_read_regr( PIA *pi, int cont, int regr )
|
||||
static int epat_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int a, b, r;
|
||||
|
||||
|
@ -94,7 +84,7 @@ static int epat_read_regr( PIA *pi, int cont, int regr )
|
|||
return -1; /* never gets here */
|
||||
}
|
||||
|
||||
static void epat_read_block( PIA *pi, char * buf, int count )
|
||||
static void epat_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k, ph, a, b;
|
||||
|
||||
|
@ -159,7 +149,7 @@ static void epat_read_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void epat_write_block( PIA *pi, char * buf, int count )
|
||||
static void epat_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int ph, k;
|
||||
|
||||
|
@ -210,7 +200,7 @@ static void epat_write_block( PIA *pi, char * buf, int count )
|
|||
#define CPP(x) w2(4);w0(0x22);w0(0xaa);w0(0x55);w0(0);w0(0xff);\
|
||||
w0(0x87);w0(0x78);w0(x);w2(4);w2(5);w2(4);w0(0xff);
|
||||
|
||||
static void epat_connect ( PIA *pi )
|
||||
static void epat_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
|
@ -242,16 +232,17 @@ static void epat_connect ( PIA *pi )
|
|||
}
|
||||
}
|
||||
|
||||
static void epat_disconnect (PIA *pi)
|
||||
static void epat_disconnect(struct pi_adapter *pi)
|
||||
{ CPP(0x30);
|
||||
w0(pi->saved_r0);
|
||||
w2(pi->saved_r2);
|
||||
}
|
||||
|
||||
static int epat_test_proto( PIA *pi, char * scratch, int verbose )
|
||||
static int epat_test_proto(struct pi_adapter *pi)
|
||||
|
||||
{ int k, j, f, cc;
|
||||
int e[2] = {0,0};
|
||||
char scratch[512];
|
||||
|
||||
epat_connect(pi);
|
||||
cc = RR(0xd);
|
||||
|
@ -279,15 +270,13 @@ static int epat_test_proto( PIA *pi, char * scratch, int verbose )
|
|||
}
|
||||
epat_disconnect(pi);
|
||||
|
||||
if (verbose) {
|
||||
printk("%s: epat: port 0x%x, mode %d, ccr %x, test=(%d,%d,%d)\n",
|
||||
pi->device,pi->port,pi->mode,cc,e[0],e[1],f);
|
||||
}
|
||||
dev_dbg(&pi->dev, "epat: port 0x%x, mode %d, ccr %x, test=(%d,%d,%d)\n",
|
||||
pi->port, pi->mode, cc, e[0], e[1], f);
|
||||
|
||||
return (e[0] && e[1]) || f;
|
||||
}
|
||||
|
||||
static void epat_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void epat_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ int ver;
|
||||
char *mode_string[6] =
|
||||
|
@ -298,11 +287,8 @@ static void epat_log_adapter( PIA *pi, char * scratch, int verbose )
|
|||
ver = RR(0xb);
|
||||
epat_disconnect(pi);
|
||||
|
||||
printk("%s: epat %s, Shuttle EPAT chip %x at 0x%x, ",
|
||||
pi->device,EPAT_VERSION,ver,pi->port);
|
||||
printk("mode %d (%s), delay %d\n",pi->mode,
|
||||
mode_string[pi->mode],pi->delay);
|
||||
|
||||
dev_info(&pi->dev, "Shuttle EPAT chip %x at 0x%x, mode %d (%s), delay %d\n",
|
||||
ver, pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol epat = {
|
||||
|
@ -324,15 +310,15 @@ static struct pi_protocol epat = {
|
|||
|
||||
static int __init epat_init(void)
|
||||
{
|
||||
#ifdef CONFIG_PARIDE_EPATC8
|
||||
#ifdef CONFIG_PATA_PARPORT_EPATC8
|
||||
epatc8 = 1;
|
||||
#endif
|
||||
return paride_register(&epat);
|
||||
return pata_parport_register_driver(&epat);
|
||||
}
|
||||
|
||||
static void __exit epat_exit(void)
|
||||
{
|
||||
paride_unregister(&epat);
|
||||
pata_parport_unregister_driver(&epat);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
@ -10,15 +10,6 @@
|
|||
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.05.06 init_proto, release_proto
|
||||
1.02 GRG 1998.06.17 support older versions of EPIA
|
||||
|
||||
*/
|
||||
|
||||
#define EPIA_VERSION "1.02"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -26,8 +17,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
/* mode codes: 0 nybble reads on port 1, 8-bit writes
|
||||
1 5/3 reads on ports 1 & 2, 8-bit writes
|
||||
|
@ -46,7 +36,7 @@
|
|||
|
||||
static int cont_map[2] = { 0, 0x80 };
|
||||
|
||||
static int epia_read_regr( PIA *pi, int cont, int regr )
|
||||
static int epia_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int a, b, r;
|
||||
|
||||
|
@ -79,7 +69,7 @@ static int epia_read_regr( PIA *pi, int cont, int regr )
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void epia_write_regr( PIA *pi, int cont, int regr, int val)
|
||||
static void epia_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -110,7 +100,7 @@ static void epia_write_regr( PIA *pi, int cont, int regr, int val)
|
|||
2048 byte reads (the last two being used in the CDrom drivers.
|
||||
*/
|
||||
|
||||
static void epia_connect ( PIA *pi )
|
||||
static void epia_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
|
@ -124,7 +114,7 @@ static void epia_connect ( PIA *pi )
|
|||
WR(0x86,8);
|
||||
}
|
||||
|
||||
static void epia_disconnect ( PIA *pi )
|
||||
static void epia_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ /* WR(0x84,0x10); */
|
||||
w0(pi->saved_r0);
|
||||
|
@ -133,7 +123,7 @@ static void epia_disconnect ( PIA *pi )
|
|||
w2(pi->saved_r2);
|
||||
}
|
||||
|
||||
static void epia_read_block( PIA *pi, char * buf, int count )
|
||||
static void epia_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k, ph, a, b;
|
||||
|
||||
|
@ -193,7 +183,7 @@ static void epia_read_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void epia_write_block( PIA *pi, char * buf, int count )
|
||||
static void epia_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int ph, k, last, d;
|
||||
|
||||
|
@ -234,10 +224,11 @@ static void epia_write_block( PIA *pi, char * buf, int count )
|
|||
|
||||
}
|
||||
|
||||
static int epia_test_proto( PIA *pi, char * scratch, int verbose )
|
||||
static int epia_test_proto(struct pi_adapter *pi)
|
||||
|
||||
{ int j, k, f;
|
||||
int e[2] = {0,0};
|
||||
char scratch[512];
|
||||
|
||||
epia_connect(pi);
|
||||
for (j=0;j<2;j++) {
|
||||
|
@ -262,26 +253,21 @@ static int epia_test_proto( PIA *pi, char * scratch, int verbose )
|
|||
WR(0x84,0);
|
||||
epia_disconnect(pi);
|
||||
|
||||
if (verbose) {
|
||||
printk("%s: epia: port 0x%x, mode %d, test=(%d,%d,%d)\n",
|
||||
pi->device,pi->port,pi->mode,e[0],e[1],f);
|
||||
}
|
||||
dev_dbg(&pi->dev, "epia: port 0x%x, mode %d, test=(%d,%d,%d)\n",
|
||||
pi->port, pi->mode, e[0], e[1], f);
|
||||
|
||||
return (e[0] && e[1]) || f;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void epia_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void epia_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ char *mode_string[6] = {"4-bit","5/3","8-bit",
|
||||
"EPP-8","EPP-16","EPP-32"};
|
||||
|
||||
printk("%s: epia %s, Shuttle EPIA at 0x%x, ",
|
||||
pi->device,EPIA_VERSION,pi->port);
|
||||
printk("mode %d (%s), delay %d\n",pi->mode,
|
||||
mode_string[pi->mode],pi->delay);
|
||||
|
||||
dev_info(&pi->dev, "Shuttle EPIA at 0x%x, mode %d (%s), delay %d\n",
|
||||
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol epia = {
|
||||
|
@ -301,16 +287,5 @@ static struct pi_protocol epia = {
|
|||
.log_adapter = epia_log_adapter,
|
||||
};
|
||||
|
||||
static int __init epia_init(void)
|
||||
{
|
||||
return paride_register(&epia);
|
||||
}
|
||||
|
||||
static void __exit epia_exit(void)
|
||||
{
|
||||
paride_unregister(&epia);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(epia_init)
|
||||
module_exit(epia_exit)
|
||||
module_pata_parport_driver(epia);
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
|
||||
*/
|
||||
|
||||
#define FIT2_VERSION "1.0"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -22,8 +20,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#define j44(a,b) (((a>>4)&0x0f)|(b&0xf0))
|
||||
|
||||
|
@ -37,13 +34,13 @@ devices.
|
|||
|
||||
*/
|
||||
|
||||
static void fit2_write_regr( PIA *pi, int cont, int regr, int val)
|
||||
static void fit2_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ if (cont == 1) return;
|
||||
w2(0xc); w0(regr); w2(4); w0(val); w2(5); w0(0); w2(4);
|
||||
}
|
||||
|
||||
static int fit2_read_regr( PIA *pi, int cont, int regr )
|
||||
static int fit2_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int a, b, r;
|
||||
|
||||
|
@ -61,7 +58,7 @@ static int fit2_read_regr( PIA *pi, int cont, int regr )
|
|||
|
||||
}
|
||||
|
||||
static void fit2_read_block( PIA *pi, char * buf, int count )
|
||||
static void fit2_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k, a, b, c, d;
|
||||
|
||||
|
@ -87,7 +84,7 @@ static void fit2_read_block( PIA *pi, char * buf, int count )
|
|||
|
||||
}
|
||||
|
||||
static void fit2_write_block( PIA *pi, char * buf, int count )
|
||||
static void fit2_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -100,23 +97,24 @@ static void fit2_write_block( PIA *pi, char * buf, int count )
|
|||
w2(4);
|
||||
}
|
||||
|
||||
static void fit2_connect ( PIA *pi )
|
||||
static void fit2_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
w2(0xcc);
|
||||
}
|
||||
|
||||
static void fit2_disconnect ( PIA *pi )
|
||||
static void fit2_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ w0(pi->saved_r0);
|
||||
w2(pi->saved_r2);
|
||||
}
|
||||
|
||||
static void fit2_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void fit2_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ printk("%s: fit2 %s, FIT 2000 adapter at 0x%x, delay %d\n",
|
||||
pi->device,FIT2_VERSION,pi->port,pi->delay);
|
||||
{
|
||||
dev_info(&pi->dev, "FIT 2000 adapter at 0x%x, delay %d\n",
|
||||
pi->port, pi->delay);
|
||||
|
||||
}
|
||||
|
||||
|
@ -136,16 +134,5 @@ static struct pi_protocol fit2 = {
|
|||
.log_adapter = fit2_log_adapter,
|
||||
};
|
||||
|
||||
static int __init fit2_init(void)
|
||||
{
|
||||
return paride_register(&fit2);
|
||||
}
|
||||
|
||||
static void __exit fit2_exit(void)
|
||||
{
|
||||
paride_unregister(&fit2);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(fit2_init)
|
||||
module_exit(fit2_exit)
|
||||
module_pata_parport_driver(fit2);
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
*/
|
||||
|
||||
#define FIT3_VERSION "1.0"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -26,8 +24,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#define j44(a,b) (((a>>3)&0x0f)|((b<<1)&0xf0))
|
||||
|
||||
|
@ -39,7 +36,7 @@
|
|||
|
||||
*/
|
||||
|
||||
static void fit3_write_regr( PIA *pi, int cont, int regr, int val)
|
||||
static void fit3_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ if (cont == 1) return;
|
||||
|
||||
|
@ -59,7 +56,7 @@ static void fit3_write_regr( PIA *pi, int cont, int regr, int val)
|
|||
}
|
||||
}
|
||||
|
||||
static int fit3_read_regr( PIA *pi, int cont, int regr )
|
||||
static int fit3_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int a, b;
|
||||
|
||||
|
@ -92,7 +89,7 @@ static int fit3_read_regr( PIA *pi, int cont, int regr )
|
|||
|
||||
}
|
||||
|
||||
static void fit3_read_block( PIA *pi, char * buf, int count )
|
||||
static void fit3_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k, a, b, c, d;
|
||||
|
||||
|
@ -131,7 +128,7 @@ static void fit3_read_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void fit3_write_block( PIA *pi, char * buf, int count )
|
||||
static void fit3_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -152,7 +149,7 @@ static void fit3_write_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void fit3_connect ( PIA *pi )
|
||||
static void fit3_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
|
@ -162,22 +159,19 @@ static void fit3_connect ( PIA *pi )
|
|||
}
|
||||
}
|
||||
|
||||
static void fit3_disconnect ( PIA *pi )
|
||||
static void fit3_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ w2(0xc); w0(0xa); w2(0x8); w2(0xc);
|
||||
w0(pi->saved_r0);
|
||||
w2(pi->saved_r2);
|
||||
}
|
||||
|
||||
static void fit3_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void fit3_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ char *mode_string[3] = {"4-bit","8-bit","EPP"};
|
||||
|
||||
printk("%s: fit3 %s, FIT 3000 adapter at 0x%x, "
|
||||
"mode %d (%s), delay %d\n",
|
||||
pi->device,FIT3_VERSION,pi->port,
|
||||
pi->mode,mode_string[pi->mode],pi->delay);
|
||||
|
||||
dev_info(&pi->dev, "FIT 3000 adapter at 0x%x, mode %d (%s), delay %d\n",
|
||||
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol fit3 = {
|
||||
|
@ -196,16 +190,5 @@ static struct pi_protocol fit3 = {
|
|||
.log_adapter = fit3_log_adapter,
|
||||
};
|
||||
|
||||
static int __init fit3_init(void)
|
||||
{
|
||||
return paride_register(&fit3);
|
||||
}
|
||||
|
||||
static void __exit fit3_exit(void)
|
||||
{
|
||||
paride_unregister(&fit3);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(fit3_init)
|
||||
module_exit(fit3_exit)
|
||||
module_pata_parport_driver(fit3);
|
||||
|
|
|
@ -20,13 +20,6 @@
|
|||
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.12.20 Added support for soft power switch
|
||||
*/
|
||||
|
||||
#define FRIQ_VERSION "1.01"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -34,8 +27,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#define CMD(x) w2(4);w0(0xff);w0(0xff);w0(0x73);w0(0x73);\
|
||||
w0(0xc9);w0(0xc9);w0(0x26);w0(0x26);w0(x);w0(x);
|
||||
|
@ -48,7 +40,7 @@
|
|||
|
||||
static int cont_map[2] = { 0x08, 0x10 };
|
||||
|
||||
static int friq_read_regr( PIA *pi, int cont, int regr )
|
||||
static int friq_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int h,l,r;
|
||||
|
||||
|
@ -63,7 +55,7 @@ static int friq_read_regr( PIA *pi, int cont, int regr )
|
|||
|
||||
}
|
||||
|
||||
static void friq_write_regr( PIA *pi, int cont, int regr, int val)
|
||||
static void friq_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -74,7 +66,7 @@ static void friq_write_regr( PIA *pi, int cont, int regr, int val)
|
|||
w2(5);w2(7);w2(5);w2(4);
|
||||
}
|
||||
|
||||
static void friq_read_block_int( PIA *pi, char * buf, int count, int regr )
|
||||
static void friq_read_block_int(struct pi_adapter *pi, char *buf, int count, int regr)
|
||||
|
||||
{ int h, l, k, ph;
|
||||
|
||||
|
@ -129,12 +121,12 @@ static void friq_read_block_int( PIA *pi, char * buf, int count, int regr )
|
|||
}
|
||||
}
|
||||
|
||||
static void friq_read_block( PIA *pi, char * buf, int count)
|
||||
static void friq_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ friq_read_block_int(pi,buf,count,0x08);
|
||||
}
|
||||
|
||||
static void friq_write_block( PIA *pi, char * buf, int count )
|
||||
static void friq_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -166,24 +158,25 @@ static void friq_write_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void friq_connect ( PIA *pi )
|
||||
static void friq_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
w2(4);
|
||||
}
|
||||
|
||||
static void friq_disconnect ( PIA *pi )
|
||||
static void friq_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ CMD(0x20);
|
||||
w0(pi->saved_r0);
|
||||
w2(pi->saved_r2);
|
||||
}
|
||||
|
||||
static int friq_test_proto( PIA *pi, char * scratch, int verbose )
|
||||
static int friq_test_proto(struct pi_adapter *pi)
|
||||
|
||||
{ int j, k, r;
|
||||
int e[2] = {0,0};
|
||||
char scratch[512];
|
||||
|
||||
pi->saved_r0 = r0();
|
||||
w0(0xff); udelay(20); CMD(0x3d); /* turn the power on */
|
||||
|
@ -207,24 +200,20 @@ static int friq_test_proto( PIA *pi, char * scratch, int verbose )
|
|||
for (k=0;k<128;k++) if (scratch[k] != k) r++;
|
||||
friq_disconnect(pi);
|
||||
|
||||
if (verbose) {
|
||||
printk("%s: friq: port 0x%x, mode %d, test=(%d,%d,%d)\n",
|
||||
pi->device,pi->port,pi->mode,e[0],e[1],r);
|
||||
}
|
||||
dev_dbg(&pi->dev, "friq: port 0x%x, mode %d, test=(%d,%d,%d)\n",
|
||||
pi->port, pi->mode, e[0], e[1], r);
|
||||
|
||||
return (r || (e[0] && e[1]));
|
||||
}
|
||||
|
||||
|
||||
static void friq_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void friq_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ char *mode_string[6] = {"4-bit","8-bit",
|
||||
"EPP-8","EPP-16","EPP-32"};
|
||||
|
||||
printk("%s: friq %s, Freecom IQ ASIC-2 adapter at 0x%x, ", pi->device,
|
||||
FRIQ_VERSION,pi->port);
|
||||
printk("mode %d (%s), delay %d\n",pi->mode,
|
||||
mode_string[pi->mode],pi->delay);
|
||||
dev_info(&pi->dev, "Freecom IQ ASIC-2 adapter at 0x%x, mode %d (%s), delay %d\n",
|
||||
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
|
||||
pi->private = 1;
|
||||
friq_connect(pi);
|
||||
|
@ -233,7 +222,7 @@ static void friq_log_adapter( PIA *pi, char * scratch, int verbose )
|
|||
|
||||
}
|
||||
|
||||
static void friq_release_proto( PIA *pi)
|
||||
static void friq_release_proto(struct pi_adapter *pi)
|
||||
{
|
||||
if (pi->private) { /* turn off the power */
|
||||
friq_connect(pi);
|
||||
|
@ -261,16 +250,5 @@ static struct pi_protocol friq = {
|
|||
.release_proto = friq_release_proto,
|
||||
};
|
||||
|
||||
static int __init friq_init(void)
|
||||
{
|
||||
return paride_register(&friq);
|
||||
}
|
||||
|
||||
static void __exit friq_exit(void)
|
||||
{
|
||||
paride_unregister(&friq);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(friq_init)
|
||||
module_exit(friq_exit)
|
||||
module_pata_parport_driver(friq);
|
||||
|
|
|
@ -13,18 +13,6 @@
|
|||
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.05.06 init_proto, release_proto
|
||||
fix chip detect
|
||||
added EPP-16 and EPP-32
|
||||
1.02 GRG 1998.09.23 added hard reset to initialisation process
|
||||
1.03 GRG 1998.12.14 made hard reset conditional
|
||||
|
||||
*/
|
||||
|
||||
#define FRPW_VERSION "1.03"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -32,8 +20,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#define cec4 w2(0xc);w2(0xe);w2(0xe);w2(0xc);w2(4);w2(4);w2(4);
|
||||
#define j44(l,h) (((l>>4)&0x0f)|(h&0xf0))
|
||||
|
@ -44,7 +31,7 @@
|
|||
|
||||
static int cont_map[2] = { 0x08, 0x10 };
|
||||
|
||||
static int frpw_read_regr( PIA *pi, int cont, int regr )
|
||||
static int frpw_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int h,l,r;
|
||||
|
||||
|
@ -60,7 +47,7 @@ static int frpw_read_regr( PIA *pi, int cont, int regr )
|
|||
|
||||
}
|
||||
|
||||
static void frpw_write_regr( PIA *pi, int cont, int regr, int val)
|
||||
static void frpw_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -71,7 +58,7 @@ static void frpw_write_regr( PIA *pi, int cont, int regr, int val)
|
|||
w2(5);w2(7);w2(5);w2(4);
|
||||
}
|
||||
|
||||
static void frpw_read_block_int( PIA *pi, char * buf, int count, int regr )
|
||||
static void frpw_read_block_int(struct pi_adapter *pi, char *buf, int count, int regr)
|
||||
|
||||
{ int h, l, k, ph;
|
||||
|
||||
|
@ -132,12 +119,12 @@ static void frpw_read_block_int( PIA *pi, char * buf, int count, int regr )
|
|||
}
|
||||
}
|
||||
|
||||
static void frpw_read_block( PIA *pi, char * buf, int count)
|
||||
static void frpw_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ frpw_read_block_int(pi,buf,count,0x08);
|
||||
}
|
||||
|
||||
static void frpw_write_block( PIA *pi, char * buf, int count )
|
||||
static void frpw_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -170,14 +157,14 @@ static void frpw_write_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void frpw_connect ( PIA *pi )
|
||||
static void frpw_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
w2(4);
|
||||
}
|
||||
|
||||
static void frpw_disconnect ( PIA *pi )
|
||||
static void frpw_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ w2(4); w0(0x20); cec4;
|
||||
w0(pi->saved_r0);
|
||||
|
@ -188,7 +175,7 @@ static void frpw_disconnect ( PIA *pi )
|
|||
between the Xilinx and ASIC implementations of the Freecom adapter.
|
||||
*/
|
||||
|
||||
static int frpw_test_pnp ( PIA *pi )
|
||||
static int frpw_test_pnp(struct pi_adapter *pi)
|
||||
|
||||
/* returns chip_type: 0 = Xilinx, 1 = ASIC */
|
||||
|
||||
|
@ -221,25 +208,22 @@ static int frpw_test_pnp ( PIA *pi )
|
|||
a hack :-(
|
||||
*/
|
||||
|
||||
static int frpw_test_proto( PIA *pi, char * scratch, int verbose )
|
||||
static int frpw_test_proto(struct pi_adapter *pi)
|
||||
|
||||
{ int j, k, r;
|
||||
int e[2] = {0,0};
|
||||
char scratch[512];
|
||||
|
||||
if ((pi->private>>1) != pi->port)
|
||||
pi->private = frpw_test_pnp(pi) + 2*pi->port;
|
||||
|
||||
if (((pi->private%2) == 0) && (pi->mode > 2)) {
|
||||
if (verbose)
|
||||
printk("%s: frpw: Xilinx does not support mode %d\n",
|
||||
pi->device, pi->mode);
|
||||
dev_dbg(&pi->dev, "frpw: Xilinx does not support mode %d\n", pi->mode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (((pi->private%2) == 1) && (pi->mode == 2)) {
|
||||
if (verbose)
|
||||
printk("%s: frpw: ASIC does not support mode 2\n",
|
||||
pi->device);
|
||||
dev_dbg(&pi->dev, "frpw: ASIC does not support mode 2\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -260,25 +244,21 @@ static int frpw_test_proto( PIA *pi, char * scratch, int verbose )
|
|||
for (k=0;k<128;k++) if (scratch[k] != k) r++;
|
||||
frpw_disconnect(pi);
|
||||
|
||||
if (verbose) {
|
||||
printk("%s: frpw: port 0x%x, chip %ld, mode %d, test=(%d,%d,%d)\n",
|
||||
pi->device,pi->port,(pi->private%2),pi->mode,e[0],e[1],r);
|
||||
}
|
||||
dev_dbg(&pi->dev, "frpw: port 0x%x, chip %ld, mode %d, test=(%d,%d,%d)\n",
|
||||
pi->port, (pi->private%2), pi->mode, e[0], e[1], r);
|
||||
|
||||
return (r || (e[0] && e[1]));
|
||||
}
|
||||
|
||||
|
||||
static void frpw_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void frpw_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ char *mode_string[6] = {"4-bit","8-bit","EPP",
|
||||
"EPP-8","EPP-16","EPP-32"};
|
||||
|
||||
printk("%s: frpw %s, Freecom (%s) adapter at 0x%x, ", pi->device,
|
||||
FRPW_VERSION,((pi->private%2) == 0)?"Xilinx":"ASIC",pi->port);
|
||||
printk("mode %d (%s), delay %d\n",pi->mode,
|
||||
mode_string[pi->mode],pi->delay);
|
||||
|
||||
dev_info(&pi->dev, "Freecom (%s) adapter at 0x%x, mode %d (%s), delay %d\n",
|
||||
((pi->private % 2) == 0) ? "Xilinx" : "ASIC",
|
||||
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol frpw = {
|
||||
|
@ -298,16 +278,5 @@ static struct pi_protocol frpw = {
|
|||
.log_adapter = frpw_log_adapter,
|
||||
};
|
||||
|
||||
static int __init frpw_init(void)
|
||||
{
|
||||
return paride_register(&frpw);
|
||||
}
|
||||
|
||||
static void __exit frpw_exit(void)
|
||||
{
|
||||
paride_unregister(&frpw);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(frpw_init)
|
||||
module_exit(frpw_exit)
|
||||
module_pata_parport_driver(frpw);
|
||||
|
|
|
@ -12,14 +12,6 @@
|
|||
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.05.06 init_proto, release_proto
|
||||
|
||||
*/
|
||||
|
||||
#define KBIC_VERSION "1.01"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -27,8 +19,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#define r12w() (delay_p,inw(pi->port+1)&0xffff)
|
||||
|
||||
|
@ -42,7 +33,7 @@
|
|||
|
||||
static int cont_map[2] = { 0x80, 0x40 };
|
||||
|
||||
static int kbic_read_regr( PIA *pi, int cont, int regr )
|
||||
static int kbic_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int a, b, s;
|
||||
|
||||
|
@ -72,7 +63,7 @@ static int kbic_read_regr( PIA *pi, int cont, int regr )
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void kbic_write_regr( PIA *pi, int cont, int regr, int val)
|
||||
static void kbic_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int s;
|
||||
|
||||
|
@ -96,14 +87,14 @@ static void kbic_write_regr( PIA *pi, int cont, int regr, int val)
|
|||
}
|
||||
}
|
||||
|
||||
static void k951_connect ( PIA *pi )
|
||||
static void k951_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
w2(4);
|
||||
}
|
||||
|
||||
static void k951_disconnect ( PIA *pi )
|
||||
static void k951_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ w0(pi->saved_r0);
|
||||
w2(pi->saved_r2);
|
||||
|
@ -112,7 +103,7 @@ static void k951_disconnect ( PIA *pi )
|
|||
#define CCP(x) w2(0xc4);w0(0xaa);w0(0x55);w0(0);w0(0xff);w0(0x87);\
|
||||
w0(0x78);w0(x);w2(0xc5);w2(0xc4);w0(0xff);
|
||||
|
||||
static void k971_connect ( PIA *pi )
|
||||
static void k971_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
|
@ -120,7 +111,7 @@ static void k971_connect ( PIA *pi )
|
|||
w2(4);
|
||||
}
|
||||
|
||||
static void k971_disconnect ( PIA *pi )
|
||||
static void k971_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ CCP(0x30);
|
||||
w0(pi->saved_r0);
|
||||
|
@ -131,7 +122,7 @@ static void k971_disconnect ( PIA *pi )
|
|||
have this property.
|
||||
*/
|
||||
|
||||
static void kbic_read_block( PIA *pi, char * buf, int count )
|
||||
static void kbic_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k, a, b;
|
||||
|
||||
|
@ -189,7 +180,7 @@ static void kbic_read_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void kbic_write_block( PIA *pi, char * buf, int count )
|
||||
static void kbic_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -213,12 +204,15 @@ static void kbic_write_block( PIA *pi, char * buf, int count )
|
|||
break;
|
||||
|
||||
case 4: w0(0xa0); w2(4); w2(6); w2(4); w3(0);
|
||||
for(k=0;k<count/2;k++) w4w(pi_swab16(buf,k));
|
||||
for (k = 0; k < count / 2; k++)
|
||||
w4w(swab16(((u16 *)buf)[k]));
|
||||
w2(4); w2(0); w2(4);
|
||||
break;
|
||||
|
||||
case 5: w0(0xa0); w2(4); w2(6); w2(4); w3(0);
|
||||
for(k=0;k<count/4;k++) w4l(pi_swab32(buf,k));
|
||||
for (k = 0; k < count / 4; k++)
|
||||
w4l(swab16(((u16 *)buf)[2 * k]) |
|
||||
swab16(((u16 *)buf)[2 * k + 1]) << 16);
|
||||
w2(4); w2(0); w2(4);
|
||||
break;
|
||||
|
||||
|
@ -226,27 +220,23 @@ static void kbic_write_block( PIA *pi, char * buf, int count )
|
|||
|
||||
}
|
||||
|
||||
static void kbic_log_adapter( PIA *pi, char * scratch,
|
||||
int verbose, char * chip )
|
||||
static void kbic_log_adapter(struct pi_adapter *pi, char *chip)
|
||||
|
||||
{ char *mode_string[6] = {"4-bit","5/3","8-bit",
|
||||
"EPP-8","EPP_16","EPP-32"};
|
||||
|
||||
printk("%s: kbic %s, KingByte %s at 0x%x, ",
|
||||
pi->device,KBIC_VERSION,chip,pi->port);
|
||||
printk("mode %d (%s), delay %d\n",pi->mode,
|
||||
mode_string[pi->mode],pi->delay);
|
||||
|
||||
dev_info(&pi->dev, "KingByte %s at 0x%x, mode %d (%s), delay %d\n",
|
||||
chip, pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static void k951_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
|
||||
{ kbic_log_adapter(pi,scratch,verbose,"KBIC-951A");
|
||||
static void k951_log_adapter(struct pi_adapter *pi)
|
||||
{
|
||||
kbic_log_adapter(pi, "KBIC-951A");
|
||||
}
|
||||
|
||||
static void k971_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
|
||||
{ kbic_log_adapter(pi,scratch,verbose,"KBIC-971A");
|
||||
static void k971_log_adapter(struct pi_adapter *pi)
|
||||
{
|
||||
kbic_log_adapter(pi, "KBIC-971A");
|
||||
}
|
||||
|
||||
static struct pi_protocol k951 = {
|
||||
|
@ -285,19 +275,19 @@ static int __init kbic_init(void)
|
|||
{
|
||||
int rv;
|
||||
|
||||
rv = paride_register(&k951);
|
||||
rv = pata_parport_register_driver(&k951);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
rv = paride_register(&k971);
|
||||
rv = pata_parport_register_driver(&k971);
|
||||
if (rv < 0)
|
||||
paride_unregister(&k951);
|
||||
pata_parport_unregister_driver(&k951);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static void __exit kbic_exit(void)
|
||||
{
|
||||
paride_unregister(&k951);
|
||||
paride_unregister(&k971);
|
||||
pata_parport_unregister_driver(&k951);
|
||||
pata_parport_unregister_driver(&k971);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
*/
|
||||
|
||||
#define KTTI_VERSION "1.0"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -18,8 +16,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#define j44(a,b) (((a>>4)&0x0f)|(b&0xf0))
|
||||
|
||||
|
@ -29,7 +26,7 @@
|
|||
|
||||
static int cont_map[2] = { 0x10, 0x08 };
|
||||
|
||||
static void ktti_write_regr( PIA *pi, int cont, int regr, int val)
|
||||
static void ktti_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -39,7 +36,7 @@ static void ktti_write_regr( PIA *pi, int cont, int regr, int val)
|
|||
w0(val); w2(3); w0(0); w2(6); w2(0xb);
|
||||
}
|
||||
|
||||
static int ktti_read_regr( PIA *pi, int cont, int regr )
|
||||
static int ktti_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int a, b, r;
|
||||
|
||||
|
@ -51,7 +48,7 @@ static int ktti_read_regr( PIA *pi, int cont, int regr )
|
|||
|
||||
}
|
||||
|
||||
static void ktti_read_block( PIA *pi, char * buf, int count )
|
||||
static void ktti_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k, a, b;
|
||||
|
||||
|
@ -64,7 +61,7 @@ static void ktti_read_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void ktti_write_block( PIA *pi, char * buf, int count )
|
||||
static void ktti_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -76,25 +73,25 @@ static void ktti_write_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void ktti_connect ( PIA *pi )
|
||||
static void ktti_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
w2(0xb); w2(0xa); w0(0); w2(3); w2(6);
|
||||
}
|
||||
|
||||
static void ktti_disconnect ( PIA *pi )
|
||||
static void ktti_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ w2(0xb); w2(0xa); w0(0xa0); w2(3); w2(4);
|
||||
w0(pi->saved_r0);
|
||||
w2(pi->saved_r2);
|
||||
}
|
||||
|
||||
static void ktti_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
|
||||
{ printk("%s: ktti %s, KT adapter at 0x%x, delay %d\n",
|
||||
pi->device,KTTI_VERSION,pi->port,pi->delay);
|
||||
static void ktti_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{
|
||||
dev_info(&pi->dev, "KT adapter at 0x%x, delay %d\n",
|
||||
pi->port, pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol ktti = {
|
||||
|
@ -113,16 +110,5 @@ static struct pi_protocol ktti = {
|
|||
.log_adapter = ktti_log_adapter,
|
||||
};
|
||||
|
||||
static int __init ktti_init(void)
|
||||
{
|
||||
return paride_register(&ktti);
|
||||
}
|
||||
|
||||
static void __exit ktti_exit(void)
|
||||
{
|
||||
paride_unregister(&ktti);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(ktti_init)
|
||||
module_exit(ktti_exit)
|
||||
module_pata_parport_driver(ktti);
|
||||
|
|
|
@ -6,14 +6,6 @@
|
|||
Onspec 90c20 parallel to IDE adapter.
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.05.06 init_proto, release_proto
|
||||
|
||||
*/
|
||||
|
||||
#define ON20_VERSION "1.01"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -21,8 +13,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#define op(f) w2(4);w0(f);w2(5);w2(0xd);w2(5);w2(0xd);w2(5);w2(4);
|
||||
#define vl(v) w2(4);w0(v);w2(5);w2(7);w2(5);w2(4);
|
||||
|
@ -33,7 +24,7 @@
|
|||
cont = 1 - access the IDE command set
|
||||
*/
|
||||
|
||||
static int on20_read_regr( PIA *pi, int cont, int regr )
|
||||
static int on20_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int h,l, r ;
|
||||
|
||||
|
@ -56,7 +47,7 @@ static int on20_read_regr( PIA *pi, int cont, int regr )
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void on20_write_regr( PIA *pi, int cont, int regr, int val )
|
||||
static void on20_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -67,7 +58,7 @@ static void on20_write_regr( PIA *pi, int cont, int regr, int val )
|
|||
op(0); vl(val);
|
||||
}
|
||||
|
||||
static void on20_connect ( PIA *pi)
|
||||
static void on20_connect(struct pi_adapter *pi)
|
||||
|
||||
{ pi->saved_r0 = r0();
|
||||
pi->saved_r2 = r2();
|
||||
|
@ -77,14 +68,14 @@ static void on20_connect ( PIA *pi)
|
|||
else { op(2); vl(0); op(2); vl(8); }
|
||||
}
|
||||
|
||||
static void on20_disconnect ( PIA *pi )
|
||||
static void on20_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ w2(4);w0(7);w2(4);w2(0xc);w2(4);
|
||||
w0(pi->saved_r0);
|
||||
w2(pi->saved_r2);
|
||||
}
|
||||
|
||||
static void on20_read_block( PIA *pi, char * buf, int count )
|
||||
static void on20_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k, l, h;
|
||||
|
||||
|
@ -101,7 +92,7 @@ static void on20_read_block( PIA *pi, char * buf, int count )
|
|||
w2(4);
|
||||
}
|
||||
|
||||
static void on20_write_block( PIA *pi, char * buf, int count )
|
||||
static void on20_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -111,15 +102,12 @@ static void on20_write_block( PIA *pi, char * buf, int count )
|
|||
w2(4);
|
||||
}
|
||||
|
||||
static void on20_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void on20_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ char *mode_string[2] = {"4-bit","8-bit"};
|
||||
|
||||
printk("%s: on20 %s, OnSpec 90c20 at 0x%x, ",
|
||||
pi->device,ON20_VERSION,pi->port);
|
||||
printk("mode %d (%s), delay %d\n",pi->mode,
|
||||
mode_string[pi->mode],pi->delay);
|
||||
|
||||
dev_info(&pi->dev, "OnSpec 90c20 at 0x%x, mode %d (%s), delay %d\n",
|
||||
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol on20 = {
|
||||
|
@ -138,16 +126,5 @@ static struct pi_protocol on20 = {
|
|||
.log_adapter = on20_log_adapter,
|
||||
};
|
||||
|
||||
static int __init on20_init(void)
|
||||
{
|
||||
return paride_register(&on20);
|
||||
}
|
||||
|
||||
static void __exit on20_exit(void)
|
||||
{
|
||||
paride_unregister(&on20);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(on20_init)
|
||||
module_exit(on20_exit)
|
||||
module_pata_parport_driver(on20);
|
||||
|
|
|
@ -7,17 +7,6 @@
|
|||
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.01 GRG 1998.05.06 init_proto, release_proto
|
||||
1.02 GRG 1998.09.23 updates for the -E rev chip
|
||||
1.03 GRG 1998.12.14 fix for slave drives
|
||||
1.04 GRG 1998.12.20 yet another bug fix
|
||||
|
||||
*/
|
||||
|
||||
#define ON26_VERSION "1.04"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -25,8 +14,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
/* mode codes: 0 nybble reads, 8-bit writes
|
||||
1 8-bit reads and writes
|
||||
|
@ -44,7 +32,7 @@
|
|||
cont = 1 - access the IDE command set
|
||||
*/
|
||||
|
||||
static int on26_read_regr( PIA *pi, int cont, int regr )
|
||||
static int on26_read_regr(struct pi_adapter *pi, int cont, int regr)
|
||||
|
||||
{ int a, b, r;
|
||||
|
||||
|
@ -73,7 +61,7 @@ static int on26_read_regr( PIA *pi, int cont, int regr )
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void on26_write_regr( PIA *pi, int cont, int regr, int val )
|
||||
static void on26_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
|
||||
|
||||
{ int r;
|
||||
|
||||
|
@ -99,7 +87,7 @@ static void on26_write_regr( PIA *pi, int cont, int regr, int val )
|
|||
#define CCP(x) w0(0xfe);w0(0xaa);w0(0x55);w0(0);w0(0xff);\
|
||||
w0(0x87);w0(0x78);w0(x);w2(4);w2(5);w2(4);w0(0xff);
|
||||
|
||||
static void on26_connect ( PIA *pi )
|
||||
static void on26_connect(struct pi_adapter *pi)
|
||||
|
||||
{ int x;
|
||||
|
||||
|
@ -113,7 +101,7 @@ static void on26_connect ( PIA *pi )
|
|||
w0(2); P1; w0(x); P2;
|
||||
}
|
||||
|
||||
static void on26_disconnect ( PIA *pi )
|
||||
static void on26_disconnect(struct pi_adapter *pi)
|
||||
|
||||
{ if (pi->mode >= 2) { w3(4); w3(4); w3(4); w3(4); }
|
||||
else { w0(4); P1; w0(4); P1; }
|
||||
|
@ -124,7 +112,7 @@ static void on26_disconnect ( PIA *pi )
|
|||
|
||||
#define RESET_WAIT 200
|
||||
|
||||
static int on26_test_port( PIA *pi) /* hard reset */
|
||||
static int on26_test_port(struct pi_adapter *pi) /* hard reset */
|
||||
|
||||
{ int i, m, d, x=0, y=0;
|
||||
|
||||
|
@ -167,7 +155,7 @@ static int on26_test_port( PIA *pi) /* hard reset */
|
|||
}
|
||||
|
||||
if (i == RESET_WAIT)
|
||||
printk("on26: Device reset failed (%x,%x)\n",x,y);
|
||||
dev_err(&pi->dev, "on26: Device reset failed (%x,%x)\n", x, y);
|
||||
|
||||
w0(4); P1; w0(4); P1;
|
||||
}
|
||||
|
@ -183,7 +171,7 @@ static int on26_test_port( PIA *pi) /* hard reset */
|
|||
}
|
||||
|
||||
|
||||
static void on26_read_block( PIA *pi, char * buf, int count )
|
||||
static void on26_read_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k, a, b;
|
||||
|
||||
|
@ -232,7 +220,7 @@ static void on26_read_block( PIA *pi, char * buf, int count )
|
|||
}
|
||||
}
|
||||
|
||||
static void on26_write_block( PIA *pi, char * buf, int count )
|
||||
static void on26_write_block(struct pi_adapter *pi, char *buf, int count)
|
||||
|
||||
{ int k;
|
||||
|
||||
|
@ -275,16 +263,13 @@ static void on26_write_block( PIA *pi, char * buf, int count )
|
|||
|
||||
}
|
||||
|
||||
static void on26_log_adapter( PIA *pi, char * scratch, int verbose )
|
||||
static void on26_log_adapter(struct pi_adapter *pi)
|
||||
|
||||
{ char *mode_string[5] = {"4-bit","8-bit","EPP-8",
|
||||
"EPP-16","EPP-32"};
|
||||
|
||||
printk("%s: on26 %s, OnSpec 90c26 at 0x%x, ",
|
||||
pi->device,ON26_VERSION,pi->port);
|
||||
printk("mode %d (%s), delay %d\n",pi->mode,
|
||||
mode_string[pi->mode],pi->delay);
|
||||
|
||||
dev_info(&pi->dev, "OnSpec 90c26 at 0x%x, mode %d (%s), delay %d\n",
|
||||
pi->port, pi->mode, mode_string[pi->mode], pi->delay);
|
||||
}
|
||||
|
||||
static struct pi_protocol on26 = {
|
||||
|
@ -304,16 +289,5 @@ static struct pi_protocol on26 = {
|
|||
.log_adapter = on26_log_adapter,
|
||||
};
|
||||
|
||||
static int __init on26_init(void)
|
||||
{
|
||||
return paride_register(&on26);
|
||||
}
|
||||
|
||||
static void __exit on26_exit(void)
|
||||
{
|
||||
paride_unregister(&on26);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
module_init(on26_init)
|
||||
module_exit(on26_exit)
|
||||
module_pata_parport_driver(on26);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/parport.h>
|
||||
#include <linux/pata_parport.h>
|
||||
#include "pata_parport.h"
|
||||
|
||||
#define DRV_NAME "pata_parport"
|
||||
|
||||
|
@ -276,7 +276,7 @@ static void pi_release(struct pi_adapter *pi)
|
|||
module_put(pi->proto->owner);
|
||||
}
|
||||
|
||||
static int default_test_proto(struct pi_adapter *pi, char *scratch)
|
||||
static int default_test_proto(struct pi_adapter *pi)
|
||||
{
|
||||
int j, k;
|
||||
int e[2] = { 0, 0 };
|
||||
|
@ -300,21 +300,21 @@ static int default_test_proto(struct pi_adapter *pi, char *scratch)
|
|||
return e[0] && e[1]; /* not here if both > 0 */
|
||||
}
|
||||
|
||||
static int pi_test_proto(struct pi_adapter *pi, char *scratch)
|
||||
static int pi_test_proto(struct pi_adapter *pi)
|
||||
{
|
||||
int res;
|
||||
|
||||
parport_claim_or_block(pi->pardev);
|
||||
if (pi->proto->test_proto)
|
||||
res = pi->proto->test_proto(pi, scratch, 1);
|
||||
res = pi->proto->test_proto(pi);
|
||||
else
|
||||
res = default_test_proto(pi, scratch);
|
||||
res = default_test_proto(pi);
|
||||
parport_release(pi->pardev);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool pi_probe_mode(struct pi_adapter *pi, int max, char *scratch)
|
||||
static bool pi_probe_mode(struct pi_adapter *pi, int max)
|
||||
{
|
||||
int best, range;
|
||||
|
||||
|
@ -326,7 +326,7 @@ static bool pi_probe_mode(struct pi_adapter *pi, int max, char *scratch)
|
|||
range = 8;
|
||||
if (range == 8 && pi->port % 8)
|
||||
return false;
|
||||
return !pi_test_proto(pi, scratch);
|
||||
return !pi_test_proto(pi);
|
||||
}
|
||||
best = -1;
|
||||
for (pi->mode = 0; pi->mode < max; pi->mode++) {
|
||||
|
@ -335,14 +335,14 @@ static bool pi_probe_mode(struct pi_adapter *pi, int max, char *scratch)
|
|||
range = 8;
|
||||
if (range == 8 && pi->port % 8)
|
||||
break;
|
||||
if (!pi_test_proto(pi, scratch))
|
||||
if (!pi_test_proto(pi))
|
||||
best = pi->mode;
|
||||
}
|
||||
pi->mode = best;
|
||||
return best > -1;
|
||||
}
|
||||
|
||||
static bool pi_probe_unit(struct pi_adapter *pi, int unit, char *scratch)
|
||||
static bool pi_probe_unit(struct pi_adapter *pi, int unit)
|
||||
{
|
||||
int max, s, e;
|
||||
|
||||
|
@ -367,14 +367,14 @@ static bool pi_probe_unit(struct pi_adapter *pi, int unit, char *scratch)
|
|||
for (pi->unit = s; pi->unit < e; pi->unit++) {
|
||||
if (pi->proto->probe_unit(pi)) {
|
||||
parport_release(pi->pardev);
|
||||
return pi_probe_mode(pi, max, scratch);
|
||||
return pi_probe_mode(pi, max);
|
||||
}
|
||||
}
|
||||
parport_release(pi->pardev);
|
||||
return false;
|
||||
}
|
||||
|
||||
return pi_probe_mode(pi, max, scratch);
|
||||
return pi_probe_mode(pi, max);
|
||||
}
|
||||
|
||||
static void pata_parport_dev_release(struct device *dev)
|
||||
|
@ -420,7 +420,6 @@ static struct pi_adapter *pi_init_one(struct parport *parport,
|
|||
struct pi_protocol *pr, int mode, int unit, int delay)
|
||||
{
|
||||
struct pardev_cb par_cb = { };
|
||||
char scratch[512];
|
||||
const struct ata_port_info *ppi[] = { &pata_parport_port_info };
|
||||
struct ata_host *host;
|
||||
struct pi_adapter *pi;
|
||||
|
@ -473,12 +472,12 @@ static struct pi_adapter *pi_init_one(struct parport *parport,
|
|||
if (!pi->pardev)
|
||||
goto out_module_put;
|
||||
|
||||
if (!pi_probe_unit(pi, unit, scratch)) {
|
||||
if (!pi_probe_unit(pi, unit)) {
|
||||
dev_info(&pi->dev, "Adapter not found\n");
|
||||
goto out_unreg_parport;
|
||||
}
|
||||
|
||||
pi->proto->log_adapter(pi, scratch, 1);
|
||||
pi->proto->log_adapter(pi);
|
||||
|
||||
host = ata_host_alloc_pinfo(&pi->pardev->dev, ppi, 1);
|
||||
if (!host)
|
||||
|
@ -534,7 +533,7 @@ int pata_parport_register_driver(struct pi_protocol *pr)
|
|||
if (probe) {
|
||||
/* probe all parports using this protocol */
|
||||
idr_for_each_entry(&parport_list, parport, port_num)
|
||||
pi_init_one(parport, pr, -1, 0, -1);
|
||||
pi_init_one(parport, pr, -1, -1, -1);
|
||||
}
|
||||
mutex_unlock(&pi_mutex);
|
||||
|
||||
|
@ -669,7 +668,7 @@ static void pata_parport_attach(struct parport *port)
|
|||
if (probe) {
|
||||
/* probe this port using all protocols */
|
||||
idr_for_each_entry(&protocols, pr, pr_num)
|
||||
pi_init_one(port, pr, -1, 0, -1);
|
||||
pi_init_one(port, pr, -1, -1, -1);
|
||||
}
|
||||
mutex_unlock(&pi_mutex);
|
||||
}
|
||||
|
|
|
@ -11,16 +11,12 @@
|
|||
|
||||
#include <linux/libata.h>
|
||||
|
||||
#define PI_PCD 1 /* dummy for paride protocol modules */
|
||||
|
||||
struct pi_adapter {
|
||||
struct device dev;
|
||||
struct pi_protocol *proto; /* adapter protocol */
|
||||
int port; /* base address of parallel port */
|
||||
int mode; /* transfer mode in use */
|
||||
int delay; /* adapter delay setting */
|
||||
int devtype; /* dummy for paride protocol modules */
|
||||
char *device; /* dummy for paride protocol modules */
|
||||
int unit; /* unit number for chained adapters */
|
||||
int saved_r0; /* saved port state */
|
||||
int saved_r2; /* saved port state */
|
||||
|
@ -28,8 +24,6 @@ struct pi_adapter {
|
|||
struct pardevice *pardev; /* pointer to pardevice */
|
||||
};
|
||||
|
||||
typedef struct pi_adapter PIA; /* for paride protocol modules */
|
||||
|
||||
/* registers are addressed as (cont,regr)
|
||||
* cont: 0 for command register file, 1 for control register(s)
|
||||
* regr: 0-7 for register number.
|
||||
|
@ -54,23 +48,6 @@ typedef struct pi_adapter PIA; /* for paride protocol modules */
|
|||
#define r4w() (delay_p, inw(pi->port + 4))
|
||||
#define r4l() (delay_p, inl(pi->port + 4))
|
||||
|
||||
static inline u16 pi_swab16(char *b, int k)
|
||||
{
|
||||
union { u16 u; char t[2]; } r;
|
||||
|
||||
r.t[0] = b[2 * k + 1]; r.t[1] = b[2 * k];
|
||||
return r.u;
|
||||
}
|
||||
|
||||
static inline u32 pi_swab32(char *b, int k)
|
||||
{
|
||||
union { u32 u; char f[4]; } r;
|
||||
|
||||
r.f[0] = b[4 * k + 1]; r.f[1] = b[4 * k];
|
||||
r.f[2] = b[4 * k + 3]; r.f[3] = b[4 * k + 2];
|
||||
return r.u;
|
||||
}
|
||||
|
||||
struct pi_protocol {
|
||||
char name[8];
|
||||
|
||||
|
@ -90,8 +67,8 @@ struct pi_protocol {
|
|||
|
||||
int (*test_port)(struct pi_adapter *pi);
|
||||
int (*probe_unit)(struct pi_adapter *pi);
|
||||
int (*test_proto)(struct pi_adapter *pi, char *scratch, int verbose);
|
||||
void (*log_adapter)(struct pi_adapter *pi, char *scratch, int verbose);
|
||||
int (*test_proto)(struct pi_adapter *pi);
|
||||
void (*log_adapter)(struct pi_adapter *pi);
|
||||
|
||||
int (*init_proto)(struct pi_adapter *pi);
|
||||
void (*release_proto)(struct pi_adapter *pi);
|
||||
|
@ -104,8 +81,16 @@ struct pi_protocol {
|
|||
|
||||
int pata_parport_register_driver(struct pi_protocol *pr);
|
||||
void pata_parport_unregister_driver(struct pi_protocol *pr);
|
||||
/* defines for old paride protocol modules */
|
||||
#define paride_register pata_parport_register_driver
|
||||
#define paride_unregister pata_parport_unregister_driver
|
||||
|
||||
/**
|
||||
* module_pata_parport_driver() - Helper macro for registering a pata_parport driver
|
||||
* @__pi_protocol: pi_protocol struct
|
||||
*
|
||||
* Helper macro for pata_parport drivers which do not do anything special in module
|
||||
* init/exit. This eliminates a lot of boilerplate. Each module may only
|
||||
* use this macro once, and calling it replaces module_init() and module_exit()
|
||||
*/
|
||||
#define module_pata_parport_driver(__pi_protocol) \
|
||||
module_driver(__pi_protocol, pata_parport_register_driver, pata_parport_unregister_driver)
|
||||
|
||||
#endif /* LINUX_PATA_PARPORT_H */
|
|
@ -1,726 +0,0 @@
|
|||
/*
|
||||
ppc6lnx.c (c) 2001 Micro Solutions Inc.
|
||||
Released under the terms of the GNU General Public license
|
||||
|
||||
ppc6lnx.c is a par of the protocol driver for the Micro Solutions
|
||||
"BACKPACK" parallel port IDE adapter
|
||||
(Works on Series 6 drives)
|
||||
|
||||
*/
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
// PPC 6 Code in C sanitized for LINUX
|
||||
// Original x86 ASM by Ron, Converted to C by Clive
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
|
||||
#define port_stb 1
|
||||
#define port_afd 2
|
||||
#define cmd_stb port_afd
|
||||
#define port_init 4
|
||||
#define data_stb port_init
|
||||
#define port_sel 8
|
||||
#define port_int 16
|
||||
#define port_dir 0x20
|
||||
|
||||
#define ECR_EPP 0x80
|
||||
#define ECR_BI 0x20
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
// 60772 Commands
|
||||
|
||||
#define ACCESS_REG 0x00
|
||||
#define ACCESS_PORT 0x40
|
||||
|
||||
#define ACCESS_READ 0x00
|
||||
#define ACCESS_WRITE 0x20
|
||||
|
||||
// 60772 Command Prefix
|
||||
|
||||
#define CMD_PREFIX_SET 0xe0 // Special command that modifies the next command's operation
|
||||
#define CMD_PREFIX_RESET 0xc0 // Resets current cmd modifier reg bits
|
||||
#define PREFIX_IO16 0x01 // perform 16-bit wide I/O
|
||||
#define PREFIX_FASTWR 0x04 // enable PPC mode fast-write
|
||||
#define PREFIX_BLK 0x08 // enable block transfer mode
|
||||
|
||||
// 60772 Registers
|
||||
|
||||
#define REG_STATUS 0x00 // status register
|
||||
#define STATUS_IRQA 0x01 // Peripheral IRQA line
|
||||
#define STATUS_EEPROM_DO 0x40 // Serial EEPROM data bit
|
||||
#define REG_VERSION 0x01 // PPC version register (read)
|
||||
#define REG_HWCFG 0x02 // Hardware Config register
|
||||
#define REG_RAMSIZE 0x03 // Size of RAM Buffer
|
||||
#define RAMSIZE_128K 0x02
|
||||
#define REG_EEPROM 0x06 // EEPROM control register
|
||||
#define EEPROM_SK 0x01 // eeprom SK bit
|
||||
#define EEPROM_DI 0x02 // eeprom DI bit
|
||||
#define EEPROM_CS 0x04 // eeprom CS bit
|
||||
#define EEPROM_EN 0x08 // eeprom output enable
|
||||
#define REG_BLKSIZE 0x08 // Block transfer len (24 bit)
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
typedef struct ppc_storage {
|
||||
u16 lpt_addr; // LPT base address
|
||||
u8 ppc_id;
|
||||
u8 mode; // operating mode
|
||||
// 0 = PPC Uni SW
|
||||
// 1 = PPC Uni FW
|
||||
// 2 = PPC Bi SW
|
||||
// 3 = PPC Bi FW
|
||||
// 4 = EPP Byte
|
||||
// 5 = EPP Word
|
||||
// 6 = EPP Dword
|
||||
u8 ppc_flags;
|
||||
u8 org_data; // original LPT data port contents
|
||||
u8 org_ctrl; // original LPT control port contents
|
||||
u8 cur_ctrl; // current control port contents
|
||||
} Interface;
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
// ppc_flags
|
||||
|
||||
#define fifo_wait 0x10
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
// DONT CHANGE THESE LEST YOU BREAK EVERYTHING - BIT FIELD DEPENDENCIES
|
||||
|
||||
#define PPCMODE_UNI_SW 0
|
||||
#define PPCMODE_UNI_FW 1
|
||||
#define PPCMODE_BI_SW 2
|
||||
#define PPCMODE_BI_FW 3
|
||||
#define PPCMODE_EPP_BYTE 4
|
||||
#define PPCMODE_EPP_WORD 5
|
||||
#define PPCMODE_EPP_DWORD 6
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static int ppc6_select(Interface *ppc);
|
||||
static void ppc6_deselect(Interface *ppc);
|
||||
static void ppc6_send_cmd(Interface *ppc, u8 cmd);
|
||||
static void ppc6_wr_data_byte(Interface *ppc, u8 data);
|
||||
static u8 ppc6_rd_data_byte(Interface *ppc);
|
||||
static u8 ppc6_rd_port(Interface *ppc, u8 port);
|
||||
static void ppc6_wr_port(Interface *ppc, u8 port, u8 data);
|
||||
static void ppc6_rd_data_blk(Interface *ppc, u8 *data, long count);
|
||||
static void ppc6_wait_for_fifo(Interface *ppc);
|
||||
static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count);
|
||||
static void ppc6_rd_port16_blk(Interface *ppc, u8 port, u8 *data, long length);
|
||||
static void ppc6_wr_port16_blk(Interface *ppc, u8 port, u8 *data, long length);
|
||||
static void ppc6_wr_extout(Interface *ppc, u8 regdata);
|
||||
static int ppc6_open(Interface *ppc);
|
||||
static void ppc6_close(Interface *ppc);
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static int ppc6_select(Interface *ppc)
|
||||
{
|
||||
u8 i, j, k;
|
||||
|
||||
i = inb(ppc->lpt_addr + 1);
|
||||
|
||||
if (i & 1)
|
||||
outb(i, ppc->lpt_addr + 1);
|
||||
|
||||
ppc->org_data = inb(ppc->lpt_addr);
|
||||
|
||||
ppc->org_ctrl = inb(ppc->lpt_addr + 2) & 0x5F; // readback ctrl
|
||||
|
||||
ppc->cur_ctrl = ppc->org_ctrl;
|
||||
|
||||
ppc->cur_ctrl |= port_sel;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
if (ppc->org_data == 'b')
|
||||
outb('x', ppc->lpt_addr);
|
||||
|
||||
outb('b', ppc->lpt_addr);
|
||||
outb('p', ppc->lpt_addr);
|
||||
outb(ppc->ppc_id, ppc->lpt_addr);
|
||||
outb(~ppc->ppc_id,ppc->lpt_addr);
|
||||
|
||||
ppc->cur_ctrl &= ~port_sel;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
ppc->cur_ctrl = (ppc->cur_ctrl & port_int) | port_init;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
i = ppc->mode & 0x0C;
|
||||
|
||||
if (i == 0)
|
||||
i = (ppc->mode & 2) | 1;
|
||||
|
||||
outb(i, ppc->lpt_addr);
|
||||
|
||||
ppc->cur_ctrl |= port_sel;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
// DELAY
|
||||
|
||||
ppc->cur_ctrl |= port_afd;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
j = ((i & 0x08) << 4) | ((i & 0x07) << 3);
|
||||
|
||||
k = inb(ppc->lpt_addr + 1) & 0xB8;
|
||||
|
||||
if (j == k)
|
||||
{
|
||||
ppc->cur_ctrl &= ~port_afd;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
k = (inb(ppc->lpt_addr + 1) & 0xB8) ^ 0xB8;
|
||||
|
||||
if (j == k)
|
||||
{
|
||||
if (i & 4) // EPP
|
||||
ppc->cur_ctrl &= ~(port_sel | port_init);
|
||||
else // PPC/ECP
|
||||
ppc->cur_ctrl &= ~port_sel;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
outb(ppc->org_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
outb(ppc->org_data, ppc->lpt_addr);
|
||||
|
||||
return(0); // FAIL
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_deselect(Interface *ppc)
|
||||
{
|
||||
if (ppc->mode & 4) // EPP
|
||||
ppc->cur_ctrl |= port_init;
|
||||
else // PPC/ECP
|
||||
ppc->cur_ctrl |= port_sel;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
outb(ppc->org_data, ppc->lpt_addr);
|
||||
|
||||
outb((ppc->org_ctrl | port_sel), ppc->lpt_addr + 2);
|
||||
|
||||
outb(ppc->org_ctrl, ppc->lpt_addr + 2);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_send_cmd(Interface *ppc, u8 cmd)
|
||||
{
|
||||
switch(ppc->mode)
|
||||
{
|
||||
case PPCMODE_UNI_SW :
|
||||
case PPCMODE_UNI_FW :
|
||||
case PPCMODE_BI_SW :
|
||||
case PPCMODE_BI_FW :
|
||||
{
|
||||
outb(cmd, ppc->lpt_addr);
|
||||
|
||||
ppc->cur_ctrl ^= cmd_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_EPP_BYTE :
|
||||
case PPCMODE_EPP_WORD :
|
||||
case PPCMODE_EPP_DWORD :
|
||||
{
|
||||
outb(cmd, ppc->lpt_addr + 3);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_wr_data_byte(Interface *ppc, u8 data)
|
||||
{
|
||||
switch(ppc->mode)
|
||||
{
|
||||
case PPCMODE_UNI_SW :
|
||||
case PPCMODE_UNI_FW :
|
||||
case PPCMODE_BI_SW :
|
||||
case PPCMODE_BI_FW :
|
||||
{
|
||||
outb(data, ppc->lpt_addr);
|
||||
|
||||
ppc->cur_ctrl ^= data_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_EPP_BYTE :
|
||||
case PPCMODE_EPP_WORD :
|
||||
case PPCMODE_EPP_DWORD :
|
||||
{
|
||||
outb(data, ppc->lpt_addr + 4);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static u8 ppc6_rd_data_byte(Interface *ppc)
|
||||
{
|
||||
u8 data = 0;
|
||||
|
||||
switch(ppc->mode)
|
||||
{
|
||||
case PPCMODE_UNI_SW :
|
||||
case PPCMODE_UNI_FW :
|
||||
{
|
||||
ppc->cur_ctrl = (ppc->cur_ctrl & ~port_stb) ^ data_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
// DELAY
|
||||
|
||||
data = inb(ppc->lpt_addr + 1);
|
||||
|
||||
data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3);
|
||||
|
||||
ppc->cur_ctrl |= port_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
// DELAY
|
||||
|
||||
data |= inb(ppc->lpt_addr + 1) & 0xB8;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_BI_SW :
|
||||
case PPCMODE_BI_FW :
|
||||
{
|
||||
ppc->cur_ctrl |= port_dir;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
ppc->cur_ctrl = (ppc->cur_ctrl | port_stb) ^ data_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
data = inb(ppc->lpt_addr);
|
||||
|
||||
ppc->cur_ctrl &= ~port_stb;
|
||||
|
||||
outb(ppc->cur_ctrl,ppc->lpt_addr + 2);
|
||||
|
||||
ppc->cur_ctrl &= ~port_dir;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_EPP_BYTE :
|
||||
case PPCMODE_EPP_WORD :
|
||||
case PPCMODE_EPP_DWORD :
|
||||
{
|
||||
outb((ppc->cur_ctrl | port_dir),ppc->lpt_addr + 2);
|
||||
|
||||
data = inb(ppc->lpt_addr + 4);
|
||||
|
||||
outb(ppc->cur_ctrl,ppc->lpt_addr + 2);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return(data);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static u8 ppc6_rd_port(Interface *ppc, u8 port)
|
||||
{
|
||||
ppc6_send_cmd(ppc,(u8)(port | ACCESS_PORT | ACCESS_READ));
|
||||
|
||||
return(ppc6_rd_data_byte(ppc));
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_wr_port(Interface *ppc, u8 port, u8 data)
|
||||
{
|
||||
ppc6_send_cmd(ppc,(u8)(port | ACCESS_PORT | ACCESS_WRITE));
|
||||
|
||||
ppc6_wr_data_byte(ppc, data);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_rd_data_blk(Interface *ppc, u8 *data, long count)
|
||||
{
|
||||
switch(ppc->mode)
|
||||
{
|
||||
case PPCMODE_UNI_SW :
|
||||
case PPCMODE_UNI_FW :
|
||||
{
|
||||
while(count)
|
||||
{
|
||||
u8 d;
|
||||
|
||||
ppc->cur_ctrl = (ppc->cur_ctrl & ~port_stb) ^ data_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
// DELAY
|
||||
|
||||
d = inb(ppc->lpt_addr + 1);
|
||||
|
||||
d = ((d & 0x80) >> 1) | ((d & 0x38) >> 3);
|
||||
|
||||
ppc->cur_ctrl |= port_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
// DELAY
|
||||
|
||||
d |= inb(ppc->lpt_addr + 1) & 0xB8;
|
||||
|
||||
*data++ = d;
|
||||
count--;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_BI_SW :
|
||||
case PPCMODE_BI_FW :
|
||||
{
|
||||
ppc->cur_ctrl |= port_dir;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
ppc->cur_ctrl |= port_stb;
|
||||
|
||||
while(count)
|
||||
{
|
||||
ppc->cur_ctrl ^= data_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
*data++ = inb(ppc->lpt_addr);
|
||||
count--;
|
||||
}
|
||||
|
||||
ppc->cur_ctrl &= ~port_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
ppc->cur_ctrl &= ~port_dir;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_EPP_BYTE :
|
||||
{
|
||||
outb((ppc->cur_ctrl | port_dir), ppc->lpt_addr + 2);
|
||||
|
||||
// DELAY
|
||||
|
||||
while(count)
|
||||
{
|
||||
*data++ = inb(ppc->lpt_addr + 4);
|
||||
count--;
|
||||
}
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_EPP_WORD :
|
||||
{
|
||||
outb((ppc->cur_ctrl | port_dir), ppc->lpt_addr + 2);
|
||||
|
||||
// DELAY
|
||||
|
||||
while(count > 1)
|
||||
{
|
||||
*((u16 *)data) = inw(ppc->lpt_addr + 4);
|
||||
data += 2;
|
||||
count -= 2;
|
||||
}
|
||||
|
||||
while(count)
|
||||
{
|
||||
*data++ = inb(ppc->lpt_addr + 4);
|
||||
count--;
|
||||
}
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_EPP_DWORD :
|
||||
{
|
||||
outb((ppc->cur_ctrl | port_dir),ppc->lpt_addr + 2);
|
||||
|
||||
// DELAY
|
||||
|
||||
while(count > 3)
|
||||
{
|
||||
*((u32 *)data) = inl(ppc->lpt_addr + 4);
|
||||
data += 4;
|
||||
count -= 4;
|
||||
}
|
||||
|
||||
while(count)
|
||||
{
|
||||
*data++ = inb(ppc->lpt_addr + 4);
|
||||
count--;
|
||||
}
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_wait_for_fifo(Interface *ppc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (ppc->ppc_flags & fifo_wait)
|
||||
{
|
||||
for(i=0; i<20; i++)
|
||||
inb(ppc->lpt_addr + 1);
|
||||
}
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count)
|
||||
{
|
||||
switch(ppc->mode)
|
||||
{
|
||||
case PPCMODE_UNI_SW :
|
||||
case PPCMODE_BI_SW :
|
||||
{
|
||||
while(count--)
|
||||
{
|
||||
outb(*data++, ppc->lpt_addr);
|
||||
|
||||
ppc->cur_ctrl ^= data_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_UNI_FW :
|
||||
case PPCMODE_BI_FW :
|
||||
{
|
||||
u8 this, last;
|
||||
|
||||
ppc6_send_cmd(ppc,(CMD_PREFIX_SET | PREFIX_FASTWR));
|
||||
|
||||
ppc->cur_ctrl |= port_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
last = *data;
|
||||
|
||||
outb(last, ppc->lpt_addr);
|
||||
|
||||
while(count)
|
||||
{
|
||||
this = *data++;
|
||||
count--;
|
||||
|
||||
if (this == last)
|
||||
{
|
||||
ppc->cur_ctrl ^= data_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
outb(this, ppc->lpt_addr);
|
||||
|
||||
last = this;
|
||||
}
|
||||
}
|
||||
|
||||
ppc->cur_ctrl &= ~port_stb;
|
||||
|
||||
outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
|
||||
|
||||
ppc6_send_cmd(ppc,(CMD_PREFIX_RESET | PREFIX_FASTWR));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_EPP_BYTE :
|
||||
{
|
||||
while(count)
|
||||
{
|
||||
outb(*data++,ppc->lpt_addr + 4);
|
||||
count--;
|
||||
}
|
||||
|
||||
ppc6_wait_for_fifo(ppc);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_EPP_WORD :
|
||||
{
|
||||
while(count > 1)
|
||||
{
|
||||
outw(*((u16 *)data),ppc->lpt_addr + 4);
|
||||
data += 2;
|
||||
count -= 2;
|
||||
}
|
||||
|
||||
while(count)
|
||||
{
|
||||
outb(*data++,ppc->lpt_addr + 4);
|
||||
count--;
|
||||
}
|
||||
|
||||
ppc6_wait_for_fifo(ppc);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PPCMODE_EPP_DWORD :
|
||||
{
|
||||
while(count > 3)
|
||||
{
|
||||
outl(*((u32 *)data),ppc->lpt_addr + 4);
|
||||
data += 4;
|
||||
count -= 4;
|
||||
}
|
||||
|
||||
while(count)
|
||||
{
|
||||
outb(*data++,ppc->lpt_addr + 4);
|
||||
count--;
|
||||
}
|
||||
|
||||
ppc6_wait_for_fifo(ppc);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_rd_port16_blk(Interface *ppc, u8 port, u8 *data, long length)
|
||||
{
|
||||
length = length << 1;
|
||||
|
||||
ppc6_send_cmd(ppc, (REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE));
|
||||
ppc6_wr_data_byte(ppc,(u8)length);
|
||||
ppc6_wr_data_byte(ppc,(u8)(length >> 8));
|
||||
ppc6_wr_data_byte(ppc,0);
|
||||
|
||||
ppc6_send_cmd(ppc, (CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK));
|
||||
|
||||
ppc6_send_cmd(ppc, (u8)(port | ACCESS_PORT | ACCESS_READ));
|
||||
|
||||
ppc6_rd_data_blk(ppc, data, length);
|
||||
|
||||
ppc6_send_cmd(ppc, (CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK));
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_wr_port16_blk(Interface *ppc, u8 port, u8 *data, long length)
|
||||
{
|
||||
length = length << 1;
|
||||
|
||||
ppc6_send_cmd(ppc, (REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE));
|
||||
ppc6_wr_data_byte(ppc,(u8)length);
|
||||
ppc6_wr_data_byte(ppc,(u8)(length >> 8));
|
||||
ppc6_wr_data_byte(ppc,0);
|
||||
|
||||
ppc6_send_cmd(ppc, (CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK));
|
||||
|
||||
ppc6_send_cmd(ppc, (u8)(port | ACCESS_PORT | ACCESS_WRITE));
|
||||
|
||||
ppc6_wr_data_blk(ppc, data, length);
|
||||
|
||||
ppc6_send_cmd(ppc, (CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK));
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_wr_extout(Interface *ppc, u8 regdata)
|
||||
{
|
||||
ppc6_send_cmd(ppc,(REG_VERSION | ACCESS_REG | ACCESS_WRITE));
|
||||
|
||||
ppc6_wr_data_byte(ppc, (u8)((regdata & 0x03) << 6));
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static int ppc6_open(Interface *ppc)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ppc6_select(ppc);
|
||||
|
||||
if (ret == 0)
|
||||
return(ret);
|
||||
|
||||
ppc->ppc_flags &= ~fifo_wait;
|
||||
|
||||
ppc6_send_cmd(ppc, (ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE));
|
||||
ppc6_wr_data_byte(ppc, RAMSIZE_128K);
|
||||
|
||||
ppc6_send_cmd(ppc, (ACCESS_REG | ACCESS_READ | REG_VERSION));
|
||||
|
||||
if ((ppc6_rd_data_byte(ppc) & 0x3F) == 0x0C)
|
||||
ppc->ppc_flags |= fifo_wait;
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
static void ppc6_close(Interface *ppc)
|
||||
{
|
||||
ppc6_deselect(ppc);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
|
@ -810,7 +810,7 @@ static int sata_dwc_dma_get_channel(struct sata_dwc_device_port *hsdevp)
|
|||
struct device *dev = hsdev->dev;
|
||||
|
||||
#ifdef CONFIG_SATA_DWC_OLD_DMA
|
||||
if (!of_find_property(dev->of_node, "dmas", NULL))
|
||||
if (!of_property_present(dev->of_node, "dmas"))
|
||||
return sata_dwc_dma_get_channel_old(hsdevp);
|
||||
#endif
|
||||
|
||||
|
@ -1180,7 +1180,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_SATA_DWC_OLD_DMA
|
||||
if (!of_find_property(np, "dmas", NULL)) {
|
||||
if (!of_property_present(np, "dmas")) {
|
||||
err = sata_dwc_dma_init_old(ofdev, hsdev);
|
||||
if (err)
|
||||
return err;
|
||||
|
|
|
@ -305,9 +305,15 @@ static size_t parport_pc_epp_read_data(struct parport *port, void *buf,
|
|||
}
|
||||
return got;
|
||||
}
|
||||
if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
|
||||
if (!(((long)buf | length) & 0x03))
|
||||
if ((length > 1) && ((flags & PARPORT_EPP_FAST_32)
|
||||
|| flags & PARPORT_EPP_FAST_16
|
||||
|| flags & PARPORT_EPP_FAST_8)) {
|
||||
if ((flags & PARPORT_EPP_FAST_32)
|
||||
&& !(((long)buf | length) & 0x03))
|
||||
insl(EPPDATA(port), buf, (length >> 2));
|
||||
else if ((flags & PARPORT_EPP_FAST_16)
|
||||
&& !(((long)buf | length) & 0x01))
|
||||
insw(EPPDATA(port), buf, length >> 1);
|
||||
else
|
||||
insb(EPPDATA(port), buf, length);
|
||||
if (inb(STATUS(port)) & 0x01) {
|
||||
|
@ -334,9 +340,15 @@ static size_t parport_pc_epp_write_data(struct parport *port, const void *buf,
|
|||
{
|
||||
size_t written = 0;
|
||||
|
||||
if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
|
||||
if (!(((long)buf | length) & 0x03))
|
||||
if ((length > 1) && ((flags & PARPORT_EPP_FAST_32)
|
||||
|| flags & PARPORT_EPP_FAST_16
|
||||
|| flags & PARPORT_EPP_FAST_8)) {
|
||||
if ((flags & PARPORT_EPP_FAST_32)
|
||||
&& !(((long)buf | length) & 0x03))
|
||||
outsl(EPPDATA(port), buf, (length >> 2));
|
||||
else if ((flags & PARPORT_EPP_FAST_16)
|
||||
&& !(((long)buf | length) & 0x01))
|
||||
outsw(EPPDATA(port), buf, length >> 1);
|
||||
else
|
||||
outsb(EPPDATA(port), buf, length);
|
||||
if (inb(STATUS(port)) & 0x01) {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <linux/bits.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
/* defines only for the constants which don't work well as enums */
|
||||
#define ATA_DMA_BOUNDARY 0xffffUL
|
||||
|
@ -1017,76 +1016,6 @@ static inline bool atapi_id_dmadir(const u16 *dev_id)
|
|||
return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000);
|
||||
}
|
||||
|
||||
/*
|
||||
* ata_id_is_lba_capacity_ok() performs a sanity check on
|
||||
* the claimed LBA capacity value for the device.
|
||||
*
|
||||
* Returns 1 if LBA capacity looks sensible, 0 otherwise.
|
||||
*
|
||||
* It is called only once for each device.
|
||||
*/
|
||||
static inline bool ata_id_is_lba_capacity_ok(u16 *id)
|
||||
{
|
||||
unsigned long lba_sects, chs_sects, head, tail;
|
||||
|
||||
/* No non-LBA info .. so valid! */
|
||||
if (id[ATA_ID_CYLS] == 0)
|
||||
return true;
|
||||
|
||||
lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY);
|
||||
|
||||
/*
|
||||
* The ATA spec tells large drives to return
|
||||
* C/H/S = 16383/16/63 independent of their size.
|
||||
* Some drives can be jumpered to use 15 heads instead of 16.
|
||||
* Some drives can be jumpered to use 4092 cyls instead of 16383.
|
||||
*/
|
||||
if ((id[ATA_ID_CYLS] == 16383 ||
|
||||
(id[ATA_ID_CYLS] == 4092 && id[ATA_ID_CUR_CYLS] == 16383)) &&
|
||||
id[ATA_ID_SECTORS] == 63 &&
|
||||
(id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) &&
|
||||
(lba_sects >= 16383 * 63 * id[ATA_ID_HEADS]))
|
||||
return true;
|
||||
|
||||
chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS];
|
||||
|
||||
/* perform a rough sanity check on lba_sects: within 10% is OK */
|
||||
if (lba_sects - chs_sects < chs_sects/10)
|
||||
return true;
|
||||
|
||||
/* some drives have the word order reversed */
|
||||
head = (lba_sects >> 16) & 0xffff;
|
||||
tail = lba_sects & 0xffff;
|
||||
lba_sects = head | (tail << 16);
|
||||
|
||||
if (lba_sects - chs_sects < chs_sects/10) {
|
||||
*(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects);
|
||||
return true; /* LBA capacity is (now) good */
|
||||
}
|
||||
|
||||
return false; /* LBA capacity value may be bad */
|
||||
}
|
||||
|
||||
static inline void ata_id_to_hd_driveid(u16 *id)
|
||||
{
|
||||
#ifdef __BIG_ENDIAN
|
||||
/* accessed in struct hd_driveid as 8-bit values */
|
||||
id[ATA_ID_MAX_MULTSECT] = __cpu_to_le16(id[ATA_ID_MAX_MULTSECT]);
|
||||
id[ATA_ID_CAPABILITY] = __cpu_to_le16(id[ATA_ID_CAPABILITY]);
|
||||
id[ATA_ID_OLD_PIO_MODES] = __cpu_to_le16(id[ATA_ID_OLD_PIO_MODES]);
|
||||
id[ATA_ID_OLD_DMA_MODES] = __cpu_to_le16(id[ATA_ID_OLD_DMA_MODES]);
|
||||
id[ATA_ID_MULTSECT] = __cpu_to_le16(id[ATA_ID_MULTSECT]);
|
||||
|
||||
/* as 32-bit values */
|
||||
*(u32 *)&id[ATA_ID_LBA_CAPACITY] = ata_id_u32(id, ATA_ID_LBA_CAPACITY);
|
||||
*(u32 *)&id[ATA_ID_SPG] = ata_id_u32(id, ATA_ID_SPG);
|
||||
|
||||
/* as 64-bit value */
|
||||
*(u64 *)&id[ATA_ID_LBA_CAPACITY_2] =
|
||||
ata_id_u64(id, ATA_ID_LBA_CAPACITY_2);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool ata_ok(u8 status)
|
||||
{
|
||||
return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
|
||||
|
|
|
@ -90,6 +90,9 @@ typedef enum {
|
|||
/* Flags for block transfer operations. */
|
||||
#define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */
|
||||
#define PARPORT_W91284PIC (1<<1) /* have a Warp9 w91284pic in the device */
|
||||
#define PARPORT_EPP_FAST_32 PARPORT_EPP_FAST /* 32-bit EPP transfers */
|
||||
#define PARPORT_EPP_FAST_16 (1<<2) /* 16-bit EPP transfers */
|
||||
#define PARPORT_EPP_FAST_8 (1<<3) /* 8-bit EPP transfers */
|
||||
|
||||
/* The rest is for the kernel only */
|
||||
#endif /* _UAPI_PARPORT_H_ */
|
||||
|
|
Loading…
Reference in New Issue