aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2010-04-04 05:00:40 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-05-02 16:02:11 -0400
commitb1de6ab79456724d316d5dfa4bbb28f166cda99e (patch)
tree7f3a9f2353646f3c5dc24c1f79d48bb47081181d /drivers/scsi
parentafdbbc16134ae2eea612b51cab7545938d266dce (diff)
[SCSI] a2091: Kill ugly DMA() macro
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/a2091.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c
index 95584059863b..308541ff85cf 100644
--- a/drivers/scsi/a2091.c
+++ b/drivers/scsi/a2091.c
@@ -22,17 +22,15 @@
22#include <linux/stat.h> 22#include <linux/stat.h>
23 23
24 24
25#define DMA(ptr) ((a2091_scsiregs *)((ptr)->base))
26
27static int a2091_release(struct Scsi_Host *instance); 25static int a2091_release(struct Scsi_Host *instance);
28 26
29static irqreturn_t a2091_intr(int irq, void *_instance) 27static irqreturn_t a2091_intr(int irq, void *data)
30{ 28{
29 struct Scsi_Host *instance = data;
30 a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
31 unsigned int status = regs->ISTR;
31 unsigned long flags; 32 unsigned long flags;
32 unsigned int status;
33 struct Scsi_Host *instance = (struct Scsi_Host *)_instance;
34 33
35 status = DMA(instance)->ISTR;
36 if (!(status & (ISTR_INT_F | ISTR_INT_P)) || !(status & ISTR_INTS)) 34 if (!(status & (ISTR_INT_F | ISTR_INT_P)) || !(status & ISTR_INTS))
37 return IRQ_NONE; 35 return IRQ_NONE;
38 36
@@ -46,6 +44,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
46{ 44{
47 struct Scsi_Host *instance = cmd->device->host; 45 struct Scsi_Host *instance = cmd->device->host;
48 struct WD33C93_hostdata *hdata = shost_priv(instance); 46 struct WD33C93_hostdata *hdata = shost_priv(instance);
47 a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
49 unsigned short cntr = CNTR_PDMD | CNTR_INTEN; 48 unsigned short cntr = CNTR_PDMD | CNTR_INTEN;
50 unsigned long addr = virt_to_bus(cmd->SCp.ptr); 49 unsigned long addr = virt_to_bus(cmd->SCp.ptr);
51 50
@@ -87,10 +86,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
87 /* remember direction */ 86 /* remember direction */
88 hdata->dma_dir = dir_in; 87 hdata->dma_dir = dir_in;
89 88
90 DMA(cmd->device->host)->CNTR = cntr; 89 regs->CNTR = cntr;
91 90
92 /* setup DMA *physical* address */ 91 /* setup DMA *physical* address */
93 DMA(cmd->device->host)->ACR = addr; 92 regs->ACR = addr;
94 93
95 if (dir_in) { 94 if (dir_in) {
96 /* invalidate any cache */ 95 /* invalidate any cache */
@@ -100,7 +99,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
100 cache_push(addr, cmd->SCp.this_residual); 99 cache_push(addr, cmd->SCp.this_residual);
101 } 100 }
102 /* start DMA */ 101 /* start DMA */
103 DMA(cmd->device->host)->ST_DMA = 1; 102 regs->ST_DMA = 1;
104 103
105 /* return success */ 104 /* return success */
106 return 0; 105 return 0;
@@ -110,6 +109,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
110 int status) 109 int status)
111{ 110{
112 struct WD33C93_hostdata *hdata = shost_priv(instance); 111 struct WD33C93_hostdata *hdata = shost_priv(instance);
112 a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
113 113
114 /* disable SCSI interrupts */ 114 /* disable SCSI interrupts */
115 unsigned short cntr = CNTR_PDMD; 115 unsigned short cntr = CNTR_PDMD;
@@ -118,23 +118,23 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
118 cntr |= CNTR_DDIR; 118 cntr |= CNTR_DDIR;
119 119
120 /* disable SCSI interrupts */ 120 /* disable SCSI interrupts */
121 DMA(instance)->CNTR = cntr; 121 regs->CNTR = cntr;
122 122
123 /* flush if we were reading */ 123 /* flush if we were reading */
124 if (hdata->dma_dir) { 124 if (hdata->dma_dir) {
125 DMA(instance)->FLUSH = 1; 125 regs->FLUSH = 1;
126 while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) 126 while (!(regs->ISTR & ISTR_FE_FLG))
127 ; 127 ;
128 } 128 }
129 129
130 /* clear a possible interrupt */ 130 /* clear a possible interrupt */
131 DMA(instance)->CINT = 1; 131 regs->CINT = 1;
132 132
133 /* stop DMA */ 133 /* stop DMA */
134 DMA(instance)->SP_DMA = 1; 134 regs->SP_DMA = 1;
135 135
136 /* restore the CONTROL bits (minus the direction flag) */ 136 /* restore the CONTROL bits (minus the direction flag) */
137 DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; 137 regs->CNTR = CNTR_PDMD | CNTR_INTEN;
138 138
139 /* copy from a bounce buffer, if necessary */ 139 /* copy from a bounce buffer, if necessary */
140 if (status && hdata->dma_bounce_buffer) { 140 if (status && hdata->dma_bounce_buffer) {
@@ -153,7 +153,8 @@ static int __init a2091_detect(struct scsi_host_template *tpnt)
153 struct Scsi_Host *instance; 153 struct Scsi_Host *instance;
154 unsigned long address; 154 unsigned long address;
155 struct zorro_dev *z = NULL; 155 struct zorro_dev *z = NULL;
156 wd33c93_regs regs; 156 wd33c93_regs wdregs;
157 a2091_scsiregs *regs;
157 struct WD33C93_hostdata *hdata; 158 struct WD33C93_hostdata *hdata;
158 int num_a2091 = 0; 159 int num_a2091 = 0;
159 160
@@ -178,19 +179,20 @@ static int __init a2091_detect(struct scsi_host_template *tpnt)
178 instance->base = ZTWO_VADDR(address); 179 instance->base = ZTWO_VADDR(address);
179 instance->irq = IRQ_AMIGA_PORTS; 180 instance->irq = IRQ_AMIGA_PORTS;
180 instance->unique_id = z->slotaddr; 181 instance->unique_id = z->slotaddr;
181 DMA(instance)->DAWR = DAWR_A2091; 182 regs = (a2091_scsiregs *)(instance->base);
182 regs.SASR = &(DMA(instance)->SASR); 183 regs->DAWR = DAWR_A2091;
183 regs.SCMD = &(DMA(instance)->SCMD); 184 wdregs.SASR = &regs->SASR;
185 wdregs.SCMD = &regs->SCMD;
184 hdata = shost_priv(instance); 186 hdata = shost_priv(instance);
185 hdata->no_sync = 0xff; 187 hdata->no_sync = 0xff;
186 hdata->fast = 0; 188 hdata->fast = 0;
187 hdata->dma_mode = CTRL_DMA; 189 hdata->dma_mode = CTRL_DMA;
188 wd33c93_init(instance, regs, dma_setup, dma_stop, 190 wd33c93_init(instance, wdregs, dma_setup, dma_stop,
189 WD33C93_FS_8_10); 191 WD33C93_FS_8_10);
190 if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, 192 if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED,
191 "A2091 SCSI", instance)) 193 "A2091 SCSI", instance))
192 goto unregister; 194 goto unregister;
193 DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; 195 regs->CNTR = CNTR_PDMD | CNTR_INTEN;
194 num_a2091++; 196 num_a2091++;
195 continue; 197 continue;
196 198
@@ -241,7 +243,9 @@ static struct scsi_host_template driver_template = {
241static int a2091_release(struct Scsi_Host *instance) 243static int a2091_release(struct Scsi_Host *instance)
242{ 244{
243#ifdef MODULE 245#ifdef MODULE
244 DMA(instance)->CNTR = 0; 246 a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
247
248 regs->CNTR = 0;
245 release_mem_region(ZTWO_PADDR(instance->base), 256); 249 release_mem_region(ZTWO_PADDR(instance->base), 256);
246 free_irq(IRQ_AMIGA_PORTS, instance); 250 free_irq(IRQ_AMIGA_PORTS, instance);
247#endif 251#endif