blob: dbe4cc6b9f8b75be0823653fb05dd8e15e279cc9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#include <linux/init.h>
3#include <linux/interrupt.h>
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +02004#include <linux/mm.h>
5#include <linux/slab.h>
6#include <linux/spinlock.h>
7#include <linux/zorro.h>
Paul Gortmakeracf3368f2011-05-27 09:47:43 -04008#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <asm/page.h>
11#include <asm/pgtable.h>
12#include <asm/amigaints.h>
13#include <asm/amigahw.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
15#include "scsi.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include "wd33c93.h"
17#include "gvp11.h"
18
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Geert Uytterhoeven11ca46e2009-05-17 20:44:16 +020020#define CHECK_WD33C93
21
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020022struct gvp11_hostdata {
23 struct WD33C93_hostdata wh;
24 struct gvp11_scsiregs *regs;
25};
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 Uytterhoevencf2ed272010-04-12 21:55:25 +020030 struct gvp11_hostdata *hdata = shost_priv(instance);
31 unsigned int status = hdata->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;
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020053 struct gvp11_hostdata *hdata = shost_priv(instance);
54 struct WD33C93_hostdata *wh = &hdata->wh;
55 struct gvp11_scsiregs *regs = hdata->regs;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020056 unsigned short cntr = GVP11_DMAC_INT_ENABLE;
57 unsigned long addr = virt_to_bus(cmd->SCp.ptr);
58 int bank_mask;
59 static int scsi_alloc_out_of_range = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020061 /* use bounce buffer if the physical address is bad */
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020062 if (addr & wh->dma_xfer_mask) {
63 wh->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff;
Linus Torvalds1da177e2005-04-16 15:20:36 -070064
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020065 if (!scsi_alloc_out_of_range) {
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020066 wh->dma_bounce_buffer =
67 kmalloc(wh->dma_bounce_len, GFP_KERNEL);
68 wh->dma_buffer_pool = BUF_SCSI_ALLOCED;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020069 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020071 if (scsi_alloc_out_of_range ||
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020072 !wh->dma_bounce_buffer) {
73 wh->dma_bounce_buffer =
74 amiga_chip_alloc(wh->dma_bounce_len,
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020075 "GVP II SCSI Bounce Buffer");
76
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020077 if (!wh->dma_bounce_buffer) {
78 wh->dma_bounce_len = 0;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020079 return 1;
80 }
81
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020082 wh->dma_buffer_pool = BUF_CHIP_ALLOCED;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020083 }
84
85 /* check if the address of the bounce buffer is OK */
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020086 addr = virt_to_bus(wh->dma_bounce_buffer);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020087
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020088 if (addr & wh->dma_xfer_mask) {
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020089 /* fall back to Chip RAM if address out of range */
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020090 if (wh->dma_buffer_pool == BUF_SCSI_ALLOCED) {
91 kfree(wh->dma_bounce_buffer);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020092 scsi_alloc_out_of_range = 1;
93 } else {
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020094 amiga_chip_free(wh->dma_bounce_buffer);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020095 }
96
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +020097 wh->dma_bounce_buffer =
98 amiga_chip_alloc(wh->dma_bounce_len,
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +020099 "GVP II SCSI Bounce Buffer");
100
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200101 if (!wh->dma_bounce_buffer) {
102 wh->dma_bounce_len = 0;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200103 return 1;
104 }
105
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200106 addr = virt_to_bus(wh->dma_bounce_buffer);
107 wh->dma_buffer_pool = BUF_CHIP_ALLOCED;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200108 }
109
110 if (!dir_in) {
111 /* copy to bounce buffer for a write */
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200112 memcpy(wh->dma_bounce_buffer, cmd->SCp.ptr,
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200113 cmd->SCp.this_residual);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200114 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 }
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200116
117 /* setup dma direction */
118 if (!dir_in)
119 cntr |= GVP11_DMAC_DIR_WRITE;
120
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200121 wh->dma_dir = dir_in;
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200122 regs->CNTR = cntr;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200123
124 /* setup DMA *physical* address */
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200125 regs->ACR = addr;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200126
127 if (dir_in) {
128 /* invalidate any cache */
129 cache_clear(addr, cmd->SCp.this_residual);
130 } else {
131 /* push any dirty cache */
132 cache_push(addr, cmd->SCp.this_residual);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200135 bank_mask = (~wh->dma_xfer_mask >> 18) & 0x01c0;
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200136 if (bank_mask)
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200137 regs->BANK = bank_mask & (addr >> 18);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200139 /* start DMA */
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200140 regs->ST_DMA = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200142 /* return success */
143 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144}
145
Henrik Kretzschmar65396412006-09-12 23:49:33 +0200146static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
147 int status)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148{
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200149 struct gvp11_hostdata *hdata = shost_priv(instance);
150 struct WD33C93_hostdata *wh = &hdata->wh;
151 struct gvp11_scsiregs *regs = hdata->regs;
Geert Uytterhoeven52c3d8a2010-04-04 11:00:37 +0200152
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200153 /* stop DMA */
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200154 regs->SP_DMA = 1;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200155 /* remove write bit from CONTROL bits */
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200156 regs->CNTR = GVP11_DMAC_INT_ENABLE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200158 /* copy from a bounce buffer, if necessary */
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200159 if (status && wh->dma_bounce_buffer) {
160 if (wh->dma_dir && SCpnt)
161 memcpy(SCpnt->SCp.ptr, wh->dma_bounce_buffer,
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200162 SCpnt->SCp.this_residual);
163
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200164 if (wh->dma_buffer_pool == BUF_SCSI_ALLOCED)
165 kfree(wh->dma_bounce_buffer);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200166 else
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200167 amiga_chip_free(wh->dma_bounce_buffer);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200168
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200169 wh->dma_bounce_buffer = NULL;
170 wh->dma_bounce_len = 0;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200171 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172}
173
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200174static int gvp11_bus_reset(struct scsi_cmnd *cmd)
175{
176 struct Scsi_Host *instance = cmd->device->host;
177
178 /* FIXME perform bus-specific reset */
179
180 /* FIXME 2: shouldn't we no-op this function (return
181 FAILED), and fall back to host reset function,
182 wd33c93_host_reset ? */
183
184 spin_lock_irq(instance->host_lock);
185 wd33c93_host_reset(cmd);
186 spin_unlock_irq(instance->host_lock);
187
188 return SUCCESS;
189}
190
191static struct scsi_host_template gvp11_scsi_template = {
192 .module = THIS_MODULE,
193 .name = "GVP Series II SCSI",
194 .proc_info = wd33c93_proc_info,
195 .proc_name = "GVP11",
196 .queuecommand = wd33c93_queuecommand,
197 .eh_abort_handler = wd33c93_abort,
198 .eh_bus_reset_handler = gvp11_bus_reset,
199 .eh_host_reset_handler = wd33c93_host_reset,
200 .can_queue = CAN_QUEUE,
201 .this_id = 7,
202 .sg_tablesize = SG_ALL,
203 .cmd_per_lun = CMD_PER_LUN,
204 .use_clustering = DISABLE_CLUSTERING
205};
206
Greg Kroah-Hartman6f039792012-12-21 13:08:55 -0800207static int check_wd33c93(struct gvp11_scsiregs *regs)
Geert Uytterhoeven11ca46e2009-05-17 20:44:16 +0200208{
209#ifdef CHECK_WD33C93
210 volatile unsigned char *sasr_3393, *scmd_3393;
211 unsigned char save_sasr;
212 unsigned char q, qq;
213
214 /*
215 * These darn GVP boards are a problem - it can be tough to tell
216 * whether or not they include a SCSI controller. This is the
217 * ultimate Yet-Another-GVP-Detection-Hack in that it actually
218 * probes for a WD33c93 chip: If we find one, it's extremely
219 * likely that this card supports SCSI, regardless of Product_
220 * Code, Board_Size, etc.
221 */
222
223 /* Get pointers to the presumed register locations and save contents */
224
225 sasr_3393 = &regs->SASR;
226 scmd_3393 = &regs->SCMD;
227 save_sasr = *sasr_3393;
228
229 /* First test the AuxStatus Reg */
230
231 q = *sasr_3393; /* read it */
232 if (q & 0x08) /* bit 3 should always be clear */
233 return -ENODEV;
234 *sasr_3393 = WD_AUXILIARY_STATUS; /* setup indirect address */
235 if (*sasr_3393 == WD_AUXILIARY_STATUS) { /* shouldn't retain the write */
236 *sasr_3393 = save_sasr; /* Oops - restore this byte */
237 return -ENODEV;
238 }
239 if (*sasr_3393 != q) { /* should still read the same */
240 *sasr_3393 = save_sasr; /* Oops - restore this byte */
241 return -ENODEV;
242 }
243 if (*scmd_3393 != q) /* and so should the image at 0x1f */
244 return -ENODEV;
245
246 /*
247 * Ok, we probably have a wd33c93, but let's check a few other places
248 * for good measure. Make sure that this works for both 'A and 'B
249 * chip versions.
250 */
251
252 *sasr_3393 = WD_SCSI_STATUS;
253 q = *scmd_3393;
254 *sasr_3393 = WD_SCSI_STATUS;
255 *scmd_3393 = ~q;
256 *sasr_3393 = WD_SCSI_STATUS;
257 qq = *scmd_3393;
258 *sasr_3393 = WD_SCSI_STATUS;
259 *scmd_3393 = q;
260 if (qq != q) /* should be read only */
261 return -ENODEV;
262 *sasr_3393 = 0x1e; /* this register is unimplemented */
263 q = *scmd_3393;
264 *sasr_3393 = 0x1e;
265 *scmd_3393 = ~q;
266 *sasr_3393 = 0x1e;
267 qq = *scmd_3393;
268 *sasr_3393 = 0x1e;
269 *scmd_3393 = q;
270 if (qq != q || qq != 0xff) /* should be read only, all 1's */
271 return -ENODEV;
272 *sasr_3393 = WD_TIMEOUT_PERIOD;
273 q = *scmd_3393;
274 *sasr_3393 = WD_TIMEOUT_PERIOD;
275 *scmd_3393 = ~q;
276 *sasr_3393 = WD_TIMEOUT_PERIOD;
277 qq = *scmd_3393;
278 *sasr_3393 = WD_TIMEOUT_PERIOD;
279 *scmd_3393 = q;
280 if (qq != (~q & 0xff)) /* should be read/write */
281 return -ENODEV;
282#endif /* CHECK_WD33C93 */
283
284 return 0;
285}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286
Greg Kroah-Hartman6f039792012-12-21 13:08:55 -0800287static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288{
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200289 struct Scsi_Host *instance;
290 unsigned long address;
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200291 int error;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200292 unsigned int epc;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200293 unsigned int default_dma_xfer_mask;
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200294 struct gvp11_hostdata *hdata;
Geert Uytterhoeven349d65f2009-05-17 21:05:55 +0200295 struct gvp11_scsiregs *regs;
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200296 wd33c93_regs wdregs;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200298 default_dma_xfer_mask = ent->driver_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200300 /*
301 * Rumors state that some GVP ram boards use the same product
302 * code as the SCSI controllers. Therefore if the board-size
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300303 * is not 64KB we assume it is a ram board and bail out.
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200304 */
305 if (zorro_resource_len(z) != 0x10000)
306 return -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200308 address = z->resource.start;
309 if (!request_mem_region(address, 256, "wd33c93"))
310 return -EBUSY;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200312 regs = (struct gvp11_scsiregs *)(ZTWO_VADDR(address));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200314 error = check_wd33c93(regs);
315 if (error)
316 goto fail_check_or_alloc;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200317
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200318 instance = scsi_host_alloc(&gvp11_scsi_template,
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200319 sizeof(struct gvp11_hostdata));
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200320 if (!instance) {
321 error = -ENOMEM;
322 goto fail_check_or_alloc;
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200323 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200325 instance->irq = IRQ_AMIGA_PORTS;
326 instance->unique_id = z->slotaddr;
327
328 regs->secret2 = 1;
329 regs->secret1 = 0;
330 regs->secret3 = 15;
331 while (regs->CNTR & GVP11_DMAC_BUSY)
332 ;
333 regs->CNTR = 0;
334 regs->BANK = 0;
335
336 wdregs.SASR = &regs->SASR;
337 wdregs.SCMD = &regs->SCMD;
338
339 hdata = shost_priv(instance);
340 if (gvp11_xfer_mask)
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200341 hdata->wh.dma_xfer_mask = gvp11_xfer_mask;
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200342 else
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200343 hdata->wh.dma_xfer_mask = default_dma_xfer_mask;
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200344
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200345 hdata->wh.no_sync = 0xff;
346 hdata->wh.fast = 0;
347 hdata->wh.dma_mode = CTRL_DMA;
348 hdata->regs = regs;
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200349
350 /*
351 * Check for 14MHz SCSI clock
352 */
353 epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000);
354 wd33c93_init(instance, wdregs, dma_setup, dma_stop,
355 (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10
356 : WD33C93_FS_12_15);
357
358 error = request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED,
359 "GVP11 SCSI", instance);
360 if (error)
361 goto fail_irq;
362
363 regs->CNTR = GVP11_DMAC_INT_ENABLE;
364
365 error = scsi_add_host(instance, NULL);
366 if (error)
367 goto fail_host;
368
369 zorro_set_drvdata(z, instance);
370 scsi_scan_host(instance);
371 return 0;
372
373fail_host:
374 free_irq(IRQ_AMIGA_PORTS, instance);
375fail_irq:
376 scsi_host_put(instance);
377fail_check_or_alloc:
378 release_mem_region(address, 256);
379 return error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380}
381
Greg Kroah-Hartman6f039792012-12-21 13:08:55 -0800382static void gvp11_remove(struct zorro_dev *z)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383{
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200384 struct Scsi_Host *instance = zorro_get_drvdata(z);
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200385 struct gvp11_hostdata *hdata = shost_priv(instance);
Geert Uytterhoeven6869b152009-05-17 12:17:28 +0200386
Geert Uytterhoevencf2ed272010-04-12 21:55:25 +0200387 hdata->regs->CNTR = 0;
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200388 scsi_remove_host(instance);
Geert Uytterhoevenbb17b782010-04-04 11:00:33 +0200389 free_irq(IRQ_AMIGA_PORTS, instance);
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200390 scsi_host_put(instance);
391 release_mem_region(z->resource.start, 256);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392}
393
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200394 /*
395 * This should (hopefully) be the correct way to identify
396 * all the different GVP SCSI controllers (except for the
397 * SERIES I though).
398 */
399
Greg Kroah-Hartman6f039792012-12-21 13:08:55 -0800400static struct zorro_device_id gvp11_zorro_tbl[] = {
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200401 { ZORRO_PROD_GVP_COMBO_030_R3_SCSI, ~0x00ffffff },
402 { ZORRO_PROD_GVP_SERIES_II, ~0x00ffffff },
403 { ZORRO_PROD_GVP_GFORCE_030_SCSI, ~0x01ffffff },
404 { ZORRO_PROD_GVP_A530_SCSI, ~0x01ffffff },
405 { ZORRO_PROD_GVP_COMBO_030_R4_SCSI, ~0x01ffffff },
406 { ZORRO_PROD_GVP_A1291, ~0x07ffffff },
407 { ZORRO_PROD_GVP_GFORCE_040_SCSI_1, ~0x07ffffff },
408 { 0 }
409};
410MODULE_DEVICE_TABLE(zorro, gvp11_zorro_tbl);
411
412static struct zorro_driver gvp11_driver = {
413 .name = "gvp11",
414 .id_table = gvp11_zorro_tbl,
415 .probe = gvp11_probe,
Greg Kroah-Hartman6f039792012-12-21 13:08:55 -0800416 .remove = gvp11_remove,
Geert Uytterhoevenc1d288a2009-08-16 11:17:35 +0200417};
418
419static int __init gvp11_init(void)
420{
421 return zorro_register_driver(&gvp11_driver);
422}
423module_init(gvp11_init);
424
425static void __exit gvp11_exit(void)
426{
427 zorro_unregister_driver(&gvp11_driver);
428}
429module_exit(gvp11_exit);
430
431MODULE_DESCRIPTION("GVP Series II SCSI");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432MODULE_LICENSE("GPL");