aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-14 19:06:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-14 19:06:58 -0400
commit85082fd7cbe3173198aac0eb5e85ab1edcc6352c (patch)
treeedbc09b7945994f78668d218fa02e991c3b3b365 /drivers/scsi
parent666484f0250db2e016948d63b3ef33e202e3b8d0 (diff)
parent53ffe3b440aa85af6fc4eda09b2d44bcdd312d4d (diff)
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (241 commits) [ARM] 5171/1: ep93xx: fix compilation of modules using clocks [ARM] 5133/2: at91sam9g20 defconfig file [ARM] 5130/4: Support for the at91sam9g20 [ARM] 5160/1: IOP3XX: gpio/gpiolib support [ARM] at91: Fix NAND FLASH timings for at91sam9x evaluation kits. [ARM] 5084/1: zylonite: Register AC97 device [ARM] 5085/2: PXA: Move AC97 over to the new central device declaration model [ARM] 5120/1: pxa: correct platform driver names for PXA25x and PXA27x UDC drivers [ARM] 5147/1: pxaficp_ir: drop pxa_gpio_mode calls, as pin setting [ARM] 5145/1: PXA2xx: provide api to control IrDA pins state [ARM] 5144/1: pxaficp_ir: cleanup includes [ARM] pxa: remove pxa_set_cken() [ARM] pxa: allow clk aliases [ARM] Feroceon: don't disable BPU on boot [ARM] Orion: LED support for HP mv2120 [ARM] Orion: add RD88F5181L-FXO support [ARM] Orion: add RD88F5181L-GE support [ARM] Orion: add Netgear WNR854T support [ARM] s3c2410_defconfig: update for current build [ARM] Acer n30: Minor style and indentation fixes. ...
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/arm/Kconfig2
-rw-r--r--drivers/scsi/arm/acornscsi-io.S15
-rw-r--r--drivers/scsi/arm/acornscsi.c426
-rw-r--r--drivers/scsi/arm/acornscsi.h9
4 files changed, 199 insertions, 253 deletions
diff --git a/drivers/scsi/arm/Kconfig b/drivers/scsi/arm/Kconfig
index 7236143941f3..a8587f1f5e7e 100644
--- a/drivers/scsi/arm/Kconfig
+++ b/drivers/scsi/arm/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4config SCSI_ACORNSCSI_3 4config SCSI_ACORNSCSI_3
5 tristate "Acorn SCSI card (aka30) support" 5 tristate "Acorn SCSI card (aka30) support"
6 depends on ARCH_ACORN && SCSI && BROKEN 6 depends on ARCH_ACORN && SCSI
7 select SCSI_SPI_ATTRS 7 select SCSI_SPI_ATTRS
8 help 8 help
9 This enables support for the Acorn SCSI card (aka30). If you have an 9 This enables support for the Acorn SCSI card (aka30). If you have an
diff --git a/drivers/scsi/arm/acornscsi-io.S b/drivers/scsi/arm/acornscsi-io.S
index 93467e6ac923..5cebe3105260 100644
--- a/drivers/scsi/arm/acornscsi-io.S
+++ b/drivers/scsi/arm/acornscsi-io.S
@@ -10,17 +10,10 @@
10#include <asm/assembler.h> 10#include <asm/assembler.h>
11#include <asm/hardware.h> 11#include <asm/hardware.h>
12 12
13#if (IO_BASE == (PCIO_BASE & 0xff000000)) 13#if defined(__APCS_32__)
14#define ADDR(off,reg) \ 14#define LOADREGS(t,r,l...) ldm##t r, l
15 tst off, $0x80000000 ;\ 15#elif defined(__APCS_26__)
16 mov reg, $IO_BASE ;\ 16#define LOADREGS(t,r,l...) ldm##t r, l##^
17 orreq reg, reg, $(PCIO_BASE & 0x00ff0000)
18#else
19#define ADDR(off,reg) \
20 tst off, $0x80000000 ;\
21 movne reg, $IO_BASE ;\
22 moveq reg, $(PCIO_BASE & 0xff000000) ;\
23 orreq reg, reg, $(PCIO_BASE & 0x00ff0000)
24#endif 17#endif
25 18
26@ Purpose: transfer a block of data from the acorn scsi card to memory 19@ Purpose: transfer a block of data from the acorn scsi card to memory
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index 8e53f02cc311..918ccf818757 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -123,12 +123,6 @@
123#define DBG(cmd,xxx...) xxx 123#define DBG(cmd,xxx...) xxx
124#endif 124#endif
125 125
126#ifndef STRINGIFY
127#define STRINGIFY(x) #x
128#endif
129#define STRx(x) STRINGIFY(x)
130#define NO_WRITE_STR STRx(NO_WRITE)
131
132#include <linux/module.h> 126#include <linux/module.h>
133#include <linux/kernel.h> 127#include <linux/kernel.h>
134#include <linux/string.h> 128#include <linux/string.h>
@@ -141,9 +135,10 @@
141#include <linux/interrupt.h> 135#include <linux/interrupt.h>
142#include <linux/init.h> 136#include <linux/init.h>
143#include <linux/bitops.h> 137#include <linux/bitops.h>
138#include <linux/stringify.h>
139#include <linux/io.h>
144 140
145#include <asm/system.h> 141#include <asm/system.h>
146#include <asm/io.h>
147#include <asm/ecard.h> 142#include <asm/ecard.h>
148 143
149#include "../scsi.h" 144#include "../scsi.h"
@@ -203,44 +198,46 @@ static void acornscsi_abortcmd(AS_Host *host, unsigned char tag);
203 * Miscellaneous 198 * Miscellaneous
204 */ 199 */
205 200
206static inline void 201/* Offsets from MEMC base */
207sbic_arm_write(unsigned int io_port, int reg, int value) 202#define SBIC_REGIDX 0x2000
203#define SBIC_REGVAL 0x2004
204#define DMAC_OFFSET 0x3000
205
206/* Offsets from FAST IOC base */
207#define INT_REG 0x2000
208#define PAGE_REG 0x3000
209
210static inline void sbic_arm_write(AS_Host *host, unsigned int reg, unsigned int value)
208{ 211{
209 __raw_writeb(reg, io_port); 212 writeb(reg, host->base + SBIC_REGIDX);
210 __raw_writeb(value, io_port + 4); 213 writeb(value, host->base + SBIC_REGVAL);
211} 214}
212 215
213#define sbic_arm_writenext(io,val) \ 216static inline int sbic_arm_read(AS_Host *host, unsigned int reg)
214 __raw_writeb((val), (io) + 4)
215
216static inline
217int sbic_arm_read(unsigned int io_port, int reg)
218{ 217{
219 if(reg == SBIC_ASR) 218 if(reg == SBIC_ASR)
220 return __raw_readl(io_port) & 255; 219 return readl(host->base + SBIC_REGIDX) & 255;
221 __raw_writeb(reg, io_port); 220 writeb(reg, host->base + SBIC_REGIDX);
222 return __raw_readl(io_port + 4) & 255; 221 return readl(host->base + SBIC_REGVAL) & 255;
223} 222}
224 223
225#define sbic_arm_readnext(io) \ 224#define sbic_arm_writenext(host, val) writeb((val), (host)->base + SBIC_REGVAL)
226 __raw_readb((io) + 4) 225#define sbic_arm_readnext(host) readb((host)->base + SBIC_REGVAL)
227 226
228#ifdef USE_DMAC 227#ifdef USE_DMAC
229#define dmac_read(io_port,reg) \ 228#define dmac_read(host,reg) \
230 inb((io_port) + (reg)) 229 readb((host)->base + DMAC_OFFSET + ((reg) << 2))
231 230
232#define dmac_write(io_port,reg,value) \ 231#define dmac_write(host,reg,value) \
233 ({ outb((value), (io_port) + (reg)); }) 232 ({ writeb((value), (host)->base + DMAC_OFFSET + ((reg) << 2)); })
234 233
235#define dmac_clearintr(io_port) \ 234#define dmac_clearintr(host) writeb(0, (host)->fast + INT_REG)
236 ({ outb(0, (io_port)); })
237 235
238static inline 236static inline unsigned int dmac_address(AS_Host *host)
239unsigned int dmac_address(unsigned int io_port)
240{ 237{
241 return dmac_read(io_port, DMAC_TXADRHI) << 16 | 238 return dmac_read(host, DMAC_TXADRHI) << 16 |
242 dmac_read(io_port, DMAC_TXADRMD) << 8 | 239 dmac_read(host, DMAC_TXADRMD) << 8 |
243 dmac_read(io_port, DMAC_TXADRLO); 240 dmac_read(host, DMAC_TXADRLO);
244} 241}
245 242
246static 243static
@@ -248,15 +245,15 @@ void acornscsi_dumpdma(AS_Host *host, char *where)
248{ 245{
249 unsigned int mode, addr, len; 246 unsigned int mode, addr, len;
250 247
251 mode = dmac_read(host->dma.io_port, DMAC_MODECON); 248 mode = dmac_read(host, DMAC_MODECON);
252 addr = dmac_address(host->dma.io_port); 249 addr = dmac_address(host);
253 len = dmac_read(host->dma.io_port, DMAC_TXCNTHI) << 8 | 250 len = dmac_read(host, DMAC_TXCNTHI) << 8 |
254 dmac_read(host->dma.io_port, DMAC_TXCNTLO); 251 dmac_read(host, DMAC_TXCNTLO);
255 252
256 printk("scsi%d: %s: DMAC %02x @%06x+%04x msk %02x, ", 253 printk("scsi%d: %s: DMAC %02x @%06x+%04x msk %02x, ",
257 host->host->host_no, where, 254 host->host->host_no, where,
258 mode, addr, (len + 1) & 0xffff, 255 mode, addr, (len + 1) & 0xffff,
259 dmac_read(host->dma.io_port, DMAC_MASKREG)); 256 dmac_read(host, DMAC_MASKREG));
260 257
261 printk("DMA @%06x, ", host->dma.start_addr); 258 printk("DMA @%06x, ", host->dma.start_addr);
262 printk("BH @%p +%04x, ", host->scsi.SCp.ptr, 259 printk("BH @%p +%04x, ", host->scsi.SCp.ptr,
@@ -272,9 +269,9 @@ unsigned long acornscsi_sbic_xfcount(AS_Host *host)
272{ 269{
273 unsigned long length; 270 unsigned long length;
274 271
275 length = sbic_arm_read(host->scsi.io_port, SBIC_TRANSCNTH) << 16; 272 length = sbic_arm_read(host, SBIC_TRANSCNTH) << 16;
276 length |= sbic_arm_readnext(host->scsi.io_port) << 8; 273 length |= sbic_arm_readnext(host) << 8;
277 length |= sbic_arm_readnext(host->scsi.io_port); 274 length |= sbic_arm_readnext(host);
278 275
279 return length; 276 return length;
280} 277}
@@ -285,7 +282,7 @@ acornscsi_sbic_wait(AS_Host *host, int stat_mask, int stat, int timeout, char *m
285 int asr; 282 int asr;
286 283
287 do { 284 do {
288 asr = sbic_arm_read(host->scsi.io_port, SBIC_ASR); 285 asr = sbic_arm_read(host, SBIC_ASR);
289 286
290 if ((asr & stat_mask) == stat) 287 if ((asr & stat_mask) == stat)
291 return 0; 288 return 0;
@@ -304,7 +301,7 @@ int acornscsi_sbic_issuecmd(AS_Host *host, int command)
304 if (acornscsi_sbic_wait(host, ASR_CIP, 0, 1000, "issuing command")) 301 if (acornscsi_sbic_wait(host, ASR_CIP, 0, 1000, "issuing command"))
305 return -1; 302 return -1;
306 303
307 sbic_arm_write(host->scsi.io_port, SBIC_CMND, command); 304 sbic_arm_write(host, SBIC_CMND, command);
308 305
309 return 0; 306 return 0;
310} 307}
@@ -331,20 +328,20 @@ void acornscsi_resetcard(AS_Host *host)
331 328
332 /* assert reset line */ 329 /* assert reset line */
333 host->card.page_reg = 0x80; 330 host->card.page_reg = 0x80;
334 outb(host->card.page_reg, host->card.io_page); 331 writeb(host->card.page_reg, host->fast + PAGE_REG);
335 332
336 /* wait 3 cs. SCSI standard says 25ms. */ 333 /* wait 3 cs. SCSI standard says 25ms. */
337 acornscsi_csdelay(3); 334 acornscsi_csdelay(3);
338 335
339 host->card.page_reg = 0; 336 host->card.page_reg = 0;
340 outb(host->card.page_reg, host->card.io_page); 337 writeb(host->card.page_reg, host->fast + PAGE_REG);
341 338
342 /* 339 /*
343 * Should get a reset from the card 340 * Should get a reset from the card
344 */ 341 */
345 timeout = 1000; 342 timeout = 1000;
346 do { 343 do {
347 if (inb(host->card.io_intr) & 8) 344 if (readb(host->fast + INT_REG) & 8)
348 break; 345 break;
349 udelay(1); 346 udelay(1);
350 } while (--timeout); 347 } while (--timeout);
@@ -353,19 +350,19 @@ void acornscsi_resetcard(AS_Host *host)
353 printk("scsi%d: timeout while resetting card\n", 350 printk("scsi%d: timeout while resetting card\n",
354 host->host->host_no); 351 host->host->host_no);
355 352
356 sbic_arm_read(host->scsi.io_port, SBIC_ASR); 353 sbic_arm_read(host, SBIC_ASR);
357 sbic_arm_read(host->scsi.io_port, SBIC_SSR); 354 sbic_arm_read(host, SBIC_SSR);
358 355
359 /* setup sbic - WD33C93A */ 356 /* setup sbic - WD33C93A */
360 sbic_arm_write(host->scsi.io_port, SBIC_OWNID, OWNID_EAF | host->host->this_id); 357 sbic_arm_write(host, SBIC_OWNID, OWNID_EAF | host->host->this_id);
361 sbic_arm_write(host->scsi.io_port, SBIC_CMND, CMND_RESET); 358 sbic_arm_write(host, SBIC_CMND, CMND_RESET);
362 359
363 /* 360 /*
364 * Command should cause a reset interrupt 361 * Command should cause a reset interrupt
365 */ 362 */
366 timeout = 1000; 363 timeout = 1000;
367 do { 364 do {
368 if (inb(host->card.io_intr) & 8) 365 if (readb(host->fast + INT_REG) & 8)
369 break; 366 break;
370 udelay(1); 367 udelay(1);
371 } while (--timeout); 368 } while (--timeout);
@@ -374,26 +371,26 @@ void acornscsi_resetcard(AS_Host *host)
374 printk("scsi%d: timeout while resetting card\n", 371 printk("scsi%d: timeout while resetting card\n",
375 host->host->host_no); 372 host->host->host_no);
376 373
377 sbic_arm_read(host->scsi.io_port, SBIC_ASR); 374 sbic_arm_read(host, SBIC_ASR);
378 if (sbic_arm_read(host->scsi.io_port, SBIC_SSR) != 0x01) 375 if (sbic_arm_read(host, SBIC_SSR) != 0x01)
379 printk(KERN_CRIT "scsi%d: WD33C93A didn't give enhanced reset interrupt\n", 376 printk(KERN_CRIT "scsi%d: WD33C93A didn't give enhanced reset interrupt\n",
380 host->host->host_no); 377 host->host->host_no);
381 378
382 sbic_arm_write(host->scsi.io_port, SBIC_CTRL, INIT_SBICDMA | CTRL_IDI); 379 sbic_arm_write(host, SBIC_CTRL, INIT_SBICDMA | CTRL_IDI);
383 sbic_arm_write(host->scsi.io_port, SBIC_TIMEOUT, TIMEOUT_TIME); 380 sbic_arm_write(host, SBIC_TIMEOUT, TIMEOUT_TIME);
384 sbic_arm_write(host->scsi.io_port, SBIC_SYNCHTRANSFER, SYNCHTRANSFER_2DBA); 381 sbic_arm_write(host, SBIC_SYNCHTRANSFER, SYNCHTRANSFER_2DBA);
385 sbic_arm_write(host->scsi.io_port, SBIC_SOURCEID, SOURCEID_ER | SOURCEID_DSP); 382 sbic_arm_write(host, SBIC_SOURCEID, SOURCEID_ER | SOURCEID_DSP);
386 383
387 host->card.page_reg = 0x40; 384 host->card.page_reg = 0x40;
388 outb(host->card.page_reg, host->card.io_page); 385 writeb(host->card.page_reg, host->fast + PAGE_REG);
389 386
390 /* setup dmac - uPC71071 */ 387 /* setup dmac - uPC71071 */
391 dmac_write(host->dma.io_port, DMAC_INIT, 0); 388 dmac_write(host, DMAC_INIT, 0);
392#ifdef USE_DMAC 389#ifdef USE_DMAC
393 dmac_write(host->dma.io_port, DMAC_INIT, INIT_8BIT); 390 dmac_write(host, DMAC_INIT, INIT_8BIT);
394 dmac_write(host->dma.io_port, DMAC_CHANNEL, CHANNEL_0); 391 dmac_write(host, DMAC_CHANNEL, CHANNEL_0);
395 dmac_write(host->dma.io_port, DMAC_DEVCON0, INIT_DEVCON0); 392 dmac_write(host, DMAC_DEVCON0, INIT_DEVCON0);
396 dmac_write(host->dma.io_port, DMAC_DEVCON1, INIT_DEVCON1); 393 dmac_write(host, DMAC_DEVCON1, INIT_DEVCON1);
397#endif 394#endif
398 395
399 host->SCpnt = NULL; 396 host->SCpnt = NULL;
@@ -741,9 +738,9 @@ intr_ret_t acornscsi_kick(AS_Host *host)
741 * If we have an interrupt pending, then we may have been reselected. 738 * If we have an interrupt pending, then we may have been reselected.
742 * In this case, we don't want to write to the registers 739 * In this case, we don't want to write to the registers
743 */ 740 */
744 if (!(sbic_arm_read(host->scsi.io_port, SBIC_ASR) & (ASR_INT|ASR_BSY|ASR_CIP))) { 741 if (!(sbic_arm_read(host, SBIC_ASR) & (ASR_INT|ASR_BSY|ASR_CIP))) {
745 sbic_arm_write(host->scsi.io_port, SBIC_DESTID, SCpnt->device->id); 742 sbic_arm_write(host, SBIC_DESTID, SCpnt->device->id);
746 sbic_arm_write(host->scsi.io_port, SBIC_CMND, CMND_SELWITHATN); 743 sbic_arm_write(host, SBIC_CMND, CMND_SELWITHATN);
747 } 744 }
748 745
749 /* 746 /*
@@ -807,7 +804,7 @@ static void acornscsi_done(AS_Host *host, struct scsi_cmnd **SCpntp,
807 struct scsi_cmnd *SCpnt = *SCpntp; 804 struct scsi_cmnd *SCpnt = *SCpntp;
808 805
809 /* clean up */ 806 /* clean up */
810 sbic_arm_write(host->scsi.io_port, SBIC_SOURCEID, SOURCEID_ER | SOURCEID_DSP); 807 sbic_arm_write(host, SBIC_SOURCEID, SOURCEID_ER | SOURCEID_DSP);
811 808
812 host->stats.fins += 1; 809 host->stats.fins += 1;
813 810
@@ -918,13 +915,13 @@ static
918void acornscsi_data_read(AS_Host *host, char *ptr, 915void acornscsi_data_read(AS_Host *host, char *ptr,
919 unsigned int start_addr, unsigned int length) 916 unsigned int start_addr, unsigned int length)
920{ 917{
921 extern void __acornscsi_in(int port, char *buf, int len); 918 extern void __acornscsi_in(void __iomem *, char *buf, int len);
922 unsigned int page, offset, len = length; 919 unsigned int page, offset, len = length;
923 920
924 page = (start_addr >> 12); 921 page = (start_addr >> 12);
925 offset = start_addr & ((1 << 12) - 1); 922 offset = start_addr & ((1 << 12) - 1);
926 923
927 outb((page & 0x3f) | host->card.page_reg, host->card.io_page); 924 writeb((page & 0x3f) | host->card.page_reg, host->fast + PAGE_REG);
928 925
929 while (len > 0) { 926 while (len > 0) {
930 unsigned int this_len; 927 unsigned int this_len;
@@ -934,7 +931,7 @@ void acornscsi_data_read(AS_Host *host, char *ptr,
934 else 931 else
935 this_len = len; 932 this_len = len;
936 933
937 __acornscsi_in(host->card.io_ram + (offset << 1), ptr, this_len); 934 __acornscsi_in(host->base + (offset << 1), ptr, this_len);
938 935
939 offset += this_len; 936 offset += this_len;
940 ptr += this_len; 937 ptr += this_len;
@@ -943,10 +940,10 @@ void acornscsi_data_read(AS_Host *host, char *ptr,
943 if (offset == (1 << 12)) { 940 if (offset == (1 << 12)) {
944 offset = 0; 941 offset = 0;
945 page ++; 942 page ++;
946 outb((page & 0x3f) | host->card.page_reg, host->card.io_page); 943 writeb((page & 0x3f) | host->card.page_reg, host->fast + PAGE_REG);
947 } 944 }
948 } 945 }
949 outb(host->card.page_reg, host->card.io_page); 946 writeb(host->card.page_reg, host->fast + PAGE_REG);
950} 947}
951 948
952/* 949/*
@@ -963,13 +960,13 @@ static
963void acornscsi_data_write(AS_Host *host, char *ptr, 960void acornscsi_data_write(AS_Host *host, char *ptr,
964 unsigned int start_addr, unsigned int length) 961 unsigned int start_addr, unsigned int length)
965{ 962{
966 extern void __acornscsi_out(int port, char *buf, int len); 963 extern void __acornscsi_out(void __iomem *, char *buf, int len);
967 unsigned int page, offset, len = length; 964 unsigned int page, offset, len = length;
968 965
969 page = (start_addr >> 12); 966 page = (start_addr >> 12);
970 offset = start_addr & ((1 << 12) - 1); 967 offset = start_addr & ((1 << 12) - 1);
971 968
972 outb((page & 0x3f) | host->card.page_reg, host->card.io_page); 969 writeb((page & 0x3f) | host->card.page_reg, host->fast + PAGE_REG);
973 970
974 while (len > 0) { 971 while (len > 0) {
975 unsigned int this_len; 972 unsigned int this_len;
@@ -979,7 +976,7 @@ void acornscsi_data_write(AS_Host *host, char *ptr,
979 else 976 else
980 this_len = len; 977 this_len = len;
981 978
982 __acornscsi_out(host->card.io_ram + (offset << 1), ptr, this_len); 979 __acornscsi_out(host->base + (offset << 1), ptr, this_len);
983 980
984 offset += this_len; 981 offset += this_len;
985 ptr += this_len; 982 ptr += this_len;
@@ -988,10 +985,10 @@ void acornscsi_data_write(AS_Host *host, char *ptr,
988 if (offset == (1 << 12)) { 985 if (offset == (1 << 12)) {
989 offset = 0; 986 offset = 0;
990 page ++; 987 page ++;
991 outb((page & 0x3f) | host->card.page_reg, host->card.io_page); 988 writeb((page & 0x3f) | host->card.page_reg, host->fast + PAGE_REG);
992 } 989 }
993 } 990 }
994 outb(host->card.page_reg, host->card.io_page); 991 writeb(host->card.page_reg, host->fast + PAGE_REG);
995} 992}
996 993
997/* ========================================================================================= 994/* =========================================================================================
@@ -1008,8 +1005,8 @@ void acornscsi_data_write(AS_Host *host, char *ptr,
1008static inline 1005static inline
1009void acornscsi_dma_stop(AS_Host *host) 1006void acornscsi_dma_stop(AS_Host *host)
1010{ 1007{
1011 dmac_write(host->dma.io_port, DMAC_MASKREG, MASK_ON); 1008 dmac_write(host, DMAC_MASKREG, MASK_ON);
1012 dmac_clearintr(host->dma.io_intr_clear); 1009 dmac_clearintr(host);
1013 1010
1014#if (DEBUG & DEBUG_DMA) 1011#if (DEBUG & DEBUG_DMA)
1015 DBG(host->SCpnt, acornscsi_dumpdma(host, "stop")); 1012 DBG(host->SCpnt, acornscsi_dumpdma(host, "stop"));
@@ -1031,7 +1028,7 @@ void acornscsi_dma_setup(AS_Host *host, dmadir_t direction)
1031 1028
1032 host->dma.direction = direction; 1029 host->dma.direction = direction;
1033 1030
1034 dmac_write(host->dma.io_port, DMAC_MASKREG, MASK_ON); 1031 dmac_write(host, DMAC_MASKREG, MASK_ON);
1035 1032
1036 if (direction == DMA_OUT) { 1033 if (direction == DMA_OUT) {
1037#if (DEBUG & DEBUG_NO_WRITE) 1034#if (DEBUG & DEBUG_NO_WRITE)
@@ -1062,13 +1059,13 @@ void acornscsi_dma_setup(AS_Host *host, dmadir_t direction)
1062 length); 1059 length);
1063 1060
1064 length -= 1; 1061 length -= 1;
1065 dmac_write(host->dma.io_port, DMAC_TXCNTLO, length); 1062 dmac_write(host, DMAC_TXCNTLO, length);
1066 dmac_write(host->dma.io_port, DMAC_TXCNTHI, length >> 8); 1063 dmac_write(host, DMAC_TXCNTHI, length >> 8);
1067 dmac_write(host->dma.io_port, DMAC_TXADRLO, address); 1064 dmac_write(host, DMAC_TXADRLO, address);
1068 dmac_write(host->dma.io_port, DMAC_TXADRMD, address >> 8); 1065 dmac_write(host, DMAC_TXADRMD, address >> 8);
1069 dmac_write(host->dma.io_port, DMAC_TXADRHI, 0); 1066 dmac_write(host, DMAC_TXADRHI, 0);
1070 dmac_write(host->dma.io_port, DMAC_MODECON, mode); 1067 dmac_write(host, DMAC_MODECON, mode);
1071 dmac_write(host->dma.io_port, DMAC_MASKREG, MASK_OFF); 1068 dmac_write(host, DMAC_MASKREG, MASK_OFF);
1072 1069
1073#if (DEBUG & DEBUG_DMA) 1070#if (DEBUG & DEBUG_DMA)
1074 DBG(host->SCpnt, acornscsi_dumpdma(host, "strt")); 1071 DBG(host->SCpnt, acornscsi_dumpdma(host, "strt"));
@@ -1088,8 +1085,8 @@ void acornscsi_dma_setup(AS_Host *host, dmadir_t direction)
1088static 1085static
1089void acornscsi_dma_cleanup(AS_Host *host) 1086void acornscsi_dma_cleanup(AS_Host *host)
1090{ 1087{
1091 dmac_write(host->dma.io_port, DMAC_MASKREG, MASK_ON); 1088 dmac_write(host, DMAC_MASKREG, MASK_ON);
1092 dmac_clearintr(host->dma.io_intr_clear); 1089 dmac_clearintr(host);
1093 1090
1094 /* 1091 /*
1095 * Check for a pending transfer 1092 * Check for a pending transfer
@@ -1116,7 +1113,7 @@ void acornscsi_dma_cleanup(AS_Host *host)
1116 /* 1113 /*
1117 * Calculate number of bytes transferred from DMA. 1114 * Calculate number of bytes transferred from DMA.
1118 */ 1115 */
1119 transferred = dmac_address(host->dma.io_port) - host->dma.start_addr; 1116 transferred = dmac_address(host) - host->dma.start_addr;
1120 host->dma.transferred += transferred; 1117 host->dma.transferred += transferred;
1121 1118
1122 if (host->dma.direction == DMA_IN) 1119 if (host->dma.direction == DMA_IN)
@@ -1152,13 +1149,13 @@ void acornscsi_dma_intr(AS_Host *host)
1152 DBG(host->SCpnt, acornscsi_dumpdma(host, "inti")); 1149 DBG(host->SCpnt, acornscsi_dumpdma(host, "inti"));
1153#endif 1150#endif
1154 1151
1155 dmac_write(host->dma.io_port, DMAC_MASKREG, MASK_ON); 1152 dmac_write(host, DMAC_MASKREG, MASK_ON);
1156 dmac_clearintr(host->dma.io_intr_clear); 1153 dmac_clearintr(host);
1157 1154
1158 /* 1155 /*
1159 * Calculate amount transferred via DMA 1156 * Calculate amount transferred via DMA
1160 */ 1157 */
1161 transferred = dmac_address(host->dma.io_port) - host->dma.start_addr; 1158 transferred = dmac_address(host) - host->dma.start_addr;
1162 host->dma.transferred += transferred; 1159 host->dma.transferred += transferred;
1163 1160
1164 /* 1161 /*
@@ -1190,12 +1187,12 @@ void acornscsi_dma_intr(AS_Host *host)
1190 length); 1187 length);
1191 1188
1192 length -= 1; 1189 length -= 1;
1193 dmac_write(host->dma.io_port, DMAC_TXCNTLO, length); 1190 dmac_write(host, DMAC_TXCNTLO, length);
1194 dmac_write(host->dma.io_port, DMAC_TXCNTHI, length >> 8); 1191 dmac_write(host, DMAC_TXCNTHI, length >> 8);
1195 dmac_write(host->dma.io_port, DMAC_TXADRLO, address); 1192 dmac_write(host, DMAC_TXADRLO, address);
1196 dmac_write(host->dma.io_port, DMAC_TXADRMD, address >> 8); 1193 dmac_write(host, DMAC_TXADRMD, address >> 8);
1197 dmac_write(host->dma.io_port, DMAC_TXADRHI, 0); 1194 dmac_write(host, DMAC_TXADRHI, 0);
1198 dmac_write(host->dma.io_port, DMAC_MASKREG, MASK_OFF); 1195 dmac_write(host, DMAC_MASKREG, MASK_OFF);
1199 1196
1200#if (DEBUG & DEBUG_DMA) 1197#if (DEBUG & DEBUG_DMA)
1201 DBG(host->SCpnt, acornscsi_dumpdma(host, "into")); 1198 DBG(host->SCpnt, acornscsi_dumpdma(host, "into"));
@@ -1209,15 +1206,15 @@ void acornscsi_dma_intr(AS_Host *host)
1209 * attention condition. We continue giving one byte until 1206 * attention condition. We continue giving one byte until
1210 * the device recognises the attention. 1207 * the device recognises the attention.
1211 */ 1208 */
1212 if (dmac_read(host->dma.io_port, DMAC_STATUS) & STATUS_RQ0) { 1209 if (dmac_read(host, DMAC_STATUS) & STATUS_RQ0) {
1213 acornscsi_abortcmd(host, host->SCpnt->tag); 1210 acornscsi_abortcmd(host, host->SCpnt->tag);
1214 1211
1215 dmac_write(host->dma.io_port, DMAC_TXCNTLO, 0); 1212 dmac_write(host, DMAC_TXCNTLO, 0);
1216 dmac_write(host->dma.io_port, DMAC_TXCNTHI, 0); 1213 dmac_write(host, DMAC_TXCNTHI, 0);
1217 dmac_write(host->dma.io_port, DMAC_TXADRLO, 0); 1214 dmac_write(host, DMAC_TXADRLO, 0);
1218 dmac_write(host->dma.io_port, DMAC_TXADRMD, 0); 1215 dmac_write(host, DMAC_TXADRMD, 0);
1219 dmac_write(host->dma.io_port, DMAC_TXADRHI, 0); 1216 dmac_write(host, DMAC_TXADRHI, 0);
1220 dmac_write(host->dma.io_port, DMAC_MASKREG, MASK_OFF); 1217 dmac_write(host, DMAC_MASKREG, MASK_OFF);
1221 } 1218 }
1222#endif 1219#endif
1223 } 1220 }
@@ -1271,9 +1268,9 @@ void acornscsi_dma_adjust(AS_Host *host)
1271 host->dma.xfer_setup = 0; 1268 host->dma.xfer_setup = 0;
1272 else { 1269 else {
1273 transferred += host->dma.start_addr; 1270 transferred += host->dma.start_addr;
1274 dmac_write(host->dma.io_port, DMAC_TXADRLO, transferred); 1271 dmac_write(host, DMAC_TXADRLO, transferred);
1275 dmac_write(host->dma.io_port, DMAC_TXADRMD, transferred >> 8); 1272 dmac_write(host, DMAC_TXADRMD, transferred >> 8);
1276 dmac_write(host->dma.io_port, DMAC_TXADRHI, transferred >> 16); 1273 dmac_write(host, DMAC_TXADRHI, transferred >> 16);
1277#if (DEBUG & (DEBUG_DMA|DEBUG_WRITE)) 1274#if (DEBUG & (DEBUG_DMA|DEBUG_WRITE))
1278 DBG(host->SCpnt, acornscsi_dumpdma(host, "adjo")); 1275 DBG(host->SCpnt, acornscsi_dumpdma(host, "adjo"));
1279#endif 1276#endif
@@ -1292,12 +1289,12 @@ acornscsi_write_pio(AS_Host *host, char *bytes, int *ptr, int len, unsigned int
1292 int my_ptr = *ptr; 1289 int my_ptr = *ptr;
1293 1290
1294 while (my_ptr < len) { 1291 while (my_ptr < len) {
1295 asr = sbic_arm_read(host->scsi.io_port, SBIC_ASR); 1292 asr = sbic_arm_read(host, SBIC_ASR);
1296 1293
1297 if (asr & ASR_DBR) { 1294 if (asr & ASR_DBR) {
1298 timeout = max_timeout; 1295 timeout = max_timeout;
1299 1296
1300 sbic_arm_write(host->scsi.io_port, SBIC_DATA, bytes[my_ptr++]); 1297 sbic_arm_write(host, SBIC_DATA, bytes[my_ptr++]);
1301 } else if (asr & ASR_INT) 1298 } else if (asr & ASR_INT)
1302 break; 1299 break;
1303 else if (--timeout == 0) 1300 else if (--timeout == 0)
@@ -1320,9 +1317,9 @@ acornscsi_sendcommand(AS_Host *host)
1320{ 1317{
1321 struct scsi_cmnd *SCpnt = host->SCpnt; 1318 struct scsi_cmnd *SCpnt = host->SCpnt;
1322 1319
1323 sbic_arm_write(host->scsi.io_port, SBIC_TRANSCNTH, 0); 1320 sbic_arm_write(host, SBIC_TRANSCNTH, 0);
1324 sbic_arm_writenext(host->scsi.io_port, 0); 1321 sbic_arm_writenext(host, 0);
1325 sbic_arm_writenext(host->scsi.io_port, SCpnt->cmd_len - host->scsi.SCp.sent_command); 1322 sbic_arm_writenext(host, SCpnt->cmd_len - host->scsi.SCp.sent_command);
1326 1323
1327 acornscsi_sbic_issuecmd(host, CMND_XFERINFO); 1324 acornscsi_sbic_issuecmd(host, CMND_XFERINFO);
1328 1325
@@ -1351,7 +1348,7 @@ void acornscsi_sendmessage(AS_Host *host)
1351 1348
1352 acornscsi_sbic_wait(host, ASR_DBR, ASR_DBR, 1000, "sending message 1"); 1349 acornscsi_sbic_wait(host, ASR_DBR, ASR_DBR, 1000, "sending message 1");
1353 1350
1354 sbic_arm_write(host->scsi.io_port, SBIC_DATA, NOP); 1351 sbic_arm_write(host, SBIC_DATA, NOP);
1355 1352
1356 host->scsi.last_message = NOP; 1353 host->scsi.last_message = NOP;
1357#if (DEBUG & DEBUG_MESSAGES) 1354#if (DEBUG & DEBUG_MESSAGES)
@@ -1365,7 +1362,7 @@ void acornscsi_sendmessage(AS_Host *host)
1365 1362
1366 acornscsi_sbic_wait(host, ASR_DBR, ASR_DBR, 1000, "sending message 2"); 1363 acornscsi_sbic_wait(host, ASR_DBR, ASR_DBR, 1000, "sending message 2");
1367 1364
1368 sbic_arm_write(host->scsi.io_port, SBIC_DATA, msg->msg[0]); 1365 sbic_arm_write(host, SBIC_DATA, msg->msg[0]);
1369 1366
1370 host->scsi.last_message = msg->msg[0]; 1367 host->scsi.last_message = msg->msg[0];
1371#if (DEBUG & DEBUG_MESSAGES) 1368#if (DEBUG & DEBUG_MESSAGES)
@@ -1382,9 +1379,9 @@ void acornscsi_sendmessage(AS_Host *host)
1382 * initiator. This provides an interlock so that the 1379 * initiator. This provides an interlock so that the
1383 * initiator can determine which message byte is rejected. 1380 * initiator can determine which message byte is rejected.
1384 */ 1381 */
1385 sbic_arm_write(host->scsi.io_port, SBIC_TRANSCNTH, 0); 1382 sbic_arm_write(host, SBIC_TRANSCNTH, 0);
1386 sbic_arm_writenext(host->scsi.io_port, 0); 1383 sbic_arm_writenext(host, 0);
1387 sbic_arm_writenext(host->scsi.io_port, message_length); 1384 sbic_arm_writenext(host, message_length);
1388 acornscsi_sbic_issuecmd(host, CMND_XFERINFO); 1385 acornscsi_sbic_issuecmd(host, CMND_XFERINFO);
1389 1386
1390 msgnr = 0; 1387 msgnr = 0;
@@ -1421,7 +1418,7 @@ void acornscsi_readstatusbyte(AS_Host *host)
1421{ 1418{
1422 acornscsi_sbic_issuecmd(host, CMND_XFERINFO|CMND_SBT); 1419 acornscsi_sbic_issuecmd(host, CMND_XFERINFO|CMND_SBT);
1423 acornscsi_sbic_wait(host, ASR_DBR, ASR_DBR, 1000, "reading status byte"); 1420 acornscsi_sbic_wait(host, ASR_DBR, ASR_DBR, 1000, "reading status byte");
1424 host->scsi.SCp.Status = sbic_arm_read(host->scsi.io_port, SBIC_DATA); 1421 host->scsi.SCp.Status = sbic_arm_read(host, SBIC_DATA);
1425} 1422}
1426 1423
1427/* 1424/*
@@ -1438,12 +1435,12 @@ unsigned char acornscsi_readmessagebyte(AS_Host *host)
1438 1435
1439 acornscsi_sbic_wait(host, ASR_DBR, ASR_DBR, 1000, "for message byte"); 1436 acornscsi_sbic_wait(host, ASR_DBR, ASR_DBR, 1000, "for message byte");
1440 1437
1441 message = sbic_arm_read(host->scsi.io_port, SBIC_DATA); 1438 message = sbic_arm_read(host, SBIC_DATA);
1442 1439
1443 /* wait for MSGIN-XFER-PAUSED */ 1440 /* wait for MSGIN-XFER-PAUSED */
1444 acornscsi_sbic_wait(host, ASR_INT, ASR_INT, 1000, "for interrupt after message byte"); 1441 acornscsi_sbic_wait(host, ASR_INT, ASR_INT, 1000, "for interrupt after message byte");
1445 1442
1446 sbic_arm_read(host->scsi.io_port, SBIC_SSR); 1443 sbic_arm_read(host, SBIC_SSR);
1447 1444
1448 return message; 1445 return message;
1449} 1446}
@@ -1480,7 +1477,7 @@ void acornscsi_message(AS_Host *host)
1480 1477
1481 /* wait for next msg-in */ 1478 /* wait for next msg-in */
1482 acornscsi_sbic_wait(host, ASR_INT, ASR_INT, 1000, "for interrupt after negate ack"); 1479 acornscsi_sbic_wait(host, ASR_INT, ASR_INT, 1000, "for interrupt after negate ack");
1483 sbic_arm_read(host->scsi.io_port, SBIC_SSR); 1480 sbic_arm_read(host, SBIC_SSR);
1484 } 1481 }
1485 } while (msgidx < msglen); 1482 } while (msgidx < msglen);
1486 1483
@@ -1602,7 +1599,7 @@ void acornscsi_message(AS_Host *host)
1602 host->host->host_no, acornscsi_target(host)); 1599 host->host->host_no, acornscsi_target(host));
1603 host->device[host->SCpnt->device->id].sync_xfer = SYNCHTRANSFER_2DBA; 1600 host->device[host->SCpnt->device->id].sync_xfer = SYNCHTRANSFER_2DBA;
1604 host->device[host->SCpnt->device->id].sync_state = SYNC_ASYNCHRONOUS; 1601 host->device[host->SCpnt->device->id].sync_state = SYNC_ASYNCHRONOUS;
1605 sbic_arm_write(host->scsi.io_port, SBIC_SYNCHTRANSFER, host->device[host->SCpnt->device->id].sync_xfer); 1602 sbic_arm_write(host, SBIC_SYNCHTRANSFER, host->device[host->SCpnt->device->id].sync_xfer);
1606 break; 1603 break;
1607 1604
1608 default: 1605 default:
@@ -1652,7 +1649,7 @@ void acornscsi_message(AS_Host *host)
1652 host->device[host->SCpnt->device->id].sync_xfer = 1649 host->device[host->SCpnt->device->id].sync_xfer =
1653 calc_sync_xfer(period * 4, length); 1650 calc_sync_xfer(period * 4, length);
1654 } 1651 }
1655 sbic_arm_write(host->scsi.io_port, SBIC_SYNCHTRANSFER, host->device[host->SCpnt->device->id].sync_xfer); 1652 sbic_arm_write(host, SBIC_SYNCHTRANSFER, host->device[host->SCpnt->device->id].sync_xfer);
1656 break; 1653 break;
1657#else 1654#else
1658 /* We do not accept synchronous transfers. Respond with a 1655 /* We do not accept synchronous transfers. Respond with a
@@ -1792,10 +1789,10 @@ int acornscsi_starttransfer(AS_Host *host)
1792 1789
1793 residual = scsi_bufflen(host->SCpnt) - host->scsi.SCp.scsi_xferred; 1790 residual = scsi_bufflen(host->SCpnt) - host->scsi.SCp.scsi_xferred;
1794 1791
1795 sbic_arm_write(host->scsi.io_port, SBIC_SYNCHTRANSFER, host->device[host->SCpnt->device->id].sync_xfer); 1792 sbic_arm_write(host, SBIC_SYNCHTRANSFER, host->device[host->SCpnt->device->id].sync_xfer);
1796 sbic_arm_writenext(host->scsi.io_port, residual >> 16); 1793 sbic_arm_writenext(host, residual >> 16);
1797 sbic_arm_writenext(host->scsi.io_port, residual >> 8); 1794 sbic_arm_writenext(host, residual >> 8);
1798 sbic_arm_writenext(host->scsi.io_port, residual); 1795 sbic_arm_writenext(host, residual);
1799 acornscsi_sbic_issuecmd(host, CMND_XFERINFO); 1796 acornscsi_sbic_issuecmd(host, CMND_XFERINFO);
1800 return 1; 1797 return 1;
1801} 1798}
@@ -1816,7 +1813,7 @@ int acornscsi_reconnect(AS_Host *host)
1816{ 1813{
1817 unsigned int target, lun, ok = 0; 1814 unsigned int target, lun, ok = 0;
1818 1815
1819 target = sbic_arm_read(host->scsi.io_port, SBIC_SOURCEID); 1816 target = sbic_arm_read(host, SBIC_SOURCEID);
1820 1817
1821 if (!(target & 8)) 1818 if (!(target & 8))
1822 printk(KERN_ERR "scsi%d: invalid source id after reselection " 1819 printk(KERN_ERR "scsi%d: invalid source id after reselection "
@@ -1832,7 +1829,7 @@ int acornscsi_reconnect(AS_Host *host)
1832 host->SCpnt = NULL; 1829 host->SCpnt = NULL;
1833 } 1830 }
1834 1831
1835 lun = sbic_arm_read(host->scsi.io_port, SBIC_DATA) & 7; 1832 lun = sbic_arm_read(host, SBIC_DATA) & 7;
1836 1833
1837 host->scsi.reconnected.target = target; 1834 host->scsi.reconnected.target = target;
1838 host->scsi.reconnected.lun = lun; 1835 host->scsi.reconnected.lun = lun;
@@ -1952,7 +1949,7 @@ static
1952void acornscsi_abortcmd(AS_Host *host, unsigned char tag) 1949void acornscsi_abortcmd(AS_Host *host, unsigned char tag)
1953{ 1950{
1954 host->scsi.phase = PHASE_ABORTED; 1951 host->scsi.phase = PHASE_ABORTED;
1955 sbic_arm_write(host->scsi.io_port, SBIC_CMND, CMND_ASSERTATN); 1952 sbic_arm_write(host, SBIC_CMND, CMND_ASSERTATN);
1956 1953
1957 msgqueue_flush(&host->scsi.msgs); 1954 msgqueue_flush(&host->scsi.msgs);
1958#ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE 1955#ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE
@@ -1979,11 +1976,11 @@ intr_ret_t acornscsi_sbicintr(AS_Host *host, int in_irq)
1979{ 1976{
1980 unsigned int asr, ssr; 1977 unsigned int asr, ssr;
1981 1978
1982 asr = sbic_arm_read(host->scsi.io_port, SBIC_ASR); 1979 asr = sbic_arm_read(host, SBIC_ASR);
1983 if (!(asr & ASR_INT)) 1980 if (!(asr & ASR_INT))
1984 return INTR_IDLE; 1981 return INTR_IDLE;
1985 1982
1986 ssr = sbic_arm_read(host->scsi.io_port, SBIC_SSR); 1983 ssr = sbic_arm_read(host, SBIC_SSR);
1987 1984
1988#if (DEBUG & DEBUG_PHASES) 1985#if (DEBUG & DEBUG_PHASES)
1989 print_sbic_status(asr, ssr, host->scsi.phase); 1986 print_sbic_status(asr, ssr, host->scsi.phase);
@@ -1999,15 +1996,15 @@ intr_ret_t acornscsi_sbicintr(AS_Host *host, int in_irq)
1999 printk(KERN_ERR "scsi%d: reset in standard mode but wanted advanced mode.\n", 1996 printk(KERN_ERR "scsi%d: reset in standard mode but wanted advanced mode.\n",
2000 host->host->host_no); 1997 host->host->host_no);
2001 /* setup sbic - WD33C93A */ 1998 /* setup sbic - WD33C93A */
2002 sbic_arm_write(host->scsi.io_port, SBIC_OWNID, OWNID_EAF | host->host->this_id); 1999 sbic_arm_write(host, SBIC_OWNID, OWNID_EAF | host->host->this_id);
2003 sbic_arm_write(host->scsi.io_port, SBIC_CMND, CMND_RESET); 2000 sbic_arm_write(host, SBIC_CMND, CMND_RESET);
2004 return INTR_IDLE; 2001 return INTR_IDLE;
2005 2002
2006 case 0x01: /* reset state - advanced */ 2003 case 0x01: /* reset state - advanced */
2007 sbic_arm_write(host->scsi.io_port, SBIC_CTRL, INIT_SBICDMA | CTRL_IDI); 2004 sbic_arm_write(host, SBIC_CTRL, INIT_SBICDMA | CTRL_IDI);
2008 sbic_arm_write(host->scsi.io_port, SBIC_TIMEOUT, TIMEOUT_TIME); 2005 sbic_arm_write(host, SBIC_TIMEOUT, TIMEOUT_TIME);
2009 sbic_arm_write(host->scsi.io_port, SBIC_SYNCHTRANSFER, SYNCHTRANSFER_2DBA); 2006 sbic_arm_write(host, SBIC_SYNCHTRANSFER, SYNCHTRANSFER_2DBA);
2010 sbic_arm_write(host->scsi.io_port, SBIC_SOURCEID, SOURCEID_ER | SOURCEID_DSP); 2007 sbic_arm_write(host, SBIC_SOURCEID, SOURCEID_ER | SOURCEID_DSP);
2011 msgqueue_flush(&host->scsi.msgs); 2008 msgqueue_flush(&host->scsi.msgs);
2012 return INTR_IDLE; 2009 return INTR_IDLE;
2013 2010
@@ -2025,10 +2022,10 @@ intr_ret_t acornscsi_sbicintr(AS_Host *host, int in_irq)
2025 msgqueue_flush(&host->scsi.msgs); 2022 msgqueue_flush(&host->scsi.msgs);
2026 host->dma.transferred = host->scsi.SCp.scsi_xferred; 2023 host->dma.transferred = host->scsi.SCp.scsi_xferred;
2027 /* 33C93 gives next interrupt indicating bus phase */ 2024 /* 33C93 gives next interrupt indicating bus phase */
2028 asr = sbic_arm_read(host->scsi.io_port, SBIC_ASR); 2025 asr = sbic_arm_read(host, SBIC_ASR);
2029 if (!(asr & ASR_INT)) 2026 if (!(asr & ASR_INT))
2030 break; 2027 break;
2031 ssr = sbic_arm_read(host->scsi.io_port, SBIC_SSR); 2028 ssr = sbic_arm_read(host, SBIC_SSR);
2032 ADD_STATUS(8, ssr, host->scsi.phase, 1); 2029 ADD_STATUS(8, ssr, host->scsi.phase, 1);
2033 ADD_STATUS(host->SCpnt->device->id, ssr, host->scsi.phase, 1); 2030 ADD_STATUS(host->SCpnt->device->id, ssr, host->scsi.phase, 1);
2034 goto connected; 2031 goto connected;
@@ -2476,11 +2473,11 @@ acornscsi_intr(int irq, void *dev_id)
2476 do { 2473 do {
2477 ret = INTR_IDLE; 2474 ret = INTR_IDLE;
2478 2475
2479 iostatus = inb(host->card.io_intr); 2476 iostatus = readb(host->fast + INT_REG);
2480 2477
2481 if (iostatus & 2) { 2478 if (iostatus & 2) {
2482 acornscsi_dma_intr(host); 2479 acornscsi_dma_intr(host);
2483 iostatus = inb(host->card.io_intr); 2480 iostatus = readb(host->fast + INT_REG);
2484 } 2481 }
2485 2482
2486 if (iostatus & 8) 2483 if (iostatus & 8)
@@ -2655,7 +2652,7 @@ static enum res_abort acornscsi_do_abort(AS_Host *host, struct scsi_cmnd *SCpnt)
2655 * busylun bit. 2652 * busylun bit.
2656 */ 2653 */
2657 case PHASE_CONNECTED: 2654 case PHASE_CONNECTED:
2658 sbic_arm_write(host->scsi.io_port, SBIC_CMND, CMND_DISCONNECT); 2655 sbic_arm_write(host, SBIC_CMND, CMND_DISCONNECT);
2659 host->SCpnt = NULL; 2656 host->SCpnt = NULL;
2660 res = res_success_clear; 2657 res = res_success_clear;
2661 break; 2658 break;
@@ -2699,8 +2696,8 @@ int acornscsi_abort(struct scsi_cmnd *SCpnt)
2699#if (DEBUG & DEBUG_ABORT) 2696#if (DEBUG & DEBUG_ABORT)
2700 { 2697 {
2701 int asr, ssr; 2698 int asr, ssr;
2702 asr = sbic_arm_read(host->scsi.io_port, SBIC_ASR); 2699 asr = sbic_arm_read(host, SBIC_ASR);
2703 ssr = sbic_arm_read(host->scsi.io_port, SBIC_SSR); 2700 ssr = sbic_arm_read(host, SBIC_SSR);
2704 2701
2705 printk(KERN_WARNING "acornscsi_abort: "); 2702 printk(KERN_WARNING "acornscsi_abort: ");
2706 print_sbic_status(asr, ssr, host->scsi.phase); 2703 print_sbic_status(asr, ssr, host->scsi.phase);
@@ -2731,9 +2728,7 @@ int acornscsi_abort(struct scsi_cmnd *SCpnt)
2731//#if (DEBUG & DEBUG_ABORT) 2728//#if (DEBUG & DEBUG_ABORT)
2732 printk("success\n"); 2729 printk("success\n");
2733//#endif 2730//#endif
2734 SCpnt->result = DID_ABORT << 16; 2731 result = SUCCESS;
2735 SCpnt->scsi_done(SCpnt);
2736 result = SCSI_ABORT_SUCCESS;
2737 break; 2732 break;
2738 2733
2739 /* 2734 /*
@@ -2745,7 +2740,7 @@ int acornscsi_abort(struct scsi_cmnd *SCpnt)
2745//#if (DEBUG & DEBUG_ABORT) 2740//#if (DEBUG & DEBUG_ABORT)
2746 printk("snooze\n"); 2741 printk("snooze\n");
2747//#endif 2742//#endif
2748 result = SCSI_ABORT_SNOOZE; 2743 result = FAILED;
2749 break; 2744 break;
2750 2745
2751 /* 2746 /*
@@ -2755,11 +2750,7 @@ int acornscsi_abort(struct scsi_cmnd *SCpnt)
2755 default: 2750 default:
2756 case res_not_running: 2751 case res_not_running:
2757 acornscsi_dumplog(host, SCpnt->device->id); 2752 acornscsi_dumplog(host, SCpnt->device->id);
2758#if (DEBUG & DEBUG_ABORT) 2753 result = FAILED;
2759 result = SCSI_ABORT_SNOOZE;
2760#else
2761 result = SCSI_ABORT_NOT_RUNNING;
2762#endif
2763//#if (DEBUG & DEBUG_ABORT) 2754//#if (DEBUG & DEBUG_ABORT)
2764 printk("not running\n"); 2755 printk("not running\n");
2765//#endif 2756//#endif
@@ -2770,13 +2761,12 @@ int acornscsi_abort(struct scsi_cmnd *SCpnt)
2770} 2761}
2771 2762
2772/* 2763/*
2773 * Prototype: int acornscsi_reset(struct scsi_cmnd *SCpnt, unsigned int reset_flags) 2764 * Prototype: int acornscsi_reset(struct scsi_cmnd *SCpnt)
2774 * Purpose : reset a command on this host/reset this host 2765 * Purpose : reset a command on this host/reset this host
2775 * Params : SCpnt - command causing reset 2766 * Params : SCpnt - command causing reset
2776 * result - what type of reset to perform
2777 * Returns : one of SCSI_RESET_ macros 2767 * Returns : one of SCSI_RESET_ macros
2778 */ 2768 */
2779int acornscsi_reset(struct scsi_cmnd *SCpnt, unsigned int reset_flags) 2769int acornscsi_bus_reset(struct scsi_cmnd *SCpnt)
2780{ 2770{
2781 AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata; 2771 AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata;
2782 struct scsi_cmnd *SCptr; 2772 struct scsi_cmnd *SCptr;
@@ -2787,8 +2777,8 @@ int acornscsi_reset(struct scsi_cmnd *SCpnt, unsigned int reset_flags)
2787 { 2777 {
2788 int asr, ssr; 2778 int asr, ssr;
2789 2779
2790 asr = sbic_arm_read(host->scsi.io_port, SBIC_ASR); 2780 asr = sbic_arm_read(host, SBIC_ASR);
2791 ssr = sbic_arm_read(host->scsi.io_port, SBIC_SSR); 2781 ssr = sbic_arm_read(host, SBIC_SSR);
2792 2782
2793 printk(KERN_WARNING "acornscsi_reset: "); 2783 printk(KERN_WARNING "acornscsi_reset: ");
2794 print_sbic_status(asr, ssr, host->scsi.phase); 2784 print_sbic_status(asr, ssr, host->scsi.phase);
@@ -2798,28 +2788,16 @@ int acornscsi_reset(struct scsi_cmnd *SCpnt, unsigned int reset_flags)
2798 2788
2799 acornscsi_dma_stop(host); 2789 acornscsi_dma_stop(host);
2800 2790
2801 SCptr = host->SCpnt;
2802
2803 /* 2791 /*
2804 * do hard reset. This resets all devices on this host, and so we 2792 * do hard reset. This resets all devices on this host, and so we
2805 * must set the reset status on all commands. 2793 * must set the reset status on all commands.
2806 */ 2794 */
2807 acornscsi_resetcard(host); 2795 acornscsi_resetcard(host);
2808 2796
2809 /*
2810 * report reset on commands current connected/disconnected
2811 */
2812 acornscsi_reportstatus(&host->SCpnt, &SCptr, DID_RESET);
2813
2814 while ((SCptr = queue_remove(&host->queues.disconnected)) != NULL) 2797 while ((SCptr = queue_remove(&host->queues.disconnected)) != NULL)
2815 acornscsi_reportstatus(&SCptr, &SCpnt, DID_RESET); 2798 ;
2816
2817 if (SCpnt) {
2818 SCpnt->result = DID_RESET << 16;
2819 SCpnt->scsi_done(SCpnt);
2820 }
2821 2799
2822 return SCSI_RESET_BUS_RESET | SCSI_RESET_HOST_RESET | SCSI_RESET_SUCCESS; 2800 return SUCCESS;
2823} 2801}
2824 2802
2825/*============================================================================================== 2803/*==============================================================================================
@@ -2850,7 +2828,7 @@ char *acornscsi_info(struct Scsi_Host *host)
2850 " LINK" 2828 " LINK"
2851#endif 2829#endif
2852#if (DEBUG & DEBUG_NO_WRITE) 2830#if (DEBUG & DEBUG_NO_WRITE)
2853 " NOWRITE ("NO_WRITE_STR")" 2831 " NOWRITE (" __stringify(NO_WRITE) ")"
2854#endif 2832#endif
2855 , host->hostt->name, host->io_port, host->irq, 2833 , host->hostt->name, host->io_port, host->irq,
2856 VER_MAJOR, VER_MINOR, VER_PATCH); 2834 VER_MAJOR, VER_MINOR, VER_PATCH);
@@ -2881,15 +2859,15 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start,
2881 " LINK" 2859 " LINK"
2882#endif 2860#endif
2883#if (DEBUG & DEBUG_NO_WRITE) 2861#if (DEBUG & DEBUG_NO_WRITE)
2884 " NOWRITE ("NO_WRITE_STR")" 2862 " NOWRITE (" __stringify(NO_WRITE) ")"
2885#endif 2863#endif
2886 "\n\n", VER_MAJOR, VER_MINOR, VER_PATCH); 2864 "\n\n", VER_MAJOR, VER_MINOR, VER_PATCH);
2887 2865
2888 p += sprintf(p, "SBIC: WD33C93A Address: %08X IRQ : %d\n", 2866 p += sprintf(p, "SBIC: WD33C93A Address: %p IRQ : %d\n",
2889 host->scsi.io_port, host->scsi.irq); 2867 host->base + SBIC_REGIDX, host->scsi.irq);
2890#ifdef USE_DMAC 2868#ifdef USE_DMAC
2891 p += sprintf(p, "DMAC: uPC71071 Address: %08X IRQ : %d\n\n", 2869 p += sprintf(p, "DMAC: uPC71071 Address: %p IRQ : %d\n\n",
2892 host->dma.io_port, host->scsi.irq); 2870 host->base + DMAC_OFFSET, host->scsi.irq);
2893#endif 2871#endif
2894 2872
2895 p += sprintf(p, "Statistics:\n" 2873 p += sprintf(p, "Statistics:\n"
@@ -2976,9 +2954,8 @@ static struct scsi_host_template acornscsi_template = {
2976 .name = "AcornSCSI", 2954 .name = "AcornSCSI",
2977 .info = acornscsi_info, 2955 .info = acornscsi_info,
2978 .queuecommand = acornscsi_queuecmd, 2956 .queuecommand = acornscsi_queuecmd,
2979#warning fixme 2957 .eh_abort_handler = acornscsi_abort,
2980 .abort = acornscsi_abort, 2958 .eh_bus_reset_handler = acornscsi_bus_reset,
2981 .reset = acornscsi_reset,
2982 .can_queue = 16, 2959 .can_queue = 16,
2983 .this_id = 7, 2960 .this_id = 7,
2984 .sg_tablesize = SG_ALL, 2961 .sg_tablesize = SG_ALL,
@@ -2992,48 +2969,37 @@ acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
2992{ 2969{
2993 struct Scsi_Host *host; 2970 struct Scsi_Host *host;
2994 AS_Host *ashost; 2971 AS_Host *ashost;
2995 int ret = -ENOMEM; 2972 int ret;
2996 2973
2997 host = scsi_host_alloc(&acornscsi_template, sizeof(AS_Host)); 2974 ret = ecard_request_resources(ec);
2998 if (!host) 2975 if (ret)
2999 goto out; 2976 goto out;
3000 2977
2978 host = scsi_host_alloc(&acornscsi_template, sizeof(AS_Host));
2979 if (!host) {
2980 ret = -ENOMEM;
2981 goto out_release;
2982 }
2983
3001 ashost = (AS_Host *)host->hostdata; 2984 ashost = (AS_Host *)host->hostdata;
3002 2985
3003 host->io_port = ecard_address(ec, ECARD_MEMC, 0); 2986 ashost->base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
3004 host->irq = ec->irq; 2987 ashost->fast = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
2988 if (!ashost->base || !ashost->fast)
2989 goto out_put;
3005 2990
3006 ashost->host = host; 2991 host->irq = ec->irq;
3007 ashost->scsi.io_port = ioaddr(host->io_port + 0x800); 2992 ashost->host = host;
3008 ashost->scsi.irq = host->irq; 2993 ashost->scsi.irq = host->irq;
3009 ashost->card.io_intr = POD_SPACE(host->io_port) + 0x800;
3010 ashost->card.io_page = POD_SPACE(host->io_port) + 0xc00;
3011 ashost->card.io_ram = ioaddr(host->io_port);
3012 ashost->dma.io_port = host->io_port + 0xc00;
3013 ashost->dma.io_intr_clear = POD_SPACE(host->io_port) + 0x800;
3014 2994
3015 ec->irqaddr = (char *)ioaddr(ashost->card.io_intr); 2995 ec->irqaddr = ashost->fast + INT_REG;
3016 ec->irqmask = 0x0a; 2996 ec->irqmask = 0x0a;
3017 2997
3018 ret = -EBUSY;
3019 if (!request_region(host->io_port + 0x800, 2, "acornscsi(sbic)"))
3020 goto err_1;
3021 if (!request_region(ashost->card.io_intr, 1, "acornscsi(intr)"))
3022 goto err_2;
3023 if (!request_region(ashost->card.io_page, 1, "acornscsi(page)"))
3024 goto err_3;
3025#ifdef USE_DMAC
3026 if (!request_region(ashost->dma.io_port, 256, "acornscsi(dmac)"))
3027 goto err_4;
3028#endif
3029 if (!request_region(host->io_port, 2048, "acornscsi(ram)"))
3030 goto err_5;
3031
3032 ret = request_irq(host->irq, acornscsi_intr, IRQF_DISABLED, "acornscsi", ashost); 2998 ret = request_irq(host->irq, acornscsi_intr, IRQF_DISABLED, "acornscsi", ashost);
3033 if (ret) { 2999 if (ret) {
3034 printk(KERN_CRIT "scsi%d: IRQ%d not free: %d\n", 3000 printk(KERN_CRIT "scsi%d: IRQ%d not free: %d\n",
3035 host->host_no, ashost->scsi.irq, ret); 3001 host->host_no, ashost->scsi.irq, ret);
3036 goto err_6; 3002 goto out_put;
3037 } 3003 }
3038 3004
3039 memset(&ashost->stats, 0, sizeof (ashost->stats)); 3005 memset(&ashost->stats, 0, sizeof (ashost->stats));
@@ -3045,27 +3011,22 @@ acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
3045 3011
3046 ret = scsi_add_host(host, &ec->dev); 3012 ret = scsi_add_host(host, &ec->dev);
3047 if (ret) 3013 if (ret)
3048 goto err_7; 3014 goto out_irq;
3049 3015
3050 scsi_scan_host(host); 3016 scsi_scan_host(host);
3051 goto out; 3017 goto out;
3052 3018
3053 err_7: 3019 out_irq:
3054 free_irq(host->irq, ashost); 3020 free_irq(host->irq, ashost);
3055 err_6: 3021 msgqueue_free(&ashost->scsi.msgs);
3056 release_region(host->io_port, 2048); 3022 queue_free(&ashost->queues.disconnected);
3057 err_5: 3023 queue_free(&ashost->queues.issue);
3058#ifdef USE_DMAC 3024 out_put:
3059 release_region(ashost->dma.io_port, 256); 3025 ecardm_iounmap(ec, ashost->fast);
3060#endif 3026 ecardm_iounmap(ec, ashost->base);
3061 err_4:
3062 release_region(ashost->card.io_page, 1);
3063 err_3:
3064 release_region(ashost->card.io_intr, 1);
3065 err_2:
3066 release_region(host->io_port + 0x800, 2);
3067 err_1:
3068 scsi_host_put(host); 3027 scsi_host_put(host);
3028 out_release:
3029 ecard_release_resources(ec);
3069 out: 3030 out:
3070 return ret; 3031 return ret;
3071} 3032}
@@ -3081,20 +3042,17 @@ static void __devexit acornscsi_remove(struct expansion_card *ec)
3081 /* 3042 /*
3082 * Put card into RESET state 3043 * Put card into RESET state
3083 */ 3044 */
3084 outb(0x80, ashost->card.io_page); 3045 writeb(0x80, ashost->fast + PAGE_REG);
3085 3046
3086 free_irq(host->irq, ashost); 3047 free_irq(host->irq, ashost);
3087 3048
3088 release_region(host->io_port + 0x800, 2);
3089 release_region(ashost->card.io_intr, 1);
3090 release_region(ashost->card.io_page, 1);
3091 release_region(ashost->dma.io_port, 256);
3092 release_region(host->io_port, 2048);
3093
3094 msgqueue_free(&ashost->scsi.msgs); 3049 msgqueue_free(&ashost->scsi.msgs);
3095 queue_free(&ashost->queues.disconnected); 3050 queue_free(&ashost->queues.disconnected);
3096 queue_free(&ashost->queues.issue); 3051 queue_free(&ashost->queues.issue);
3052 ecardm_iounmap(ec, ashost->fast);
3053 ecardm_iounmap(ec, ashost->base);
3097 scsi_host_put(host); 3054 scsi_host_put(host);
3055 ecard_release_resources(ec);
3098} 3056}
3099 3057
3100static const struct ecard_id acornscsi_cids[] = { 3058static const struct ecard_id acornscsi_cids[] = {
diff --git a/drivers/scsi/arm/acornscsi.h b/drivers/scsi/arm/acornscsi.h
index d11424b89f42..8d2172a0b351 100644
--- a/drivers/scsi/arm/acornscsi.h
+++ b/drivers/scsi/arm/acornscsi.h
@@ -179,7 +179,6 @@
179 179
180/* miscellaneous internal variables */ 180/* miscellaneous internal variables */
181 181
182#define POD_SPACE(x) ((x) + 0xd0000)
183#define MASK_ON (MASKREG_M3|MASKREG_M2|MASKREG_M1|MASKREG_M0) 182#define MASK_ON (MASKREG_M3|MASKREG_M2|MASKREG_M1|MASKREG_M0)
184#define MASK_OFF (MASKREG_M3|MASKREG_M2|MASKREG_M1) 183#define MASK_OFF (MASKREG_M3|MASKREG_M2|MASKREG_M1)
185 184
@@ -279,10 +278,11 @@ typedef struct acornscsi_hostdata {
279 struct Scsi_Host *host; /* host */ 278 struct Scsi_Host *host; /* host */
280 struct scsi_cmnd *SCpnt; /* currently processing command */ 279 struct scsi_cmnd *SCpnt; /* currently processing command */
281 struct scsi_cmnd *origSCpnt; /* original connecting command */ 280 struct scsi_cmnd *origSCpnt; /* original connecting command */
281 void __iomem *base; /* memc base address */
282 void __iomem *fast; /* fast ioc base address */
282 283
283 /* driver information */ 284 /* driver information */
284 struct { 285 struct {
285 unsigned int io_port; /* base address of WD33C93 */
286 unsigned int irq; /* interrupt */ 286 unsigned int irq; /* interrupt */
287 phase_t phase; /* current phase */ 287 phase_t phase; /* current phase */
288 288
@@ -329,8 +329,6 @@ typedef struct acornscsi_hostdata {
329 329
330 /* DMA info */ 330 /* DMA info */
331 struct { 331 struct {
332 unsigned int io_port; /* base address of DMA controller */
333 unsigned int io_intr_clear; /* address of DMA interrupt clear */
334 unsigned int free_addr; /* next free address */ 332 unsigned int free_addr; /* next free address */
335 unsigned int start_addr; /* start address of current transfer */ 333 unsigned int start_addr; /* start address of current transfer */
336 dmadir_t direction; /* dma direction */ 334 dmadir_t direction; /* dma direction */
@@ -345,9 +343,6 @@ typedef struct acornscsi_hostdata {
345 343
346 /* card info */ 344 /* card info */
347 struct { 345 struct {
348 unsigned int io_intr; /* base address of interrupt id reg */
349 unsigned int io_page; /* base address of page reg */
350 unsigned int io_ram; /* base address of RAM access */
351 unsigned char page_reg; /* current setting of page reg */ 346 unsigned char page_reg; /* current setting of page reg */
352 } card; 347 } card;
353 348