diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/g_NCR5380.c | 28 | ||||
-rw-r--r-- | drivers/scsi/g_NCR5380.h | 23 |
2 files changed, 38 insertions, 13 deletions
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 45756fa90777..e6bcfe949340 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c | |||
@@ -127,7 +127,7 @@ static int ncr_53c400a = NCR_NOT_SET; | |||
127 | static int dtc_3181e = NCR_NOT_SET; | 127 | static int dtc_3181e = NCR_NOT_SET; |
128 | 128 | ||
129 | static struct override { | 129 | static struct override { |
130 | NCR5380_implementation_fields; | 130 | NCR5380_map_type NCR5380_map_name; |
131 | int irq; | 131 | int irq; |
132 | int dma; | 132 | int dma; |
133 | int board; /* Use NCR53c400, Ricoh, etc. extensions ? */ | 133 | int board; /* Use NCR53c400, Ricoh, etc. extensions ? */ |
@@ -299,6 +299,10 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) | |||
299 | }; | 299 | }; |
300 | int flags = 0; | 300 | int flags = 0; |
301 | struct Scsi_Host *instance; | 301 | struct Scsi_Host *instance; |
302 | #ifdef CONFIG_SCSI_G_NCR5380_MEM | ||
303 | unsigned long base; | ||
304 | void __iomem *iomem; | ||
305 | #endif | ||
302 | 306 | ||
303 | if (ncr_irq != NCR_NOT_SET) | 307 | if (ncr_irq != NCR_NOT_SET) |
304 | overrides[0].irq = ncr_irq; | 308 | overrides[0].irq = ncr_irq; |
@@ -424,15 +428,22 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) | |||
424 | region_size = NCR5380_region_size; | 428 | region_size = NCR5380_region_size; |
425 | } | 429 | } |
426 | #else | 430 | #else |
427 | if(!request_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size, "ncr5380")) | 431 | base = overrides[current_override].NCR5380_map_name; |
432 | if (!request_mem_region(base, NCR5380_region_size, "ncr5380")) | ||
433 | continue; | ||
434 | iomem = ioremap(base, NCR5380_region_size); | ||
435 | if (!iomem) { | ||
436 | release_mem_region(base, NCR5380_region_size); | ||
428 | continue; | 437 | continue; |
438 | } | ||
429 | #endif | 439 | #endif |
430 | instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata)); | 440 | instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata)); |
431 | if (instance == NULL) { | 441 | if (instance == NULL) { |
432 | #ifndef CONFIG_SCSI_G_NCR5380_MEM | 442 | #ifndef CONFIG_SCSI_G_NCR5380_MEM |
433 | release_region(overrides[current_override].NCR5380_map_name, region_size); | 443 | release_region(overrides[current_override].NCR5380_map_name, region_size); |
434 | #else | 444 | #else |
435 | release_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size); | 445 | iounmap(iomem); |
446 | release_mem_region(base, NCR5380_region_size); | ||
436 | #endif | 447 | #endif |
437 | continue; | 448 | continue; |
438 | } | 449 | } |
@@ -440,6 +451,8 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) | |||
440 | instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name; | 451 | instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name; |
441 | #ifndef CONFIG_SCSI_G_NCR5380_MEM | 452 | #ifndef CONFIG_SCSI_G_NCR5380_MEM |
442 | instance->n_io_port = region_size; | 453 | instance->n_io_port = region_size; |
454 | #else | ||
455 | ((struct NCR5380_hostdata *)instance->hostdata).iomem = iomem; | ||
443 | #endif | 456 | #endif |
444 | 457 | ||
445 | NCR5380_init(instance, flags); | 458 | NCR5380_init(instance, flags); |
@@ -509,6 +522,7 @@ int generic_NCR5380_release_resources(struct Scsi_Host *instance) | |||
509 | #ifndef CONFIG_SCSI_G_NCR5380_MEM | 522 | #ifndef CONFIG_SCSI_G_NCR5380_MEM |
510 | release_region(instance->NCR5380_instance_name, instance->n_io_port); | 523 | release_region(instance->NCR5380_instance_name, instance->n_io_port); |
511 | #else | 524 | #else |
525 | iounmap(((struct NCR5380_hostdata *)instance->hostdata).iomem); | ||
512 | release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size); | 526 | release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size); |
513 | #endif | 527 | #endif |
514 | 528 | ||
@@ -586,7 +600,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, | |||
586 | } | 600 | } |
587 | #else | 601 | #else |
588 | /* implies CONFIG_SCSI_G_NCR5380_MEM */ | 602 | /* implies CONFIG_SCSI_G_NCR5380_MEM */ |
589 | isa_memcpy_fromio(dst + start, NCR53C400_host_buffer + NCR5380_map_name, 128); | 603 | memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128); |
590 | #endif | 604 | #endif |
591 | start += 128; | 605 | start += 128; |
592 | blocks--; | 606 | blocks--; |
@@ -606,7 +620,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, | |||
606 | } | 620 | } |
607 | #else | 621 | #else |
608 | /* implies CONFIG_SCSI_G_NCR5380_MEM */ | 622 | /* implies CONFIG_SCSI_G_NCR5380_MEM */ |
609 | isa_memcpy_fromio(dst + start, NCR53C400_host_buffer + NCR5380_map_name, 128); | 623 | memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128); |
610 | #endif | 624 | #endif |
611 | start += 128; | 625 | start += 128; |
612 | blocks--; | 626 | blocks--; |
@@ -671,7 +685,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
671 | } | 685 | } |
672 | #else | 686 | #else |
673 | /* implies CONFIG_SCSI_G_NCR5380_MEM */ | 687 | /* implies CONFIG_SCSI_G_NCR5380_MEM */ |
674 | isa_memcpy_toio(NCR53C400_host_buffer + NCR5380_map_name, src + start, 128); | 688 | memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128); |
675 | #endif | 689 | #endif |
676 | start += 128; | 690 | start += 128; |
677 | blocks--; | 691 | blocks--; |
@@ -687,7 +701,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
687 | } | 701 | } |
688 | #else | 702 | #else |
689 | /* implies CONFIG_SCSI_G_NCR5380_MEM */ | 703 | /* implies CONFIG_SCSI_G_NCR5380_MEM */ |
690 | isa_memcpy_toio(NCR53C400_host_buffer + NCR5380_map_name, src + start, 128); | 704 | memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128); |
691 | #endif | 705 | #endif |
692 | start += 128; | 706 | start += 128; |
693 | blocks--; | 707 | blocks--; |
diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h index 656fbe2f91f6..d60a89cb8052 100644 --- a/drivers/scsi/g_NCR5380.h +++ b/drivers/scsi/g_NCR5380.h | |||
@@ -82,6 +82,15 @@ static const char* generic_NCR5380_info(struct Scsi_Host *); | |||
82 | #define NCR5380_read(reg) (inb(NCR5380_map_name + (reg))) | 82 | #define NCR5380_read(reg) (inb(NCR5380_map_name + (reg))) |
83 | #define NCR5380_write(reg, value) (outb((value), (NCR5380_map_name + (reg)))) | 83 | #define NCR5380_write(reg, value) (outb((value), (NCR5380_map_name + (reg)))) |
84 | 84 | ||
85 | #define NCR5380_implementation_fields \ | ||
86 | NCR5380_map_type NCR5380_map_name | ||
87 | |||
88 | #define NCR5380_local_declare() \ | ||
89 | register NCR5380_implementation_fields | ||
90 | |||
91 | #define NCR5380_setup(instance) \ | ||
92 | NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name) | ||
93 | |||
85 | #else | 94 | #else |
86 | /* therefore CONFIG_SCSI_G_NCR5380_MEM */ | 95 | /* therefore CONFIG_SCSI_G_NCR5380_MEM */ |
87 | 96 | ||
@@ -95,18 +104,20 @@ static const char* generic_NCR5380_info(struct Scsi_Host *); | |||
95 | #define NCR53C400_host_buffer 0x3900 | 104 | #define NCR53C400_host_buffer 0x3900 |
96 | #define NCR5380_region_size 0x3a00 | 105 | #define NCR5380_region_size 0x3a00 |
97 | 106 | ||
98 | #define NCR5380_read(reg) isa_readb(NCR5380_map_name + NCR53C400_mem_base + (reg)) | 107 | #define NCR5380_read(reg) readb(iomem + NCR53C400_mem_base + (reg)) |
99 | #define NCR5380_write(reg, value) isa_writeb(value, NCR5380_map_name + NCR53C400_mem_base + (reg)) | 108 | #define NCR5380_write(reg, value) writeb(value, iomem + NCR53C400_mem_base + (reg)) |
100 | #endif | ||
101 | 109 | ||
102 | #define NCR5380_implementation_fields \ | 110 | #define NCR5380_implementation_fields \ |
103 | NCR5380_map_type NCR5380_map_name | 111 | NCR5380_map_type NCR5380_map_name; \ |
112 | void __iomem *iomem; | ||
104 | 113 | ||
105 | #define NCR5380_local_declare() \ | 114 | #define NCR5380_local_declare() \ |
106 | register NCR5380_implementation_fields | 115 | register void __iomem *iomem |
107 | 116 | ||
108 | #define NCR5380_setup(instance) \ | 117 | #define NCR5380_setup(instance) \ |
109 | NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name) | 118 | iomem = (((struct NCR5380_hostdata *)(instance)->hostdata).iomem) |
119 | |||
120 | #endif | ||
110 | 121 | ||
111 | #define NCR5380_intr generic_NCR5380_intr | 122 | #define NCR5380_intr generic_NCR5380_intr |
112 | #define NCR5380_queue_command generic_NCR5380_queue_command | 123 | #define NCR5380_queue_command generic_NCR5380_queue_command |