a3000.c (d753722ee0223f80e6d0a553c68583c6ae57c1b2) a3000.c (a8169e6057e9b7dd41c9e3b7a41efebc4bd859c9)
1#include <linux/types.h>
2#include <linux/mm.h>
3#include <linux/slab.h>
4#include <linux/blkdev.h>
5#include <linux/ioport.h>
6#include <linux/init.h>
7#include <linux/spinlock.h>
8#include <linux/interrupt.h>

--- 8 unchanged lines hidden (view full) ---

17#include "scsi.h"
18#include <scsi/scsi_host.h>
19#include "wd33c93.h"
20#include "a3000.h"
21
22#include <linux/stat.h>
23
24
1#include <linux/types.h>
2#include <linux/mm.h>
3#include <linux/slab.h>
4#include <linux/blkdev.h>
5#include <linux/ioport.h>
6#include <linux/init.h>
7#include <linux/spinlock.h>
8#include <linux/interrupt.h>

--- 8 unchanged lines hidden (view full) ---

17#include "scsi.h"
18#include <scsi/scsi_host.h>
19#include "wd33c93.h"
20#include "a3000.h"
21
22#include <linux/stat.h>
23
24
25static struct Scsi_Host *a3000_host = NULL;
26
27static int a3000_release(struct Scsi_Host *instance);
28
25static int a3000_release(struct Scsi_Host *instance);
26
29static irqreturn_t a3000_intr(int irq, void *dummy)
27static irqreturn_t a3000_intr(int irq, void *data)
30{
28{
31 a3000_scsiregs *regs = (a3000_scsiregs *)(a3000_host->base);
29 struct Scsi_Host *instance = data;
30 a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base);
32 unsigned int status = regs->ISTR;
33 unsigned long flags;
34
35 if (!(status & ISTR_INT_P))
36 return IRQ_NONE;
37 if (status & ISTR_INTS) {
31 unsigned int status = regs->ISTR;
32 unsigned long flags;
33
34 if (!(status & ISTR_INT_P))
35 return IRQ_NONE;
36 if (status & ISTR_INTS) {
38 spin_lock_irqsave(a3000_host->host_lock, flags);
39 wd33c93_intr(a3000_host);
40 spin_unlock_irqrestore(a3000_host->host_lock, flags);
37 spin_lock_irqsave(instance->host_lock, flags);
38 wd33c93_intr(instance);
39 spin_unlock_irqrestore(instance->host_lock, flags);
41 return IRQ_HANDLED;
42 }
43 printk("Non-serviced A3000 SCSI-interrupt? ISTR = %02x\n", status);
44 return IRQ_NONE;
45}
46
47static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
48{
40 return IRQ_HANDLED;
41 }
42 printk("Non-serviced A3000 SCSI-interrupt? ISTR = %02x\n", status);
43 return IRQ_NONE;
44}
45
46static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
47{
49 struct WD33C93_hostdata *hdata = shost_priv(a3000_host);
50 a3000_scsiregs *regs = (a3000_scsiregs *)(a3000_host->base);
48 struct Scsi_Host *instance = cmd->device->host;
49 struct WD33C93_hostdata *hdata = shost_priv(instance);
50 a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base);
51 unsigned short cntr = CNTR_PDMD | CNTR_INTEN;
52 unsigned long addr = virt_to_bus(cmd->SCp.ptr);
53
54 /*
55 * if the physical address has the wrong alignment, or if
56 * physical address is bad, or if it is a write and at the
57 * end of a physical memory chunk, then allocate a bounce
58 * buffer

--- 100 unchanged lines hidden (view full) ---

159 hdata->dma_bounce_buffer = NULL;
160 hdata->dma_bounce_len = 0;
161 }
162 }
163}
164
165static int __init a3000_detect(struct scsi_host_template *tpnt)
166{
51 unsigned short cntr = CNTR_PDMD | CNTR_INTEN;
52 unsigned long addr = virt_to_bus(cmd->SCp.ptr);
53
54 /*
55 * if the physical address has the wrong alignment, or if
56 * physical address is bad, or if it is a write and at the
57 * end of a physical memory chunk, then allocate a bounce
58 * buffer

--- 100 unchanged lines hidden (view full) ---

159 hdata->dma_bounce_buffer = NULL;
160 hdata->dma_bounce_len = 0;
161 }
162 }
163}
164
165static int __init a3000_detect(struct scsi_host_template *tpnt)
166{
167 struct Scsi_Host *instance;
167 wd33c93_regs wdregs;
168 a3000_scsiregs *regs;
169 struct WD33C93_hostdata *hdata;
170
171 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI))
172 return 0;
173 if (!request_mem_region(0xDD0000, 256, "wd33c93"))
174 return 0;
175
176 tpnt->proc_name = "A3000";
177 tpnt->proc_info = &wd33c93_proc_info;
178
168 wd33c93_regs wdregs;
169 a3000_scsiregs *regs;
170 struct WD33C93_hostdata *hdata;
171
172 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI))
173 return 0;
174 if (!request_mem_region(0xDD0000, 256, "wd33c93"))
175 return 0;
176
177 tpnt->proc_name = "A3000";
178 tpnt->proc_info = &wd33c93_proc_info;
179
179 a3000_host = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
180 if (a3000_host == NULL)
180 instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
181 if (instance == NULL)
181 goto fail_register;
182
182 goto fail_register;
183
183 a3000_host->base = ZTWO_VADDR(0xDD0000);
184 a3000_host->irq = IRQ_AMIGA_PORTS;
185 regs = (a3000_scsiregs *)(a3000_host->base);
184 instance->base = ZTWO_VADDR(0xDD0000);
185 instance->irq = IRQ_AMIGA_PORTS;
186 regs = (a3000_scsiregs *)(instance->base);
186 regs->DAWR = DAWR_A3000;
187 wdregs.SASR = &regs->SASR;
188 wdregs.SCMD = &regs->SCMD;
187 regs->DAWR = DAWR_A3000;
188 wdregs.SASR = &regs->SASR;
189 wdregs.SCMD = &regs->SCMD;
189 hdata = shost_priv(a3000_host);
190 hdata = shost_priv(instance);
190 hdata->no_sync = 0xff;
191 hdata->fast = 0;
192 hdata->dma_mode = CTRL_DMA;
191 hdata->no_sync = 0xff;
192 hdata->fast = 0;
193 hdata->dma_mode = CTRL_DMA;
193 wd33c93_init(a3000_host, wdregs, dma_setup, dma_stop,
194 WD33C93_FS_12_15);
194 wd33c93_init(instance, wdregs, dma_setup, dma_stop, WD33C93_FS_12_15);
195 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",
196 a3000_intr))
196 instance))
197 goto fail_irq;
198 regs->CNTR = CNTR_PDMD | CNTR_INTEN;
199
200 return 1;
201
202fail_irq:
197 goto fail_irq;
198 regs->CNTR = CNTR_PDMD | CNTR_INTEN;
199
200 return 1;
201
202fail_irq:
203 scsi_unregister(a3000_host);
203 scsi_unregister(instance);
204fail_register:
205 release_mem_region(0xDD0000, 256);
206 return 0;
207}
208
209static int a3000_bus_reset(struct scsi_cmnd *cmd)
210{
211 /* FIXME perform bus-specific reset */

--- 43 unchanged lines hidden ---
204fail_register:
205 release_mem_region(0xDD0000, 256);
206 return 0;
207}
208
209static int a3000_bus_reset(struct scsi_cmnd *cmd)
210{
211 /* FIXME perform bus-specific reset */

--- 43 unchanged lines hidden ---