aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/a3000.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2009-05-17 06:17:23 -0400
committerGeert Uytterhoeven <geert@linux-m68k.org>2010-05-26 13:51:06 -0400
commitd753722ee0223f80e6d0a553c68583c6ae57c1b2 (patch)
tree351912453e1ad8e4b26c879bbfea00eb4703be53 /drivers/scsi/a3000.c
parent6869b15efccce954a28d14c84b25350d125e2f93 (diff)
m68k/scsi: a3000 - 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/a3000.c')
-rw-r--r--drivers/scsi/a3000.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c
index bc6eb69f5fd0..ae9b25a3e3e7 100644
--- a/drivers/scsi/a3000.c
+++ b/drivers/scsi/a3000.c
@@ -22,16 +22,15 @@
22#include <linux/stat.h> 22#include <linux/stat.h>
23 23
24 24
25#define DMA(ptr) ((a3000_scsiregs *)((ptr)->base))
26
27static struct Scsi_Host *a3000_host = NULL; 25static struct Scsi_Host *a3000_host = NULL;
28 26
29static int a3000_release(struct Scsi_Host *instance); 27static int a3000_release(struct Scsi_Host *instance);
30 28
31static irqreturn_t a3000_intr(int irq, void *dummy) 29static irqreturn_t a3000_intr(int irq, void *dummy)
32{ 30{
31 a3000_scsiregs *regs = (a3000_scsiregs *)(a3000_host->base);
32 unsigned int status = regs->ISTR;
33 unsigned long flags; 33 unsigned long flags;
34 unsigned int status = DMA(a3000_host)->ISTR;
35 34
36 if (!(status & ISTR_INT_P)) 35 if (!(status & ISTR_INT_P))
37 return IRQ_NONE; 36 return IRQ_NONE;
@@ -48,6 +47,7 @@ static irqreturn_t a3000_intr(int irq, void *dummy)
48static int dma_setup(struct scsi_cmnd *cmd, int dir_in) 47static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
49{ 48{
50 struct WD33C93_hostdata *hdata = shost_priv(a3000_host); 49 struct WD33C93_hostdata *hdata = shost_priv(a3000_host);
50 a3000_scsiregs *regs = (a3000_scsiregs *)(a3000_host->base);
51 unsigned short cntr = CNTR_PDMD | CNTR_INTEN; 51 unsigned short cntr = CNTR_PDMD | CNTR_INTEN;
52 unsigned long addr = virt_to_bus(cmd->SCp.ptr); 52 unsigned long addr = virt_to_bus(cmd->SCp.ptr);
53 53
@@ -84,10 +84,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
84 /* remember direction */ 84 /* remember direction */
85 hdata->dma_dir = dir_in; 85 hdata->dma_dir = dir_in;
86 86
87 DMA(a3000_host)->CNTR = cntr; 87 regs->CNTR = cntr;
88 88
89 /* setup DMA *physical* address */ 89 /* setup DMA *physical* address */
90 DMA(a3000_host)->ACR = addr; 90 regs->ACR = addr;
91 91
92 if (dir_in) { 92 if (dir_in) {
93 /* invalidate any cache */ 93 /* invalidate any cache */
@@ -99,7 +99,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
99 99
100 /* start DMA */ 100 /* start DMA */
101 mb(); /* make sure setup is completed */ 101 mb(); /* make sure setup is completed */
102 DMA(a3000_host)->ST_DMA = 1; 102 regs->ST_DMA = 1;
103 mb(); /* make sure DMA has started before next IO */ 103 mb(); /* make sure DMA has started before next IO */
104 104
105 /* return success */ 105 /* return success */
@@ -110,6 +110,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
110 int status) 110 int status)
111{ 111{
112 struct WD33C93_hostdata *hdata = shost_priv(instance); 112 struct WD33C93_hostdata *hdata = shost_priv(instance);
113 a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base);
113 114
114 /* disable SCSI interrupts */ 115 /* disable SCSI interrupts */
115 unsigned short cntr = CNTR_PDMD; 116 unsigned short cntr = CNTR_PDMD;
@@ -117,14 +118,14 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
117 if (!hdata->dma_dir) 118 if (!hdata->dma_dir)
118 cntr |= CNTR_DDIR; 119 cntr |= CNTR_DDIR;
119 120
120 DMA(instance)->CNTR = cntr; 121 regs->CNTR = cntr;
121 mb(); /* make sure CNTR is updated before next IO */ 122 mb(); /* make sure CNTR is updated before next IO */
122 123
123 /* flush if we were reading */ 124 /* flush if we were reading */
124 if (hdata->dma_dir) { 125 if (hdata->dma_dir) {
125 DMA(instance)->FLUSH = 1; 126 regs->FLUSH = 1;
126 mb(); /* don't allow prefetch */ 127 mb(); /* don't allow prefetch */
127 while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) 128 while (!(regs->ISTR & ISTR_FE_FLG))
128 barrier(); 129 barrier();
129 mb(); /* no IO until FLUSH is done */ 130 mb(); /* no IO until FLUSH is done */
130 } 131 }
@@ -133,14 +134,14 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
133 /* I think that this CINT is only necessary if you are 134 /* I think that this CINT is only necessary if you are
134 * using the terminal count features. HM 7 Mar 1994 135 * using the terminal count features. HM 7 Mar 1994
135 */ 136 */
136 DMA(instance)->CINT = 1; 137 regs->CINT = 1;
137 138
138 /* stop DMA */ 139 /* stop DMA */
139 DMA(instance)->SP_DMA = 1; 140 regs->SP_DMA = 1;
140 mb(); /* make sure DMA is stopped before next IO */ 141 mb(); /* make sure DMA is stopped before next IO */
141 142
142 /* restore the CONTROL bits (minus the direction flag) */ 143 /* restore the CONTROL bits (minus the direction flag) */
143 DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; 144 regs->CNTR = CNTR_PDMD | CNTR_INTEN;
144 mb(); /* make sure CNTR is updated before next IO */ 145 mb(); /* make sure CNTR is updated before next IO */
145 146
146 /* copy from a bounce buffer, if necessary */ 147 /* copy from a bounce buffer, if necessary */
@@ -163,7 +164,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
163 164
164static int __init a3000_detect(struct scsi_host_template *tpnt) 165static int __init a3000_detect(struct scsi_host_template *tpnt)
165{ 166{
166 wd33c93_regs regs; 167 wd33c93_regs wdregs;
168 a3000_scsiregs *regs;
167 struct WD33C93_hostdata *hdata; 169 struct WD33C93_hostdata *hdata;
168 170
169 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) 171 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI))
@@ -180,18 +182,20 @@ static int __init a3000_detect(struct scsi_host_template *tpnt)
180 182
181 a3000_host->base = ZTWO_VADDR(0xDD0000); 183 a3000_host->base = ZTWO_VADDR(0xDD0000);
182 a3000_host->irq = IRQ_AMIGA_PORTS; 184 a3000_host->irq = IRQ_AMIGA_PORTS;
183 DMA(a3000_host)->DAWR = DAWR_A3000; 185 regs = (a3000_scsiregs *)(a3000_host->base);
184 regs.SASR = &(DMA(a3000_host)->SASR); 186 regs->DAWR = DAWR_A3000;
185 regs.SCMD = &(DMA(a3000_host)->SCMD); 187 wdregs.SASR = &regs->SASR;
188 wdregs.SCMD = &regs->SCMD;
186 hdata = shost_priv(a3000_host); 189 hdata = shost_priv(a3000_host);
187 hdata->no_sync = 0xff; 190 hdata->no_sync = 0xff;
188 hdata->fast = 0; 191 hdata->fast = 0;
189 hdata->dma_mode = CTRL_DMA; 192 hdata->dma_mode = CTRL_DMA;
190 wd33c93_init(a3000_host, regs, dma_setup, dma_stop, WD33C93_FS_12_15); 193 wd33c93_init(a3000_host, wdregs, dma_setup, dma_stop,
194 WD33C93_FS_12_15);
191 if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, "A3000 SCSI", 195 if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, "A3000 SCSI",
192 a3000_intr)) 196 a3000_intr))
193 goto fail_irq; 197 goto fail_irq;
194 DMA(a3000_host)->CNTR = CNTR_PDMD | CNTR_INTEN; 198 regs->CNTR = CNTR_PDMD | CNTR_INTEN;
195 199
196 return 1; 200 return 1;
197 201
@@ -239,7 +243,9 @@ static struct scsi_host_template driver_template = {
239 243
240static int a3000_release(struct Scsi_Host *instance) 244static int a3000_release(struct Scsi_Host *instance)
241{ 245{
242 DMA(instance)->CNTR = 0; 246 a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base);
247
248 regs->CNTR = 0;
243 release_mem_region(0xDD0000, 256); 249 release_mem_region(0xDD0000, 256);
244 free_irq(IRQ_AMIGA_PORTS, a3000_intr); 250 free_irq(IRQ_AMIGA_PORTS, a3000_intr);
245 return 1; 251 return 1;