blob: 874cbee1be230e17b357337ac8b529cb8cc0fb62 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#include <linux/types.h>
2#include <linux/mm.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +09003#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <linux/blkdev.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <linux/init.h>
6#include <linux/interrupt.h>
7
8#include <asm/setup.h>
9#include <asm/page.h>
10#include <asm/pgtable.h>
11#include <asm/amigaints.h>
12#include <asm/amigahw.h>
13#include <linux/zorro.h>
14#include <asm/irq.h>
15#include <linux/spinlock.h>
16
17#include "scsi.h"
18#include <scsi/scsi_host.h>
19#include "wd33c93.h"
20#include "gvp11.h"
21
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020022#include <linux/stat.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Geert Uytterhoeven11ca46e2009-05-17 20:44:16 +020025#define CHECK_WD33C93
26
Geert Uytterhoeven6869b152009-05-17 12:17:28 +020027static irqreturn_t gvp11_intr(int irq, void *data)
Linus Torvalds1da177e2005-04-16 15:20:36 -070028{
Geert Uytterhoeven6869b152009-05-17 12:17:28 +020029 struct Scsi_Host *instance = data;
Geert Uytterhoeven349d65f2009-05-17 21:05:55 +020030 struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base);
Geert Uytterhoeven6869b152009-05-17 12:17:28 +020031 unsigned int status = regs->CNTR;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020032 unsigned long flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020034 if (!(status & GVP11_DMAC_INT_PENDING))
35 return IRQ_NONE;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020037 spin_lock_irqsave(instance->host_lock, flags);
38 wd33c93_intr(instance);
39 spin_unlock_irqrestore(instance->host_lock, flags);
40 return IRQ_HANDLED;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041}
42
43static int gvp11_xfer_mask = 0;
44
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020045void gvp11_setup(char *str, int *ints)
Linus Torvalds1da177e2005-04-16 15:20:36 -070046{
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020047 gvp11_xfer_mask = ints[1];
Linus Torvalds1da177e2005-04-16 15:20:36 -070048}
49
Henrik Kretzschmar65396412006-09-12 23:49:33 +020050static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
Linus Torvalds1da177e2005-04-16 15:20:36 -070051{
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020052 struct Scsi_Host *instance = cmd->device->host;
53 struct WD33C93_hostdata *hdata = shost_priv(instance);
Geert Uytterhoeven349d65f2009-05-17 21:05:55 +020054 struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020055 unsigned short cntr = GVP11_DMAC_INT_ENABLE;
56 unsigned long addr = virt_to_bus(cmd->SCp.ptr);
57 int bank_mask;
58 static int scsi_alloc_out_of_range = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020060 /* use bounce buffer if the physical address is bad */
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020061 if (addr & hdata->dma_xfer_mask) {
62 hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff;
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020064 if (!scsi_alloc_out_of_range) {
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020065 hdata->dma_bounce_buffer =
66 kmalloc(hdata->dma_bounce_len, GFP_KERNEL);
67 hdata->dma_buffer_pool = BUF_SCSI_ALLOCED;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020068 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020070 if (scsi_alloc_out_of_range ||
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020071 !hdata->dma_bounce_buffer) {
72 hdata->dma_bounce_buffer =
73 amiga_chip_alloc(hdata->dma_bounce_len,
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020074 "GVP II SCSI Bounce Buffer");
75
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020076 if (!hdata->dma_bounce_buffer) {
77 hdata->dma_bounce_len = 0;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020078 return 1;
79 }
80
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020081 hdata->dma_buffer_pool = BUF_CHIP_ALLOCED;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020082 }
83
84 /* check if the address of the bounce buffer is OK */
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020085 addr = virt_to_bus(hdata->dma_bounce_buffer);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020086
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020087 if (addr & hdata->dma_xfer_mask) {
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020088 /* fall back to Chip RAM if address out of range */
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020089 if (hdata->dma_buffer_pool == BUF_SCSI_ALLOCED) {
90 kfree(hdata->dma_bounce_buffer);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020091 scsi_alloc_out_of_range = 1;
92 } else {
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020093 amiga_chip_free(hdata->dma_bounce_buffer);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020094 }
95
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +020096 hdata->dma_bounce_buffer =
97 amiga_chip_alloc(hdata->dma_bounce_len,
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020098 "GVP II SCSI Bounce Buffer");
99
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200100 if (!hdata->dma_bounce_buffer) {
101 hdata->dma_bounce_len = 0;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200102 return 1;
103 }
104
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200105 addr = virt_to_bus(hdata->dma_bounce_buffer);
106 hdata->dma_buffer_pool = BUF_CHIP_ALLOCED;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200107 }
108
109 if (!dir_in) {
110 /* copy to bounce buffer for a write */
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200111 memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr,
112 cmd->SCp.this_residual);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200113 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 }
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200115
116 /* setup dma direction */
117 if (!dir_in)
118 cntr |= GVP11_DMAC_DIR_WRITE;
119
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200120 hdata->dma_dir = dir_in;
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200121 regs->CNTR = cntr;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200122
123 /* setup DMA *physical* address */
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200124 regs->ACR = addr;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200125
126 if (dir_in) {
127 /* invalidate any cache */
128 cache_clear(addr, cmd->SCp.this_residual);
129 } else {
130 /* push any dirty cache */
131 cache_push(addr, cmd->SCp.this_residual);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200134 bank_mask = (~hdata->dma_xfer_mask >> 18) & 0x01c0;
135 if (bank_mask)
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200136 regs->BANK = bank_mask & (addr >> 18);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200138 /* start DMA */
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200139 regs->ST_DMA = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200141 /* return success */
142 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143}
144
Henrik Kretzschmar65396412006-09-12 23:49:33 +0200145static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
146 int status)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147{
Geert Uytterhoeven349d65f2009-05-17 21:05:55 +0200148 struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base);
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200149 struct WD33C93_hostdata *hdata = shost_priv(instance);
150
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200151 /* stop DMA */
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200152 regs->SP_DMA = 1;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200153 /* remove write bit from CONTROL bits */
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200154 regs->CNTR = GVP11_DMAC_INT_ENABLE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200156 /* copy from a bounce buffer, if necessary */
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200157 if (status && hdata->dma_bounce_buffer) {
158 if (hdata->dma_dir && SCpnt)
159 memcpy(SCpnt->SCp.ptr, hdata->dma_bounce_buffer,
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200160 SCpnt->SCp.this_residual);
161
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200162 if (hdata->dma_buffer_pool == BUF_SCSI_ALLOCED)
163 kfree(hdata->dma_bounce_buffer);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200164 else
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200165 amiga_chip_free(hdata->dma_bounce_buffer);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200166
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200167 hdata->dma_bounce_buffer = NULL;
168 hdata->dma_bounce_len = 0;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200169 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170}
171
Geert Uytterhoeven349d65f2009-05-17 21:05:55 +0200172static int __init check_wd33c93(struct gvp11_scsiregs *regs)
Geert Uytterhoeven11ca46e2009-05-17 20:44:16 +0200173{
174#ifdef CHECK_WD33C93
175 volatile unsigned char *sasr_3393, *scmd_3393;
176 unsigned char save_sasr;
177 unsigned char q, qq;
178
179 /*
180 * These darn GVP boards are a problem - it can be tough to tell
181 * whether or not they include a SCSI controller. This is the
182 * ultimate Yet-Another-GVP-Detection-Hack in that it actually
183 * probes for a WD33c93 chip: If we find one, it's extremely
184 * likely that this card supports SCSI, regardless of Product_
185 * Code, Board_Size, etc.
186 */
187
188 /* Get pointers to the presumed register locations and save contents */
189
190 sasr_3393 = &regs->SASR;
191 scmd_3393 = &regs->SCMD;
192 save_sasr = *sasr_3393;
193
194 /* First test the AuxStatus Reg */
195
196 q = *sasr_3393; /* read it */
197 if (q & 0x08) /* bit 3 should always be clear */
198 return -ENODEV;
199 *sasr_3393 = WD_AUXILIARY_STATUS; /* setup indirect address */
200 if (*sasr_3393 == WD_AUXILIARY_STATUS) { /* shouldn't retain the write */
201 *sasr_3393 = save_sasr; /* Oops - restore this byte */
202 return -ENODEV;
203 }
204 if (*sasr_3393 != q) { /* should still read the same */
205 *sasr_3393 = save_sasr; /* Oops - restore this byte */
206 return -ENODEV;
207 }
208 if (*scmd_3393 != q) /* and so should the image at 0x1f */
209 return -ENODEV;
210
211 /*
212 * Ok, we probably have a wd33c93, but let's check a few other places
213 * for good measure. Make sure that this works for both 'A and 'B
214 * chip versions.
215 */
216
217 *sasr_3393 = WD_SCSI_STATUS;
218 q = *scmd_3393;
219 *sasr_3393 = WD_SCSI_STATUS;
220 *scmd_3393 = ~q;
221 *sasr_3393 = WD_SCSI_STATUS;
222 qq = *scmd_3393;
223 *sasr_3393 = WD_SCSI_STATUS;
224 *scmd_3393 = q;
225 if (qq != q) /* should be read only */
226 return -ENODEV;
227 *sasr_3393 = 0x1e; /* this register is unimplemented */
228 q = *scmd_3393;
229 *sasr_3393 = 0x1e;
230 *scmd_3393 = ~q;
231 *sasr_3393 = 0x1e;
232 qq = *scmd_3393;
233 *sasr_3393 = 0x1e;
234 *scmd_3393 = q;
235 if (qq != q || qq != 0xff) /* should be read only, all 1's */
236 return -ENODEV;
237 *sasr_3393 = WD_TIMEOUT_PERIOD;
238 q = *scmd_3393;
239 *sasr_3393 = WD_TIMEOUT_PERIOD;
240 *scmd_3393 = ~q;
241 *sasr_3393 = WD_TIMEOUT_PERIOD;
242 qq = *scmd_3393;
243 *sasr_3393 = WD_TIMEOUT_PERIOD;
244 *scmd_3393 = q;
245 if (qq != (~q & 0xff)) /* should be read/write */
246 return -ENODEV;
247#endif /* CHECK_WD33C93 */
248
249 return 0;
250}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251
Christoph Hellwigd0be4a7d2005-10-31 18:31:40 +0100252int __init gvp11_detect(struct scsi_host_template *tpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253{
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200254 static unsigned char called = 0;
255 struct Scsi_Host *instance;
256 unsigned long address;
257 unsigned int epc;
258 struct zorro_dev *z = NULL;
259 unsigned int default_dma_xfer_mask;
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200260 struct WD33C93_hostdata *hdata;
Geert Uytterhoeven349d65f2009-05-17 21:05:55 +0200261 struct gvp11_scsiregs *regs;
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200262 wd33c93_regs wdregs;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200263 int num_gvp11 = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200265 if (!MACH_IS_AMIGA || called)
266 return 0;
267 called = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200269 tpnt->proc_name = "GVP11";
270 tpnt->proc_info = &wd33c93_proc_info;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200272 while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
273 /*
274 * This should (hopefully) be the correct way to identify
275 * all the different GVP SCSI controllers (except for the
276 * SERIES I though).
277 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200279 if (z->id == ZORRO_PROD_GVP_COMBO_030_R3_SCSI ||
280 z->id == ZORRO_PROD_GVP_SERIES_II)
281 default_dma_xfer_mask = ~0x00ffffff;
282 else if (z->id == ZORRO_PROD_GVP_GFORCE_030_SCSI ||
283 z->id == ZORRO_PROD_GVP_A530_SCSI ||
284 z->id == ZORRO_PROD_GVP_COMBO_030_R4_SCSI)
285 default_dma_xfer_mask = ~0x01ffffff;
286 else if (z->id == ZORRO_PROD_GVP_A1291 ||
287 z->id == ZORRO_PROD_GVP_GFORCE_040_SCSI_1)
288 default_dma_xfer_mask = ~0x07ffffff;
289 else
290 continue;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200292 /*
293 * Rumors state that some GVP ram boards use the same product
294 * code as the SCSI controllers. Therefore if the board-size
295 * is not 64KB we asume it is a ram board and bail out.
296 */
297 if (z->resource.end - z->resource.start != 0xffff)
298 continue;
299
300 address = z->resource.start;
301 if (!request_mem_region(address, 256, "wd33c93"))
302 continue;
303
Geert Uytterhoeven349d65f2009-05-17 21:05:55 +0200304 regs = (struct gvp11_scsiregs *)(ZTWO_VADDR(address));
Geert Uytterhoeven11ca46e2009-05-17 20:44:16 +0200305 if (check_wd33c93(regs))
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200306 goto release;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200307
308 instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
309 if (instance == NULL)
310 goto release;
311 instance->base = ZTWO_VADDR(address);
312 instance->irq = IRQ_AMIGA_PORTS;
313 instance->unique_id = z->slotaddr;
314
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200315 hdata = shost_priv(instance);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200316 if (gvp11_xfer_mask)
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200317 hdata->dma_xfer_mask = gvp11_xfer_mask;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200318 else
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200319 hdata->dma_xfer_mask = default_dma_xfer_mask;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200320
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200321 regs->secret2 = 1;
322 regs->secret1 = 0;
323 regs->secret3 = 15;
324 while (regs->CNTR & GVP11_DMAC_BUSY)
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200325 ;
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200326 regs->CNTR = 0;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200327
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200328 regs->BANK = 0;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200329
330 epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000);
331
332 /*
333 * Check for 14MHz SCSI clock
334 */
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200335 wdregs.SASR = &regs->SASR;
336 wdregs.SCMD = &regs->SCMD;
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200337 hdata->no_sync = 0xff;
338 hdata->fast = 0;
339 hdata->dma_mode = CTRL_DMA;
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200340 wd33c93_init(instance, wdregs, dma_setup, dma_stop,
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200341 (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10
342 : WD33C93_FS_12_15);
343
344 if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED,
345 "GVP11 SCSI", instance))
346 goto unregister;
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200347 regs->CNTR = GVP11_DMAC_INT_ENABLE;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200348 num_gvp11++;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349 continue;
350
Geert Uytterhoevend38f47a2009-01-02 11:41:24 +0100351unregister:
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200352 scsi_unregister(instance);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353release:
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200354 release_mem_region(address, 256);
355 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200357 return num_gvp11;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358}
359
Henrik Kretzschmar65396412006-09-12 23:49:33 +0200360static int gvp11_bus_reset(struct scsi_cmnd *cmd)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361{
362 /* FIXME perform bus-specific reset */
Jeff Garzik 68b3aa72005-05-28 07:56:31 -0400363
Jeff Garzik df0ae242005-05-28 07:57:14 -0400364 /* FIXME 2: shouldn't we no-op this function (return
365 FAILED), and fall back to host reset function,
366 wd33c93_host_reset ? */
367
Jeff Garzik 68b3aa72005-05-28 07:56:31 -0400368 spin_lock_irq(cmd->device->host->host_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369 wd33c93_host_reset(cmd);
Jeff Garzik 68b3aa72005-05-28 07:56:31 -0400370 spin_unlock_irq(cmd->device->host->host_lock);
371
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372 return SUCCESS;
373}
374
375
376#define HOSTS_C
377
378#include "gvp11.h"
379
Christoph Hellwigd0be4a7d2005-10-31 18:31:40 +0100380static struct scsi_host_template driver_template = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381 .proc_name = "GVP11",
382 .name = "GVP Series II SCSI",
383 .detect = gvp11_detect,
384 .release = gvp11_release,
385 .queuecommand = wd33c93_queuecommand,
386 .eh_abort_handler = wd33c93_abort,
387 .eh_bus_reset_handler = gvp11_bus_reset,
388 .eh_host_reset_handler = wd33c93_host_reset,
389 .can_queue = CAN_QUEUE,
390 .this_id = 7,
391 .sg_tablesize = SG_ALL,
392 .cmd_per_lun = CMD_PER_LUN,
393 .use_clustering = DISABLE_CLUSTERING
394};
395
396
397#include "scsi_module.c"
398
399int gvp11_release(struct Scsi_Host *instance)
400{
401#ifdef MODULE
Geert Uytterhoeven349d65f2009-05-17 21:05:55 +0200402 struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base);
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200403
404 regs->CNTR = 0;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200405 release_mem_region(ZTWO_PADDR(instance->base), 256);
406 free_irq(IRQ_AMIGA_PORTS, instance);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407#endif
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200408 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409}
410
411MODULE_LICENSE("GPL");