Commit 6869b15e authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

m68k/scsi: gvp11 - Kill ugly DMA() macro

Acked-by: default avatarJames Bottomley <James.Bottomley@suse.de>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent dd6c26a6
...@@ -22,15 +22,13 @@ ...@@ -22,15 +22,13 @@
#include <linux/stat.h> #include <linux/stat.h>
#define DMA(ptr) ((gvp11_scsiregs *)((ptr)->base)) static irqreturn_t gvp11_intr(int irq, void *data)
static irqreturn_t gvp11_intr(int irq, void *_instance)
{ {
struct Scsi_Host *instance = data;
gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base);
unsigned int status = regs->CNTR;
unsigned long flags; unsigned long flags;
unsigned int status;
struct Scsi_Host *instance = (struct Scsi_Host *)_instance;
status = DMA(instance)->CNTR;
if (!(status & GVP11_DMAC_INT_PENDING)) if (!(status & GVP11_DMAC_INT_PENDING))
return IRQ_NONE; return IRQ_NONE;
...@@ -51,6 +49,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) ...@@ -51,6 +49,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
{ {
struct Scsi_Host *instance = cmd->device->host; struct Scsi_Host *instance = cmd->device->host;
struct WD33C93_hostdata *hdata = shost_priv(instance); struct WD33C93_hostdata *hdata = shost_priv(instance);
gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base);
unsigned short cntr = GVP11_DMAC_INT_ENABLE; unsigned short cntr = GVP11_DMAC_INT_ENABLE;
unsigned long addr = virt_to_bus(cmd->SCp.ptr); unsigned long addr = virt_to_bus(cmd->SCp.ptr);
int bank_mask; int bank_mask;
...@@ -117,10 +116,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) ...@@ -117,10 +116,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
cntr |= GVP11_DMAC_DIR_WRITE; cntr |= GVP11_DMAC_DIR_WRITE;
hdata->dma_dir = dir_in; hdata->dma_dir = dir_in;
DMA(cmd->device->host)->CNTR = cntr; regs->CNTR = cntr;
/* setup DMA *physical* address */ /* setup DMA *physical* address */
DMA(cmd->device->host)->ACR = addr; regs->ACR = addr;
if (dir_in) { if (dir_in) {
/* invalidate any cache */ /* invalidate any cache */
...@@ -132,10 +131,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) ...@@ -132,10 +131,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
bank_mask = (~hdata->dma_xfer_mask >> 18) & 0x01c0; bank_mask = (~hdata->dma_xfer_mask >> 18) & 0x01c0;
if (bank_mask) if (bank_mask)
DMA(cmd->device->host)->BANK = bank_mask & (addr >> 18); regs->BANK = bank_mask & (addr >> 18);
/* start DMA */ /* start DMA */
DMA(cmd->device->host)->ST_DMA = 1; regs->ST_DMA = 1;
/* return success */ /* return success */
return 0; return 0;
...@@ -144,12 +143,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) ...@@ -144,12 +143,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
int status) int status)
{ {
gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base);
struct WD33C93_hostdata *hdata = shost_priv(instance); struct WD33C93_hostdata *hdata = shost_priv(instance);
/* stop DMA */ /* stop DMA */
DMA(instance)->SP_DMA = 1; regs->SP_DMA = 1;
/* remove write bit from CONTROL bits */ /* remove write bit from CONTROL bits */
DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; regs->CNTR = GVP11_DMAC_INT_ENABLE;
/* copy from a bounce buffer, if necessary */ /* copy from a bounce buffer, if necessary */
if (status && hdata->dma_bounce_buffer) { if (status && hdata->dma_bounce_buffer) {
...@@ -178,7 +178,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) ...@@ -178,7 +178,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
struct zorro_dev *z = NULL; struct zorro_dev *z = NULL;
unsigned int default_dma_xfer_mask; unsigned int default_dma_xfer_mask;
struct WD33C93_hostdata *hdata; struct WD33C93_hostdata *hdata;
wd33c93_regs regs; gvp11_scsiregs *regs;
wd33c93_regs wdregs;
int num_gvp11 = 0; int num_gvp11 = 0;
#ifdef CHECK_WD33C93 #ifdef CHECK_WD33C93
volatile unsigned char *sasr_3393, *scmd_3393; volatile unsigned char *sasr_3393, *scmd_3393;
...@@ -310,33 +311,34 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) ...@@ -310,33 +311,34 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
else else
hdata->dma_xfer_mask = default_dma_xfer_mask; hdata->dma_xfer_mask = default_dma_xfer_mask;
DMA(instance)->secret2 = 1; regs = (gvp11_scsiregs *)(instance->base);
DMA(instance)->secret1 = 0; regs->secret2 = 1;
DMA(instance)->secret3 = 15; regs->secret1 = 0;
while (DMA(instance)->CNTR & GVP11_DMAC_BUSY) regs->secret3 = 15;
while (regs->CNTR & GVP11_DMAC_BUSY)
; ;
DMA(instance)->CNTR = 0; regs->CNTR = 0;
DMA(instance)->BANK = 0; regs->BANK = 0;
epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000); epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000);
/* /*
* Check for 14MHz SCSI clock * Check for 14MHz SCSI clock
*/ */
regs.SASR = &(DMA(instance)->SASR); wdregs.SASR = &regs->SASR;
regs.SCMD = &(DMA(instance)->SCMD); wdregs.SCMD = &regs->SCMD;
hdata->no_sync = 0xff; hdata->no_sync = 0xff;
hdata->fast = 0; hdata->fast = 0;
hdata->dma_mode = CTRL_DMA; hdata->dma_mode = CTRL_DMA;
wd33c93_init(instance, regs, dma_setup, dma_stop, wd33c93_init(instance, wdregs, dma_setup, dma_stop,
(epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10
: WD33C93_FS_12_15); : WD33C93_FS_12_15);
if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED,
"GVP11 SCSI", instance)) "GVP11 SCSI", instance))
goto unregister; goto unregister;
DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; regs->CNTR = GVP11_DMAC_INT_ENABLE;
num_gvp11++; num_gvp11++;
continue; continue;
...@@ -391,7 +393,9 @@ static struct scsi_host_template driver_template = { ...@@ -391,7 +393,9 @@ static struct scsi_host_template driver_template = {
int gvp11_release(struct Scsi_Host *instance) int gvp11_release(struct Scsi_Host *instance)
{ {
#ifdef MODULE #ifdef MODULE
DMA(instance)->CNTR = 0; gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base);
regs->CNTR = 0;
release_mem_region(ZTWO_PADDR(instance->base), 256); release_mem_region(ZTWO_PADDR(instance->base), 256);
free_irq(IRQ_AMIGA_PORTS, instance); free_irq(IRQ_AMIGA_PORTS, instance);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment