Commit c11e5992 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] dtc iomem annotations and isa_-ectomy

switched to ioremap() + normal iomem operations
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent efd436f8
...@@ -219,52 +219,58 @@ static int __init dtc_detect(Scsi_Host_Template * tpnt) ...@@ -219,52 +219,58 @@ static int __init dtc_detect(Scsi_Host_Template * tpnt)
{ {
static int current_override = 0, current_base = 0; static int current_override = 0, current_base = 0;
struct Scsi_Host *instance; struct Scsi_Host *instance;
unsigned int base; unsigned int addr;
void __iomem *base;
int sig, count; int sig, count;
tpnt->proc_name = "dtc3x80"; tpnt->proc_name = "dtc3x80";
tpnt->proc_info = &dtc_proc_info; tpnt->proc_info = &dtc_proc_info;
for (count = 0; current_override < NO_OVERRIDES; ++current_override) { for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
base = 0; addr = 0;
base = NULL;
if (overrides[current_override].address) if (overrides[current_override].address) {
base = overrides[current_override].address; addr = overrides[current_override].address;
else base = ioremap(addr, 0x2000);
for (; !base && (current_base < NO_BASES); ++current_base) { if (!base)
void __iomem *p; addr = 0;
} else
for (; !addr && (current_base < NO_BASES); ++current_base) {
#if (DTCDEBUG & DTCDEBUG_INIT) #if (DTCDEBUG & DTCDEBUG_INIT)
printk("scsi-dtc : probing address %08x\n", bases[current_base].address); printk("scsi-dtc : probing address %08x\n", bases[current_base].address);
#endif #endif
if (bases[current_base].noauto) if (bases[current_base].noauto)
continue; continue;
p = ioremap(bases[current_base].address, 0x2000); base = ioremap(bases[current_base].address, 0x2000);
if (!p) if (!base)
continue; continue;
for (sig = 0; sig < NO_SIGNATURES; ++sig) { for (sig = 0; sig < NO_SIGNATURES; ++sig) {
if (check_signature(p + signatures[sig].offset, signatures[sig].string, strlen(signatures[sig].string))) { if (check_signature(base + signatures[sig].offset, signatures[sig].string, strlen(signatures[sig].string))) {
base = bases[current_base].address; addr = bases[current_base].address;
#if (DTCDEBUG & DTCDEBUG_INIT) #if (DTCDEBUG & DTCDEBUG_INIT)
printk("scsi-dtc : detected board.\n"); printk("scsi-dtc : detected board.\n");
#endif #endif
break; goto found;
} }
} }
iounmap(p); iounmap(base);
} }
#if defined(DTCDEBUG) && (DTCDEBUG & DTCDEBUG_INIT) #if defined(DTCDEBUG) && (DTCDEBUG & DTCDEBUG_INIT)
printk("scsi-dtc : base = %08x\n", base); printk("scsi-dtc : base = %08x\n", addr);
#endif #endif
if (!base) if (!addr)
break; break;
found:
instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata)); instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
if (instance == NULL) if (instance == NULL)
break; break;
instance->base = base; instance->base = addr;
((struct NCR5380_hostdata *)(instance)->hostdata)->base = base;
NCR5380_init(instance, 0); NCR5380_init(instance, 0);
...@@ -380,7 +386,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, ...@@ -380,7 +386,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY) while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY)
++i; ++i;
rtrc(3); rtrc(3);
isa_memcpy_fromio(d, base + DTC_DATA_BUF, 128); memcpy_fromio(d, base + DTC_DATA_BUF, 128);
d += 128; d += 128;
len -= 128; len -= 128;
rtrc(7); rtrc(7);
...@@ -431,7 +437,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, ...@@ -431,7 +437,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY) while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY)
++i; ++i;
rtrc(3); rtrc(3);
isa_memcpy_toio(base + DTC_DATA_BUF, src, 128); memcpy_toio(base + DTC_DATA_BUF, src, 128);
src += 128; src += 128;
len -= 128; len -= 128;
} }
...@@ -457,12 +463,15 @@ MODULE_LICENSE("GPL"); ...@@ -457,12 +463,15 @@ MODULE_LICENSE("GPL");
static int dtc_release(struct Scsi_Host *shost) static int dtc_release(struct Scsi_Host *shost)
{ {
NCR5380_local_declare();
NCR5380_setup(shost);
if (shost->irq) if (shost->irq)
free_irq(shost->irq, NULL); free_irq(shost->irq, NULL);
NCR5380_exit(shost); NCR5380_exit(shost);
if (shost->io_port && shost->n_io_port) if (shost->io_port && shost->n_io_port)
release_region(shost->io_port, shost->n_io_port); release_region(shost->io_port, shost->n_io_port);
scsi_unregister(shost); scsi_unregister(shost);
iounmap(base);
return 0; return 0;
} }
......
...@@ -46,40 +46,40 @@ static int dtc_host_reset(Scsi_Cmnd *); ...@@ -46,40 +46,40 @@ static int dtc_host_reset(Scsi_Cmnd *);
#endif #endif
#define NCR5380_implementation_fields \ #define NCR5380_implementation_fields \
unsigned int base void __iomem *base
#define NCR5380_local_declare() \ #define NCR5380_local_declare() \
unsigned int base void __iomem *base
#define NCR5380_setup(instance) \ #define NCR5380_setup(instance) \
base = (unsigned int)(instance)->base base = ((struct NCR5380_hostdata *)(instance)->hostdata)->base
#define DTC_address(reg) (base + DTC_5380_OFFSET + reg) #define DTC_address(reg) (base + DTC_5380_OFFSET + reg)
#define dbNCR5380_read(reg) \ #define dbNCR5380_read(reg) \
(rval=isa_readb(DTC_address(reg)), \ (rval=readb(DTC_address(reg)), \
(((unsigned char) printk("DTC : read register %d at addr %08x is: %02x\n"\ (((unsigned char) printk("DTC : read register %d at addr %p is: %02x\n"\
, (reg), (int)DTC_address(reg), rval)), rval ) ) , (reg), DTC_address(reg), rval)), rval ) )
#define dbNCR5380_write(reg, value) do { \ #define dbNCR5380_write(reg, value) do { \
printk("DTC : write %02x to register %d at address %08x\n", \ printk("DTC : write %02x to register %d at address %p\n", \
(value), (reg), (int)DTC_address(reg)); \ (value), (reg), DTC_address(reg)); \
isa_writeb(value, DTC_address(reg));} while(0) writeb(value, DTC_address(reg));} while(0)
#if !(DTCDEBUG & DTCDEBUG_TRANSFER) #if !(DTCDEBUG & DTCDEBUG_TRANSFER)
#define NCR5380_read(reg) (isa_readb(DTC_address(reg))) #define NCR5380_read(reg) (readb(DTC_address(reg)))
#define NCR5380_write(reg, value) (isa_writeb(value, DTC_address(reg))) #define NCR5380_write(reg, value) (writeb(value, DTC_address(reg)))
#else #else
#define NCR5380_read(reg) (isa_readb(DTC_address(reg))) #define NCR5380_read(reg) (readb(DTC_address(reg)))
#define xNCR5380_read(reg) \ #define xNCR5380_read(reg) \
(((unsigned char) printk("DTC : read register %d at address %08x\n"\ (((unsigned char) printk("DTC : read register %d at address %p\n"\
, (reg), DTC_address(reg))), isa_readb(DTC_address(reg))) , (reg), DTC_address(reg))), readb(DTC_address(reg)))
#define NCR5380_write(reg, value) do { \ #define NCR5380_write(reg, value) do { \
printk("DTC : write %02x to register %d at address %08x\n", \ printk("DTC : write %02x to register %d at address %p\n", \
(value), (reg), (int)DTC_address(reg)); \ (value), (reg), DTC_address(reg)); \
isa_writeb(value, DTC_address(reg));} while(0) writeb(value, DTC_address(reg));} while(0)
#endif #endif
#define NCR5380_intr dtc_intr #define NCR5380_intr dtc_intr
......
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