aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/gvp11.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2009-05-17 06:17:28 -0400
committerGeert Uytterhoeven <geert@linux-m68k.org>2010-05-26 13:51:06 -0400
commit6869b15efccce954a28d14c84b25350d125e2f93 (patch)
tree936c0220550d00abaaf9b54d51f4083261848191 /drivers/scsi/gvp11.c
parentdd6c26a66bdc629a500174ffe73b010b070b9f1b (diff)
m68k/scsi: gvp11 - Kill ugly DMA() macro
Acked-by: James Bottomley <James.Bottomley@suse.de> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'drivers/scsi/gvp11.c')
-rw-r--r--drivers/scsi/gvp11.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c
index 18b7102bb80e..777972e6bbf3 100644
--- a/drivers/scsi/gvp11.c
+++ b/drivers/scsi/gvp11.c
@@ -22,15 +22,13 @@
22#include <linux/stat.h> 22#include <linux/stat.h>
23 23
24 24
25#define DMA(ptr) ((gvp11_scsiregs *)((ptr)->base)) 25static irqreturn_t gvp11_intr(int irq, void *data)
26
27static irqreturn_t gvp11_intr(int irq, void *_instance)
28{ 26{
27 struct Scsi_Host *instance = data;
28 gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base);
29 unsigned int status = regs->CNTR;
29 unsigned long flags; 30 unsigned long flags;
30 unsigned int status;
31 struct Scsi_Host *instance = (struct Scsi_Host *)_instance;
32 31
33 status = DMA(instance)->CNTR;
34 if (!(status & GVP11_DMAC_INT_PENDING)) 32 if (!(status & GVP11_DMAC_INT_PENDING))
35 return IRQ_NONE; 33 return IRQ_NONE;
36 34
@@ -51,6 +49,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
51{ 49{
52 struct Scsi_Host *instance = cmd->device->host; 50 struct Scsi_Host *instance = cmd->device->host;
53 struct WD33C93_hostdata *hdata = shost_priv(instance); 51 struct WD33C93_hostdata *hdata = shost_priv(instance);
52 gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base);
54 unsigned short cntr = GVP11_DMAC_INT_ENABLE; 53 unsigned short cntr = GVP11_DMAC_INT_ENABLE;
55 unsigned long addr = virt_to_bus(cmd->SCp.ptr); 54 unsigned long addr = virt_to_bus(cmd->SCp.ptr);
56 int bank_mask; 55 int bank_mask;
@@ -117,10 +116,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
117 cntr |= GVP11_DMAC_DIR_WRITE; 116 cntr |= GVP11_DMAC_DIR_WRITE;
118 117
119 hdata->dma_dir = dir_in; 118 hdata->dma_dir = dir_in;
120 DMA(cmd->device->host)->CNTR = cntr; 119 regs->CNTR = cntr;
121 120
122 /* setup DMA *physical* address */ 121 /* setup DMA *physical* address */
123 DMA(cmd->device->host)->ACR = addr; 122 regs->ACR = addr;
124 123
125 if (dir_in) { 124 if (dir_in) {
126 /* invalidate any cache */ 125 /* invalidate any cache */
@@ -132,10 +131,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
132 131
133 bank_mask = (~hdata->dma_xfer_mask >> 18) & 0x01c0; 132 bank_mask = (~hdata->dma_xfer_mask >> 18) & 0x01c0;
134 if (bank_mask) 133 if (bank_mask)
135 DMA(cmd->device->host)->BANK = bank_mask & (addr >> 18); 134 regs->BANK = bank_mask & (addr >> 18);
136 135
137 /* start DMA */ 136 /* start DMA */
138 DMA(cmd->device->host)->ST_DMA = 1; 137 regs->ST_DMA = 1;
139 138
140 /* return success */ 139 /* return success */
141 return 0; 140 return 0;
@@ -144,12 +143,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
144static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, 143static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
145 int status) 144 int status)
146{ 145{
146 gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base);
147 struct WD33C93_hostdata *hdata = shost_priv(instance); 147 struct WD33C93_hostdata *hdata = shost_priv(instance);
148 148
149 /* stop DMA */ 149 /* stop DMA */
150 DMA(instance)->SP_DMA = 1; 150 regs->SP_DMA = 1;
151 /* remove write bit from CONTROL bits */ 151 /* remove write bit from CONTROL bits */
152 DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; 152 regs->CNTR = GVP11_DMAC_INT_ENABLE;
153 153
154 /* copy from a bounce buffer, if necessary */ 154 /* copy from a bounce buffer, if necessary */
155 if (status && hdata->dma_bounce_buffer) { 155 if (status && hdata->dma_bounce_buffer) {
@@ -178,7 +178,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
178 struct zorro_dev *z = NULL; 178 struct zorro_dev *z = NULL;
179 unsigned int default_dma_xfer_mask; 179 unsigned int default_dma_xfer_mask;
180 struct WD33C93_hostdata *hdata; 180 struct WD33C93_hostdata *hdata;
181 wd33c93_regs regs; 181 gvp11_scsiregs *regs;
182 wd33c93_regs wdregs;
182 int num_gvp11 = 0; 183 int num_gvp11 = 0;
183#ifdef CHECK_WD33C93 184#ifdef CHECK_WD33C93
184 volatile unsigned char *sasr_3393, *scmd_3393; 185 volatile unsigned char *sasr_3393, *scmd_3393;
@@ -310,33 +311,34 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
310 else 311 else
311 hdata->dma_xfer_mask = default_dma_xfer_mask; 312 hdata->dma_xfer_mask = default_dma_xfer_mask;
312 313
313 DMA(instance)->secret2 = 1; 314 regs = (gvp11_scsiregs *)(instance->base);
314 DMA(instance)->secret1 = 0; 315 regs->secret2 = 1;
315 DMA(instance)->secret3 = 15; 316 regs->secret1 = 0;
316 while (DMA(instance)->CNTR & GVP11_DMAC_BUSY) 317 regs->secret3 = 15;
318 while (regs->CNTR & GVP11_DMAC_BUSY)
317 ; 319 ;
318 DMA(instance)->CNTR = 0; 320 regs->CNTR = 0;
319 321
320 DMA(instance)->BANK = 0; 322 regs->BANK = 0;
321 323
322 epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000); 324 epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000);
323 325
324 /* 326 /*
325 * Check for 14MHz SCSI clock 327 * Check for 14MHz SCSI clock
326 */ 328 */
327 regs.SASR = &(DMA(instance)->SASR); 329 wdregs.SASR = &regs->SASR;
328 regs.SCMD = &(DMA(instance)->SCMD); 330 wdregs.SCMD = &regs->SCMD;
329 hdata->no_sync = 0xff; 331 hdata->no_sync = 0xff;
330 hdata->fast = 0; 332 hdata->fast = 0;
331 hdata->dma_mode = CTRL_DMA; 333 hdata->dma_mode = CTRL_DMA;
332 wd33c93_init(instance, regs, dma_setup, dma_stop, 334 wd33c93_init(instance, wdregs, dma_setup, dma_stop,
333 (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 335 (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10
334 : WD33C93_FS_12_15); 336 : WD33C93_FS_12_15);
335 337
336 if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, 338 if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED,
337 "GVP11 SCSI", instance)) 339 "GVP11 SCSI", instance))
338 goto unregister; 340 goto unregister;
339 DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; 341 regs->CNTR = GVP11_DMAC_INT_ENABLE;
340 num_gvp11++; 342 num_gvp11++;
341 continue; 343 continue;
342 344
@@ -391,7 +393,9 @@ static struct scsi_host_template driver_template = {
391int gvp11_release(struct Scsi_Host *instance) 393int gvp11_release(struct Scsi_Host *instance)
392{ 394{
393#ifdef MODULE 395#ifdef MODULE
394 DMA(instance)->CNTR = 0; 396 gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base);
397
398 regs->CNTR = 0;
395 release_mem_region(ZTWO_PADDR(instance->base), 256); 399 release_mem_region(ZTWO_PADDR(instance->base), 256);
396 free_irq(IRQ_AMIGA_PORTS, instance); 400 free_irq(IRQ_AMIGA_PORTS, instance);
397#endif 401#endif