Commit b61bacbc authored by Ondrej Zary's avatar Ondrej Zary Committed by Martin K. Petersen

scsi: g_NCR5380: Merge g_NCR5380 and g_NCR5380_mmio drivers

Merge the port-mapped IO and memory-mapped IO support (with the help of
ioport_map) into the g_NCR5380 module and delete g_NCR5380_mmio.
Signed-off-by: default avatarOndrej Zary <linux@rainbow-software.org>
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Tested-by: default avatarOndrej Zary <linux@rainbow-software.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 1e879e8f
...@@ -8316,7 +8316,6 @@ F: drivers/scsi/arm/oak.c ...@@ -8316,7 +8316,6 @@ F: drivers/scsi/arm/oak.c
F: drivers/scsi/atari_scsi.* F: drivers/scsi/atari_scsi.*
F: drivers/scsi/dmx3191d.c F: drivers/scsi/dmx3191d.c
F: drivers/scsi/g_NCR5380.* F: drivers/scsi/g_NCR5380.*
F: drivers/scsi/g_NCR5380_mmio.c
F: drivers/scsi/mac_scsi.* F: drivers/scsi/mac_scsi.*
F: drivers/scsi/sun3_scsi.* F: drivers/scsi/sun3_scsi.*
F: drivers/scsi/sun3_scsi_vme.c F: drivers/scsi/sun3_scsi_vme.c
......
...@@ -743,40 +743,18 @@ config SCSI_ISCI ...@@ -743,40 +743,18 @@ config SCSI_ISCI
control unit found in the Intel(R) C600 series chipset. control unit found in the Intel(R) C600 series chipset.
config SCSI_GENERIC_NCR5380 config SCSI_GENERIC_NCR5380
tristate "Generic NCR5380/53c400 SCSI PIO support" tristate "Generic NCR5380/53c400 SCSI ISA card support"
depends on ISA && SCSI depends on ISA && SCSI
select SCSI_SPI_ATTRS select SCSI_SPI_ATTRS
---help--- ---help---
This is a driver for the old NCR 53c80 series of SCSI controllers This is a driver for old ISA card SCSI controllers based on a
on boards using PIO. Most boards such as the Trantor T130 fit this NCR 5380, 53C80, 53C400, 53C400A, or DTC 436 device.
category, along with a large number of ISA 8bit controllers shipped Most boards such as the Trantor T130 fit this category, as do
for free with SCSI scanners. If you have a PAS16, T128 or DMX3191 various 8-bit and 16-bit ISA cards bundled with SCSI scanners.
you should select the specific driver for that card rather than
generic 5380 support.
It is explained in section 3.8 of the SCSI-HOWTO, available from
<http://www.tldp.org/docs.html#howto>. If it doesn't work out
of the box, you may have to change some settings in
<file:drivers/scsi/g_NCR5380.h>.
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called g_NCR5380. module will be called g_NCR5380.
config SCSI_GENERIC_NCR5380_MMIO
tristate "Generic NCR5380/53c400 SCSI MMIO support"
depends on ISA && SCSI
select SCSI_SPI_ATTRS
---help---
This is a driver for the old NCR 53c80 series of SCSI controllers
on boards using memory mapped I/O.
It is explained in section 3.8 of the SCSI-HOWTO, available from
<http://www.tldp.org/docs.html#howto>. If it doesn't work out
of the box, you may have to change some settings in
<file:drivers/scsi/g_NCR5380.h>.
To compile this driver as a module, choose M here: the
module will be called g_NCR5380_mmio.
config SCSI_IPS config SCSI_IPS
tristate "IBM ServeRAID support" tristate "IBM ServeRAID support"
depends on PCI && SCSI depends on PCI && SCSI
......
...@@ -74,7 +74,6 @@ obj-$(CONFIG_SCSI_ISCI) += isci/ ...@@ -74,7 +74,6 @@ obj-$(CONFIG_SCSI_ISCI) += isci/
obj-$(CONFIG_SCSI_IPS) += ips.o obj-$(CONFIG_SCSI_IPS) += ips.o
obj-$(CONFIG_SCSI_FUTURE_DOMAIN)+= fdomain.o obj-$(CONFIG_SCSI_FUTURE_DOMAIN)+= fdomain.o
obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o
obj-$(CONFIG_SCSI_GENERIC_NCR5380_MMIO) += g_NCR5380_mmio.o
obj-$(CONFIG_SCSI_NCR53C406A) += NCR53c406a.o obj-$(CONFIG_SCSI_NCR53C406A) += NCR53c406a.o
obj-$(CONFIG_SCSI_NCR_D700) += 53c700.o NCR_D700.o obj-$(CONFIG_SCSI_NCR_D700) += 53c700.o NCR_D700.o
obj-$(CONFIG_SCSI_NCR_Q720) += NCR_Q720_mod.o obj-$(CONFIG_SCSI_NCR_Q720) += NCR_Q720_mod.o
......
...@@ -64,9 +64,9 @@ static int card[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; ...@@ -64,9 +64,9 @@ static int card[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
module_param_array(card, int, NULL, 0); module_param_array(card, int, NULL, 0);
MODULE_PARM_DESC(card, "card type (0=NCR5380, 1=NCR53C400, 2=NCR53C400A, 3=DTC3181E, 4=HP C2502)"); MODULE_PARM_DESC(card, "card type (0=NCR5380, 1=NCR53C400, 2=NCR53C400A, 3=DTC3181E, 4=HP C2502)");
MODULE_ALIAS("g_NCR5380_mmio");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#ifndef SCSI_G_NCR5380_MEM
/* /*
* Configure I/O address of 53C400A or DTC436 by writing magic numbers * Configure I/O address of 53C400A or DTC436 by writing magic numbers
* to ports 0x779 and 0x379. * to ports 0x779 and 0x379.
...@@ -88,40 +88,35 @@ static void magic_configure(int idx, u8 irq, u8 magic[]) ...@@ -88,40 +88,35 @@ static void magic_configure(int idx, u8 irq, u8 magic[])
cfg = 0x80 | idx | (irq << 4); cfg = 0x80 | idx | (irq << 4);
outb(cfg, 0x379); outb(cfg, 0x379);
} }
#endif
static unsigned int ncr_53c400a_ports[] = {
0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
};
static unsigned int dtc_3181e_ports[] = {
0x220, 0x240, 0x280, 0x2a0, 0x2c0, 0x300, 0x320, 0x340, 0
};
static u8 ncr_53c400a_magic[] = { /* 53C400A & DTC436 */
0x59, 0xb9, 0xc5, 0xae, 0xa6
};
static u8 hp_c2502_magic[] = { /* HP C2502 */
0x0f, 0x22, 0xf0, 0x20, 0x80
};
static int generic_NCR5380_init_one(struct scsi_host_template *tpnt, static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
struct device *pdev, int base, int irq, int board) struct device *pdev, int base, int irq, int board)
{ {
unsigned int *ports; bool is_pmio = base <= 0xffff;
int ret;
int flags = 0;
unsigned int *ports = NULL;
u8 *magic = NULL; u8 *magic = NULL;
#ifndef SCSI_G_NCR5380_MEM
int i; int i;
int port_idx = -1; int port_idx = -1;
unsigned long region_size; unsigned long region_size;
#endif
static unsigned int ncr_53c400a_ports[] = {
0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
};
static unsigned int dtc_3181e_ports[] = {
0x220, 0x240, 0x280, 0x2a0, 0x2c0, 0x300, 0x320, 0x340, 0
};
static u8 ncr_53c400a_magic[] = { /* 53C400A & DTC436 */
0x59, 0xb9, 0xc5, 0xae, 0xa6
};
static u8 hp_c2502_magic[] = { /* HP C2502 */
0x0f, 0x22, 0xf0, 0x20, 0x80
};
int flags, ret;
struct Scsi_Host *instance; struct Scsi_Host *instance;
struct NCR5380_hostdata *hostdata; struct NCR5380_hostdata *hostdata;
#ifdef SCSI_G_NCR5380_MEM
void __iomem *iomem; void __iomem *iomem;
resource_size_t iomem_size;
#endif
ports = NULL;
flags = 0;
switch (board) { switch (board) {
case BOARD_NCR5380: case BOARD_NCR5380:
flags = FLAG_NO_PSEUDO_DMA | FLAG_DMA_FIXUP; flags = FLAG_NO_PSEUDO_DMA | FLAG_DMA_FIXUP;
...@@ -140,8 +135,7 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt, ...@@ -140,8 +135,7 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
break; break;
} }
#ifndef SCSI_G_NCR5380_MEM if (is_pmio && ports && magic) {
if (ports && magic) {
/* wakeup sequence for the NCR53C400A and DTC3181E */ /* wakeup sequence for the NCR53C400A and DTC3181E */
/* Disable the adapter and look for a free io port */ /* Disable the adapter and look for a free io port */
...@@ -179,75 +173,81 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt, ...@@ -179,75 +173,81 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
port_idx = i; port_idx = i;
} else } else
return -EINVAL; return -EINVAL;
} } else if (is_pmio) {
else
{
/* NCR5380 - no configuration, just grab */ /* NCR5380 - no configuration, just grab */
region_size = 8; region_size = 8;
if (!base || !request_region(base, region_size, "ncr5380")) if (!base || !request_region(base, region_size, "ncr5380"))
return -EBUSY; return -EBUSY;
} else { /* MMIO */
region_size = NCR53C400_region_size;
if (!request_mem_region(base, region_size, "ncr5380"))
return -EBUSY;
} }
#else
iomem_size = NCR53C400_region_size; if (is_pmio)
if (!request_mem_region(base, iomem_size, "ncr5380")) iomem = ioport_map(base, region_size);
return -EBUSY; else
iomem = ioremap(base, iomem_size); iomem = ioremap(base, region_size);
if (!iomem) { if (!iomem) {
release_mem_region(base, iomem_size); ret = -ENOMEM;
return -ENOMEM; goto out_release;
} }
#endif
instance = scsi_host_alloc(tpnt, sizeof(struct NCR5380_hostdata)); instance = scsi_host_alloc(tpnt, sizeof(struct NCR5380_hostdata));
if (instance == NULL) { if (instance == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_release; goto out_unmap;
} }
hostdata = shost_priv(instance); hostdata = shost_priv(instance);
#ifndef SCSI_G_NCR5380_MEM
instance->io_port = base;
instance->n_io_port = region_size;
hostdata->io_width = 1; /* 8-bit PDMA by default */
/*
* On NCR53C400 boards, NCR5380 registers are mapped 8 past
* the base address.
*/
switch (board) {
case BOARD_NCR53C400:
instance->io_port += 8;
hostdata->c400_ctl_status = 0;
hostdata->c400_blk_cnt = 1;
hostdata->c400_host_buf = 4;
break;
case BOARD_DTC3181E:
hostdata->io_width = 2; /* 16-bit PDMA */
/* fall through */
case BOARD_NCR53C400A:
case BOARD_HP_C2502:
hostdata->c400_ctl_status = 9;
hostdata->c400_blk_cnt = 10;
hostdata->c400_host_buf = 8;
break;
}
#else
instance->base = base;
hostdata->iomem = iomem; hostdata->iomem = iomem;
hostdata->iomem_size = iomem_size;
switch (board) { if (is_pmio) {
case BOARD_NCR53C400: instance->io_port = base;
hostdata->c400_ctl_status = 0x100; instance->n_io_port = region_size;
hostdata->c400_blk_cnt = 0x101; hostdata->io_width = 1; /* 8-bit PDMA by default */
hostdata->c400_host_buf = 0x104; hostdata->offset = 0;
break;
case BOARD_DTC3181E: /*
case BOARD_NCR53C400A: * On NCR53C400 boards, NCR5380 registers are mapped 8 past
case BOARD_HP_C2502: * the base address.
pr_err(DRV_MODULE_NAME ": unknown register offsets\n"); */
ret = -EINVAL; switch (board) {
goto out_unregister; case BOARD_NCR53C400:
instance->io_port += 8;
hostdata->c400_ctl_status = 0;
hostdata->c400_blk_cnt = 1;
hostdata->c400_host_buf = 4;
break;
case BOARD_DTC3181E:
hostdata->io_width = 2; /* 16-bit PDMA */
/* fall through */
case BOARD_NCR53C400A:
case BOARD_HP_C2502:
hostdata->c400_ctl_status = 9;
hostdata->c400_blk_cnt = 10;
hostdata->c400_host_buf = 8;
break;
}
} else {
instance->base = base;
hostdata->iomem_size = region_size;
hostdata->offset = NCR53C400_mem_base;
switch (board) {
case BOARD_NCR53C400:
hostdata->c400_ctl_status = 0x100;
hostdata->c400_blk_cnt = 0x101;
hostdata->c400_host_buf = 0x104;
break;
case BOARD_DTC3181E:
case BOARD_NCR53C400A:
case BOARD_HP_C2502:
pr_err(DRV_MODULE_NAME ": unknown register offsets\n");
ret = -EINVAL;
goto out_unregister;
}
} }
#endif
ret = NCR5380_init(instance, flags | FLAG_LATE_DMA_SETUP); ret = NCR5380_init(instance, flags | FLAG_LATE_DMA_SETUP);
if (ret) if (ret)
...@@ -273,11 +273,9 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt, ...@@ -273,11 +273,9 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
instance->irq = NO_IRQ; instance->irq = NO_IRQ;
if (instance->irq != NO_IRQ) { if (instance->irq != NO_IRQ) {
#ifndef SCSI_G_NCR5380_MEM
/* set IRQ for HP C2502 */ /* set IRQ for HP C2502 */
if (board == BOARD_HP_C2502) if (board == BOARD_HP_C2502)
magic_configure(port_idx, instance->irq, magic); magic_configure(port_idx, instance->irq, magic);
#endif
if (request_irq(instance->irq, generic_NCR5380_intr, if (request_irq(instance->irq, generic_NCR5380_intr,
0, "NCR5380", instance)) { 0, "NCR5380", instance)) {
printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
...@@ -303,32 +301,29 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt, ...@@ -303,32 +301,29 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
NCR5380_exit(instance); NCR5380_exit(instance);
out_unregister: out_unregister:
scsi_host_put(instance); scsi_host_put(instance);
out_release: out_unmap:
#ifndef SCSI_G_NCR5380_MEM
release_region(base, region_size);
#else
iounmap(iomem); iounmap(iomem);
release_mem_region(base, iomem_size); out_release:
#endif if (is_pmio)
release_region(base, region_size);
else
release_mem_region(base, region_size);
return ret; return ret;
} }
static void generic_NCR5380_release_resources(struct Scsi_Host *instance) static void generic_NCR5380_release_resources(struct Scsi_Host *instance)
{ {
struct NCR5380_hostdata *hostdata = shost_priv(instance);
scsi_remove_host(instance); scsi_remove_host(instance);
if (instance->irq != NO_IRQ) if (instance->irq != NO_IRQ)
free_irq(instance->irq, instance); free_irq(instance->irq, instance);
NCR5380_exit(instance); NCR5380_exit(instance);
#ifndef SCSI_G_NCR5380_MEM iounmap(hostdata->iomem);
release_region(instance->io_port, instance->n_io_port); if (instance->io_port)
#else release_region(instance->io_port, instance->n_io_port);
{ else
struct NCR5380_hostdata *hostdata = shost_priv(instance);
iounmap(hostdata->iomem);
release_mem_region(instance->base, hostdata->iomem_size); release_mem_region(instance->base, hostdata->iomem_size);
}
#endif
scsi_host_put(instance); scsi_host_put(instance);
} }
...@@ -361,18 +356,16 @@ static inline int generic_NCR5380_pread(struct Scsi_Host *instance, ...@@ -361,18 +356,16 @@ static inline int generic_NCR5380_pread(struct Scsi_Host *instance,
while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY) while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
; /* FIXME - no timeout */ ; /* FIXME - no timeout */
#ifndef SCSI_G_NCR5380_MEM if (instance->io_port && hostdata->io_width == 2)
if (hostdata->io_width == 2)
insw(instance->io_port + hostdata->c400_host_buf, insw(instance->io_port + hostdata->c400_host_buf,
dst + start, 64); dst + start, 64);
else else if (instance->io_port)
insb(instance->io_port + hostdata->c400_host_buf, insb(instance->io_port + hostdata->c400_host_buf,
dst + start, 128); dst + start, 128);
#else else
/* implies SCSI_G_NCR5380_MEM */ memcpy_fromio(dst + start,
memcpy_fromio(dst + start, hostdata->iomem + NCR53C400_host_buffer, 128);
hostdata->iomem + NCR53C400_host_buffer, 128);
#endif
start += 128; start += 128;
blocks--; blocks--;
} }
...@@ -381,18 +374,16 @@ static inline int generic_NCR5380_pread(struct Scsi_Host *instance, ...@@ -381,18 +374,16 @@ static inline int generic_NCR5380_pread(struct Scsi_Host *instance,
while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY) while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
; /* FIXME - no timeout */ ; /* FIXME - no timeout */
#ifndef SCSI_G_NCR5380_MEM if (instance->io_port && hostdata->io_width == 2)
if (hostdata->io_width == 2)
insw(instance->io_port + hostdata->c400_host_buf, insw(instance->io_port + hostdata->c400_host_buf,
dst + start, 64); dst + start, 64);
else else if (instance->io_port)
insb(instance->io_port + hostdata->c400_host_buf, insb(instance->io_port + hostdata->c400_host_buf,
dst + start, 128); dst + start, 128);
#else else
/* implies SCSI_G_NCR5380_MEM */ memcpy_fromio(dst + start,
memcpy_fromio(dst + start, hostdata->iomem + NCR53C400_host_buffer, 128);
hostdata->iomem + NCR53C400_host_buffer, 128);
#endif
start += 128; start += 128;
blocks--; blocks--;
} }
...@@ -439,18 +430,17 @@ static inline int generic_NCR5380_pwrite(struct Scsi_Host *instance, ...@@ -439,18 +430,17 @@ static inline int generic_NCR5380_pwrite(struct Scsi_Host *instance,
break; break;
while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY) while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
; // FIXME - timeout ; // FIXME - timeout
#ifndef SCSI_G_NCR5380_MEM
if (hostdata->io_width == 2) if (instance->io_port && hostdata->io_width == 2)
outsw(instance->io_port + hostdata->c400_host_buf, outsw(instance->io_port + hostdata->c400_host_buf,
src + start, 64); src + start, 64);
else else if (instance->io_port)
outsb(instance->io_port + hostdata->c400_host_buf, outsb(instance->io_port + hostdata->c400_host_buf,
src + start, 128); src + start, 128);
#else else
/* implies SCSI_G_NCR5380_MEM */ memcpy_toio(hostdata->iomem + NCR53C400_host_buffer,
memcpy_toio(hostdata->iomem + NCR53C400_host_buffer, src + start, 128);
src + start, 128);
#endif
start += 128; start += 128;
blocks--; blocks--;
} }
...@@ -458,18 +448,16 @@ static inline int generic_NCR5380_pwrite(struct Scsi_Host *instance, ...@@ -458,18 +448,16 @@ static inline int generic_NCR5380_pwrite(struct Scsi_Host *instance,
while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY) while (NCR5380_read(hostdata->c400_ctl_status) & CSR_HOST_BUF_NOT_RDY)
; // FIXME - no timeout ; // FIXME - no timeout
#ifndef SCSI_G_NCR5380_MEM if (instance->io_port && hostdata->io_width == 2)
if (hostdata->io_width == 2)
outsw(instance->io_port + hostdata->c400_host_buf, outsw(instance->io_port + hostdata->c400_host_buf,
src + start, 64); src + start, 64);
else else if (instance->io_port)
outsb(instance->io_port + hostdata->c400_host_buf, outsb(instance->io_port + hostdata->c400_host_buf,
src + start, 128); src + start, 128);
#else else
/* implies SCSI_G_NCR5380_MEM */ memcpy_toio(hostdata->iomem + NCR53C400_host_buffer,
memcpy_toio(hostdata->iomem + NCR53C400_host_buffer, src + start, 128);
src + start, 128);
#endif
start += 128; start += 128;
blocks--; blocks--;
} }
...@@ -566,7 +554,7 @@ static struct isa_driver generic_NCR5380_isa_driver = { ...@@ -566,7 +554,7 @@ static struct isa_driver generic_NCR5380_isa_driver = {
}, },
}; };
#if !defined(SCSI_G_NCR5380_MEM) && defined(CONFIG_PNP) #ifdef CONFIG_PNP
static struct pnp_device_id generic_NCR5380_pnp_ids[] = { static struct pnp_device_id generic_NCR5380_pnp_ids[] = {
{ .id = "DTC436e", .driver_data = BOARD_DTC3181E }, { .id = "DTC436e", .driver_data = BOARD_DTC3181E },
{ .id = "" } { .id = "" }
...@@ -600,7 +588,7 @@ static struct pnp_driver generic_NCR5380_pnp_driver = { ...@@ -600,7 +588,7 @@ static struct pnp_driver generic_NCR5380_pnp_driver = {
.probe = generic_NCR5380_pnp_probe, .probe = generic_NCR5380_pnp_probe,
.remove = generic_NCR5380_pnp_remove, .remove = generic_NCR5380_pnp_remove,
}; };
#endif /* !defined(SCSI_G_NCR5380_MEM) && defined(CONFIG_PNP) */ #endif /* defined(CONFIG_PNP) */
static int pnp_registered, isa_registered; static int pnp_registered, isa_registered;
...@@ -624,7 +612,7 @@ static int __init generic_NCR5380_init(void) ...@@ -624,7 +612,7 @@ static int __init generic_NCR5380_init(void)
card[0] = BOARD_HP_C2502; card[0] = BOARD_HP_C2502;
} }
#if !defined(SCSI_G_NCR5380_MEM) && defined(CONFIG_PNP) #ifdef CONFIG_PNP
if (!pnp_register_driver(&generic_NCR5380_pnp_driver)) if (!pnp_register_driver(&generic_NCR5380_pnp_driver))
pnp_registered = 1; pnp_registered = 1;
#endif #endif
...@@ -637,7 +625,7 @@ static int __init generic_NCR5380_init(void) ...@@ -637,7 +625,7 @@ static int __init generic_NCR5380_init(void)
static void __exit generic_NCR5380_exit(void) static void __exit generic_NCR5380_exit(void)
{ {
#if !defined(SCSI_G_NCR5380_MEM) && defined(CONFIG_PNP) #ifdef CONFIG_PNP
if (pnp_registered) if (pnp_registered)
pnp_unregister_driver(&generic_NCR5380_pnp_driver); pnp_unregister_driver(&generic_NCR5380_pnp_driver);
#endif #endif
......
...@@ -14,44 +14,30 @@ ...@@ -14,44 +14,30 @@
#ifndef GENERIC_NCR5380_H #ifndef GENERIC_NCR5380_H
#define GENERIC_NCR5380_H #define GENERIC_NCR5380_H
#ifndef SCSI_G_NCR5380_MEM
#define DRV_MODULE_NAME "g_NCR5380" #define DRV_MODULE_NAME "g_NCR5380"
#define NCR5380_read(reg) \ #define NCR5380_read(reg) \
inb(instance->io_port + (reg)) ioread8(((struct NCR5380_hostdata *)shost_priv(instance))->iomem + \
((struct NCR5380_hostdata *)shost_priv(instance))->offset + \
(reg))
#define NCR5380_write(reg, value) \ #define NCR5380_write(reg, value) \
outb(value, instance->io_port + (reg)) iowrite8(value, ((struct NCR5380_hostdata *)shost_priv(instance))->iomem + \
((struct NCR5380_hostdata *)shost_priv(instance))->offset + \
(reg))
#define NCR5380_implementation_fields \ #define NCR5380_implementation_fields \
int offset; \
void __iomem *iomem; \
resource_size_t iomem_size; \
int c400_ctl_status; \ int c400_ctl_status; \
int c400_blk_cnt; \ int c400_blk_cnt; \
int c400_host_buf; \ int c400_host_buf; \
int io_width; int io_width;
#else
/* therefore SCSI_G_NCR5380_MEM */
#define DRV_MODULE_NAME "g_NCR5380_mmio"
#define NCR53C400_mem_base 0x3880 #define NCR53C400_mem_base 0x3880
#define NCR53C400_host_buffer 0x3900 #define NCR53C400_host_buffer 0x3900
#define NCR53C400_region_size 0x3a00 #define NCR53C400_region_size 0x3a00
#define NCR5380_read(reg) \
readb(((struct NCR5380_hostdata *)shost_priv(instance))->iomem + \
NCR53C400_mem_base + (reg))
#define NCR5380_write(reg, value) \
writeb(value, ((struct NCR5380_hostdata *)shost_priv(instance))->iomem + \
NCR53C400_mem_base + (reg))
#define NCR5380_implementation_fields \
void __iomem *iomem; \
resource_size_t iomem_size; \
int c400_ctl_status; \
int c400_blk_cnt; \
int c400_host_buf;
#endif
#define NCR5380_dma_xfer_len(instance, cmd, phase) \ #define NCR5380_dma_xfer_len(instance, cmd, phase) \
generic_NCR5380_dma_xfer_len(instance, cmd) generic_NCR5380_dma_xfer_len(instance, cmd)
#define NCR5380_dma_recv_setup generic_NCR5380_pread #define NCR5380_dma_recv_setup generic_NCR5380_pread
...@@ -73,4 +59,3 @@ ...@@ -73,4 +59,3 @@
#define BOARD_HP_C2502 4 #define BOARD_HP_C2502 4
#endif /* GENERIC_NCR5380_H */ #endif /* GENERIC_NCR5380_H */
/*
* There is probably a nicer way to do this but this one makes
* pretty obvious what is happening. We rebuild the same file with
* different options for mmio versus pio.
*/
#define SCSI_G_NCR5380_MEM
#include "g_NCR5380.c"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment