|
@@ -22,17 +22,15 @@
|
|
#include <linux/stat.h>
|
|
#include <linux/stat.h>
|
|
|
|
|
|
|
|
|
|
-#define DMA(ptr) ((a2091_scsiregs *)((ptr)->base))
|
|
|
|
-
|
|
|
|
static int a2091_release(struct Scsi_Host *instance);
|
|
static int a2091_release(struct Scsi_Host *instance);
|
|
|
|
|
|
-static irqreturn_t a2091_intr(int irq, void *_instance)
|
|
|
|
|
|
+static irqreturn_t a2091_intr(int irq, void *data)
|
|
{
|
|
{
|
|
|
|
+ struct Scsi_Host *instance = data;
|
|
|
|
+ a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
|
|
|
|
+ unsigned int status = regs->ISTR;
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
- unsigned int status;
|
|
|
|
- struct Scsi_Host *instance = (struct Scsi_Host *)_instance;
|
|
|
|
|
|
|
|
- status = DMA(instance)->ISTR;
|
|
|
|
if (!(status & (ISTR_INT_F | ISTR_INT_P)) || !(status & ISTR_INTS))
|
|
if (!(status & (ISTR_INT_F | ISTR_INT_P)) || !(status & ISTR_INTS))
|
|
return IRQ_NONE;
|
|
return IRQ_NONE;
|
|
|
|
|
|
@@ -46,6 +44,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);
|
|
|
|
+ a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
|
|
unsigned short cntr = CNTR_PDMD | CNTR_INTEN;
|
|
unsigned short cntr = CNTR_PDMD | CNTR_INTEN;
|
|
unsigned long addr = virt_to_bus(cmd->SCp.ptr);
|
|
unsigned long addr = virt_to_bus(cmd->SCp.ptr);
|
|
|
|
|
|
@@ -87,10 +86,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
|
|
/* remember direction */
|
|
/* remember direction */
|
|
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 */
|
|
@@ -100,7 +99,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
|
|
cache_push(addr, cmd->SCp.this_residual);
|
|
cache_push(addr, cmd->SCp.this_residual);
|
|
}
|
|
}
|
|
/* start DMA */
|
|
/* start DMA */
|
|
- DMA(cmd->device->host)->ST_DMA = 1;
|
|
|
|
|
|
+ regs->ST_DMA = 1;
|
|
|
|
|
|
/* return success */
|
|
/* return success */
|
|
return 0;
|
|
return 0;
|
|
@@ -110,6 +109,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
|
|
int status)
|
|
int status)
|
|
{
|
|
{
|
|
struct WD33C93_hostdata *hdata = shost_priv(instance);
|
|
struct WD33C93_hostdata *hdata = shost_priv(instance);
|
|
|
|
+ a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
|
|
|
|
|
|
/* disable SCSI interrupts */
|
|
/* disable SCSI interrupts */
|
|
unsigned short cntr = CNTR_PDMD;
|
|
unsigned short cntr = CNTR_PDMD;
|
|
@@ -118,23 +118,23 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
|
|
cntr |= CNTR_DDIR;
|
|
cntr |= CNTR_DDIR;
|
|
|
|
|
|
/* disable SCSI interrupts */
|
|
/* disable SCSI interrupts */
|
|
- DMA(instance)->CNTR = cntr;
|
|
|
|
|
|
+ regs->CNTR = cntr;
|
|
|
|
|
|
/* flush if we were reading */
|
|
/* flush if we were reading */
|
|
if (hdata->dma_dir) {
|
|
if (hdata->dma_dir) {
|
|
- DMA(instance)->FLUSH = 1;
|
|
|
|
- while (!(DMA(instance)->ISTR & ISTR_FE_FLG))
|
|
|
|
|
|
+ regs->FLUSH = 1;
|
|
|
|
+ while (!(regs->ISTR & ISTR_FE_FLG))
|
|
;
|
|
;
|
|
}
|
|
}
|
|
|
|
|
|
/* clear a possible interrupt */
|
|
/* clear a possible interrupt */
|
|
- DMA(instance)->CINT = 1;
|
|
|
|
|
|
+ regs->CINT = 1;
|
|
|
|
|
|
/* stop DMA */
|
|
/* stop DMA */
|
|
- DMA(instance)->SP_DMA = 1;
|
|
|
|
|
|
+ regs->SP_DMA = 1;
|
|
|
|
|
|
/* restore the CONTROL bits (minus the direction flag) */
|
|
/* restore the CONTROL bits (minus the direction flag) */
|
|
- DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN;
|
|
|
|
|
|
+ regs->CNTR = CNTR_PDMD | CNTR_INTEN;
|
|
|
|
|
|
/* 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) {
|
|
@@ -153,7 +153,8 @@ static int __init a2091_detect(struct scsi_host_template *tpnt)
|
|
struct Scsi_Host *instance;
|
|
struct Scsi_Host *instance;
|
|
unsigned long address;
|
|
unsigned long address;
|
|
struct zorro_dev *z = NULL;
|
|
struct zorro_dev *z = NULL;
|
|
- wd33c93_regs regs;
|
|
|
|
|
|
+ wd33c93_regs wdregs;
|
|
|
|
+ a2091_scsiregs *regs;
|
|
struct WD33C93_hostdata *hdata;
|
|
struct WD33C93_hostdata *hdata;
|
|
int num_a2091 = 0;
|
|
int num_a2091 = 0;
|
|
|
|
|
|
@@ -178,19 +179,20 @@ static int __init a2091_detect(struct scsi_host_template *tpnt)
|
|
instance->base = ZTWO_VADDR(address);
|
|
instance->base = ZTWO_VADDR(address);
|
|
instance->irq = IRQ_AMIGA_PORTS;
|
|
instance->irq = IRQ_AMIGA_PORTS;
|
|
instance->unique_id = z->slotaddr;
|
|
instance->unique_id = z->slotaddr;
|
|
- DMA(instance)->DAWR = DAWR_A2091;
|
|
|
|
- regs.SASR = &(DMA(instance)->SASR);
|
|
|
|
- regs.SCMD = &(DMA(instance)->SCMD);
|
|
|
|
|
|
+ regs = (a2091_scsiregs *)(instance->base);
|
|
|
|
+ regs->DAWR = DAWR_A2091;
|
|
|
|
+ wdregs.SASR = ®s->SASR;
|
|
|
|
+ wdregs.SCMD = ®s->SCMD;
|
|
hdata = shost_priv(instance);
|
|
hdata = shost_priv(instance);
|
|
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,
|
|
WD33C93_FS_8_10);
|
|
WD33C93_FS_8_10);
|
|
if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED,
|
|
if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED,
|
|
"A2091 SCSI", instance))
|
|
"A2091 SCSI", instance))
|
|
goto unregister;
|
|
goto unregister;
|
|
- DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN;
|
|
|
|
|
|
+ regs->CNTR = CNTR_PDMD | CNTR_INTEN;
|
|
num_a2091++;
|
|
num_a2091++;
|
|
continue;
|
|
continue;
|
|
|
|
|
|
@@ -241,7 +243,9 @@ static struct scsi_host_template driver_template = {
|
|
static int a2091_release(struct Scsi_Host *instance)
|
|
static int a2091_release(struct Scsi_Host *instance)
|
|
{
|
|
{
|
|
#ifdef MODULE
|
|
#ifdef MODULE
|
|
- DMA(instance)->CNTR = 0;
|
|
|
|
|
|
+ a2091_scsiregs *regs = (a2091_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
|