blob: 5e57ee01093c12b8ec47f57cd6f47c06c8d65115 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#define PSEUDO_DMA
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#define UNSAFE /* Not unsafe for PAS16 -- use it */
3
4/*
5 * This driver adapted from Drew Eckhardt's Trantor T128 driver
6 *
7 * Copyright 1993, Drew Eckhardt
8 * Visionary Computing
9 * (Unix and Linux consulting and custom programming)
10 * drew@colorado.edu
11 * +1 (303) 666-5836
12 *
13 * ( Based on T128 - DISTRIBUTION RELEASE 3. )
14 *
15 * Modified to work with the Pro Audio Spectrum/Studio 16
16 * by John Weidman.
17 *
18 *
19 * For more information, please consult
20 *
21 * Media Vision
22 * (510) 770-8600
23 * (800) 348-7116
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 */
25
26/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 * The card is detected and initialized in one of several ways :
28 * 1. Autoprobe (default) - There are many different models of
29 * the Pro Audio Spectrum/Studio 16, and I only have one of
30 * them, so this may require a little tweaking. An interrupt
31 * is triggered to autoprobe for the interrupt line. Note:
32 * with the newer model boards, the interrupt is set via
33 * software after reset using the default_irq for the
34 * current board number.
35 *
36 * 2. With command line overrides - pas16=port,irq may be
37 * used on the LILO command line to override the defaults.
38 *
39 * 3. With the PAS16_OVERRIDE compile time define. This is
40 * specified as an array of address, irq tuples. Ie, for
41 * one board at the default 0x388 address, IRQ10, I could say
42 * -DPAS16_OVERRIDE={{0x388, 10}}
43 * NOTE: Untested.
44 *
45 * 4. When included as a module, with arguments passed on the command line:
46 * pas16_irq=xx the interrupt
47 * pas16_addr=xx the port
48 * e.g. "modprobe pas16 pas16_addr=0x388 pas16_irq=5"
49 *
50 * Note that if the override methods are used, place holders must
51 * be specified for other boards in the system.
52 *
53 *
54 * Configuration notes :
55 * The current driver does not support interrupt sharing with the
56 * sound portion of the card. If you use the same irq for the
57 * scsi port and sound you will have problems. Either use
58 * a different irq for the scsi port or don't use interrupts
59 * for the scsi port.
60 *
61 * If you have problems with your card not being recognized, use
62 * the LILO command line override. Try to get it recognized without
63 * interrupts. Ie, for a board at the default 0x388 base port,
Finn Thain22f5f102014-11-12 16:11:56 +110064 * boot: linux pas16=0x388,0
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 *
Finn Thain22f5f102014-11-12 16:11:56 +110066 * NO_IRQ (0) should be specified for no interrupt,
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 * IRQ_AUTO (254) to autoprobe for an IRQ line if overridden
68 * on the command line.
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 */
70
71#include <linux/module.h>
72
Linus Torvalds1da177e2005-04-16 15:20:36 -070073#include <linux/signal.h>
74#include <linux/proc_fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070075#include <asm/io.h>
76#include <asm/dma.h>
77#include <linux/blkdev.h>
78#include <linux/delay.h>
79#include <linux/interrupt.h>
80#include <linux/stat.h>
81#include <linux/init.h>
82
Linus Torvalds1da177e2005-04-16 15:20:36 -070083#include <scsi/scsi_host.h>
84#include "pas16.h"
85#define AUTOPROBE_IRQ
86#include "NCR5380.h"
87
88
Finn Thaind5f7e652016-01-03 16:05:03 +110089static unsigned short pas16_addr;
90static int pas16_irq;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
92
Adrian Bunk408b6642005-05-01 08:59:29 -070093static const int scsi_irq_translate[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 { 0, 0, 1, 2, 3, 4, 5, 6, 0, 0, 7, 8, 9, 0, 10, 11 };
95
96/* The default_irqs array contains values used to set the irq into the
97 * board via software (as must be done on newer model boards without
98 * irq jumpers on the board). The first value in the array will be
99 * assigned to logical board 0, the next to board 1, etc.
100 */
Adrian Bunk408b6642005-05-01 08:59:29 -0700101static int default_irqs[] __initdata =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102 { PAS16_DEFAULT_BOARD_1_IRQ,
103 PAS16_DEFAULT_BOARD_2_IRQ,
104 PAS16_DEFAULT_BOARD_3_IRQ,
105 PAS16_DEFAULT_BOARD_4_IRQ
106 };
107
108static struct override {
109 unsigned short io_port;
110 int irq;
Tobias Klauser6391a112006-06-08 22:23:48 -0700111} overrides
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112#ifdef PAS16_OVERRIDE
113 [] __initdata = PAS16_OVERRIDE;
114#else
115 [4] __initdata = {{0,IRQ_AUTO}, {0,IRQ_AUTO}, {0,IRQ_AUTO},
116 {0,IRQ_AUTO}};
117#endif
118
Tobias Klauser6391a112006-06-08 22:23:48 -0700119#define NO_OVERRIDES ARRAY_SIZE(overrides)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120
121static struct base {
122 unsigned short io_port;
123 int noauto;
Tobias Klauser6391a112006-06-08 22:23:48 -0700124} bases[] __initdata =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 { {PAS16_DEFAULT_BASE_1, 0},
126 {PAS16_DEFAULT_BASE_2, 0},
127 {PAS16_DEFAULT_BASE_3, 0},
128 {PAS16_DEFAULT_BASE_4, 0}
129 };
130
Tobias Klauser6391a112006-06-08 22:23:48 -0700131#define NO_BASES ARRAY_SIZE(bases)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132
Adrian Bunk408b6642005-05-01 08:59:29 -0700133static const unsigned short pas16_offset[ 8 ] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134 {
135 0x1c00, /* OUTPUT_DATA_REG */
136 0x1c01, /* INITIATOR_COMMAND_REG */
137 0x1c02, /* MODE_REG */
138 0x1c03, /* TARGET_COMMAND_REG */
139 0x3c00, /* STATUS_REG ro, SELECT_ENABLE_REG wo */
140 0x3c01, /* BUS_AND_STATUS_REG ro, START_DMA_SEND_REG wo */
141 0x3c02, /* INPUT_DATA_REGISTER ro, (N/A on PAS16 ?)
142 * START_DMA_TARGET_RECEIVE_REG wo
143 */
144 0x3c03, /* RESET_PARITY_INTERRUPT_REG ro,
145 * START_DMA_INITIATOR_RECEIVE_REG wo
146 */
147 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
149
150/*
151 * Function : enable_board( int board_num, unsigned short port )
152 *
153 * Purpose : set address in new model board
154 *
155 * Inputs : board_num - logical board number 0-3, port - base address
156 *
157 */
158
159static void __init
160 enable_board( int board_num, unsigned short port )
161{
162 outb( 0xbc + board_num, MASTER_ADDRESS_PTR );
163 outb( port >> 2, MASTER_ADDRESS_PTR );
164}
165
166
167
168/*
169 * Function : init_board( unsigned short port, int irq )
170 *
171 * Purpose : Set the board up to handle the SCSI interface
172 *
173 * Inputs : port - base address of the board,
174 * irq - irq to assign to the SCSI port
175 * force_irq - set it even if it conflicts with sound driver
176 *
177 */
178
179static void __init
180 init_board( unsigned short io_port, int irq, int force_irq )
181{
182 unsigned int tmp;
183 unsigned int pas_irq_code;
184
185 /* Initialize the SCSI part of the board */
186
187 outb( 0x30, io_port + P_TIMEOUT_COUNTER_REG ); /* Timeout counter */
188 outb( 0x01, io_port + P_TIMEOUT_STATUS_REG_OFFSET ); /* Reset TC */
189 outb( 0x01, io_port + WAIT_STATE ); /* 1 Wait state */
190
Finn Thain54d8fe42016-01-03 16:05:06 +1100191 inb(io_port + pas16_offset[RESET_PARITY_INTERRUPT_REG]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192
193 /* Set the SCSI interrupt pointer without mucking up the sound
194 * interrupt pointer in the same byte.
195 */
196 pas_irq_code = ( irq < 16 ) ? scsi_irq_translate[irq] : 0;
197 tmp = inb( io_port + IO_CONFIG_3 );
198
199 if( (( tmp & 0x0f ) == pas_irq_code) && pas_irq_code > 0
200 && !force_irq )
201 {
202 printk( "pas16: WARNING: Can't use same irq as sound "
203 "driver -- interrupts disabled\n" );
204 /* Set up the drive parameters, disable 5380 interrupts */
205 outb( 0x4d, io_port + SYS_CONFIG_4 );
206 }
207 else
208 {
209 tmp = ( tmp & 0x0f ) | ( pas_irq_code << 4 );
210 outb( tmp, io_port + IO_CONFIG_3 );
211
212 /* Set up the drive parameters and enable 5380 interrupts */
213 outb( 0x6d, io_port + SYS_CONFIG_4 );
214 }
215}
216
217
218/*
219 * Function : pas16_hw_detect( unsigned short board_num )
220 *
221 * Purpose : determine if a pas16 board is present
222 *
223 * Inputs : board_num - logical board number ( 0 - 3 )
224 *
225 * Returns : 0 if board not found, 1 if found.
226 */
227
228static int __init
229 pas16_hw_detect( unsigned short board_num )
230{
231 unsigned char board_rev, tmp;
232 unsigned short io_port = bases[ board_num ].io_port;
233
234 /* See if we can find a PAS16 board at the address associated
235 * with this logical board number.
236 */
237
238 /* First, attempt to take a newer model board out of reset and
239 * give it a base address. This shouldn't affect older boards.
240 */
241 enable_board( board_num, io_port );
242
243 /* Now see if it looks like a PAS16 board */
244 board_rev = inb( io_port + PCB_CONFIG );
245
246 if( board_rev == 0xff )
247 return 0;
248
249 tmp = board_rev ^ 0xe0;
250
251 outb( tmp, io_port + PCB_CONFIG );
252 tmp = inb( io_port + PCB_CONFIG );
253 outb( board_rev, io_port + PCB_CONFIG );
254
255 if( board_rev != tmp ) /* Not a PAS-16 */
256 return 0;
257
258 if( ( inb( io_port + OPERATION_MODE_1 ) & 0x03 ) != 0x03 )
259 return 0; /* return if no SCSI interface found */
260
261 /* Mediavision has some new model boards that return ID bits
262 * that indicate a SCSI interface, but they're not (LMS). We'll
263 * put in an additional test to try to weed them out.
264 */
265
Finn Thain54d8fe42016-01-03 16:05:06 +1100266 outb(0x01, io_port + WAIT_STATE); /* 1 Wait state */
267 outb(0x20, io_port + pas16_offset[MODE_REG]); /* Is it really SCSI? */
268 if (inb(io_port + pas16_offset[MODE_REG]) != 0x20) /* Write to a reg. */
269 return 0; /* and try to read */
270 outb(0x00, io_port + pas16_offset[MODE_REG]); /* it back. */
271 if (inb(io_port + pas16_offset[MODE_REG]) != 0x00)
272 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273
274 return 1;
275}
276
277
Finn Thain925e4612014-11-12 16:11:49 +1100278#ifndef MODULE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279/*
280 * Function : pas16_setup(char *str, int *ints)
281 *
282 * Purpose : LILO command line initialization of the overrides array,
283 *
284 * Inputs : str - unused, ints - array of integer parameters with ints[0]
285 * equal to the number of ints.
286 *
287 */
288
Finn Thain925e4612014-11-12 16:11:49 +1100289static int __init pas16_setup(char *str)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290{
Finn Thaind5f7e652016-01-03 16:05:03 +1100291 static int commandline_current;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292 int i;
Finn Thain925e4612014-11-12 16:11:49 +1100293 int ints[10];
294
295 get_options(str, ARRAY_SIZE(ints), ints);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296 if (ints[0] != 2)
297 printk("pas16_setup : usage pas16=io_port,irq\n");
298 else
299 if (commandline_current < NO_OVERRIDES) {
300 overrides[commandline_current].io_port = (unsigned short) ints[1];
301 overrides[commandline_current].irq = ints[2];
302 for (i = 0; i < NO_BASES; ++i)
303 if (bases[i].io_port == (unsigned short) ints[1]) {
304 bases[i].noauto = 1;
305 break;
306 }
307 ++commandline_current;
308 }
Finn Thain925e4612014-11-12 16:11:49 +1100309 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310}
311
Finn Thain925e4612014-11-12 16:11:49 +1100312__setup("pas16=", pas16_setup);
313#endif
314
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315/*
Christoph Hellwigd0be4a7d2005-10-31 18:31:40 +0100316 * Function : int pas16_detect(struct scsi_host_template * tpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 *
318 * Purpose : detects and initializes PAS16 controllers
319 * that were autoprobed, overridden on the LILO command line,
320 * or specified at compile time.
321 *
322 * Inputs : tpnt - template for this SCSI adapter.
323 *
324 * Returns : 1 if a host adapter was found, 0 if not.
325 *
326 */
327
Finn Thained8b9e72014-11-12 16:11:51 +1100328static int __init pas16_detect(struct scsi_host_template *tpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329{
Finn Thaind5f7e652016-01-03 16:05:03 +1100330 static int current_override;
331 static unsigned short current_base;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332 struct Scsi_Host *instance;
333 unsigned short io_port;
334 int count;
335
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 if (pas16_addr != 0) {
337 overrides[0].io_port = pas16_addr;
338 /*
339 * This is how we avoid seeing more than
340 * one host adapter at the same I/O port.
341 * Cribbed shamelessly from pas16_setup().
342 */
343 for (count = 0; count < NO_BASES; ++count)
344 if (bases[count].io_port == pas16_addr) {
345 bases[count].noauto = 1;
346 break;
347 }
348 }
349 if (pas16_irq != 0)
350 overrides[0].irq = pas16_irq;
351
352 for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
353 io_port = 0;
354
355 if (overrides[current_override].io_port)
356 {
357 io_port = overrides[current_override].io_port;
358 enable_board( current_override, io_port );
359 init_board( io_port, overrides[current_override].irq, 1 );
360 }
361 else
362 for (; !io_port && (current_base < NO_BASES); ++current_base) {
Finn Thain2f7dba92016-01-03 16:05:04 +1100363 dprintk(NDEBUG_INIT, "pas16: probing io_port 0x%04x\n",
364 (unsigned int)bases[current_base].io_port);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365 if ( !bases[current_base].noauto &&
366 pas16_hw_detect( current_base ) ){
367 io_port = bases[current_base].io_port;
368 init_board( io_port, default_irqs[ current_base ], 0 );
Finn Thain2f7dba92016-01-03 16:05:04 +1100369 dprintk(NDEBUG_INIT, "pas16: detected board\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 }
371 }
372
Finn Thain2f7dba92016-01-03 16:05:04 +1100373 dprintk(NDEBUG_INIT, "pas16: io_port = 0x%04x\n",
374 (unsigned int)io_port);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375
376 if (!io_port)
377 break;
378
379 instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));
380 if(instance == NULL)
Finn Thain0ad0eff2016-01-03 16:05:21 +1100381 goto out;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382
383 instance->io_port = io_port;
384
Finn Thain0ad0eff2016-01-03 16:05:21 +1100385 if (NCR5380_init(instance, 0))
386 goto out_unregister;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387
Finn Thainb6488f92016-01-03 16:05:08 +1100388 NCR5380_maybe_reset_bus(instance);
389
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390 if (overrides[current_override].irq != IRQ_AUTO)
391 instance->irq = overrides[current_override].irq;
392 else
393 instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS);
394
Finn Thain22f5f102014-11-12 16:11:56 +1100395 /* Compatibility with documented NCR5380 kernel parameters */
396 if (instance->irq == 255)
397 instance->irq = NO_IRQ;
398
399 if (instance->irq != NO_IRQ)
Michael Opdenacker4909cc22014-03-05 06:09:41 +0100400 if (request_irq(instance->irq, pas16_intr, 0,
Jeff Garzik1e641662007-11-11 19:52:05 -0500401 "pas16", instance)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
403 instance->host_no, instance->irq);
Finn Thain22f5f102014-11-12 16:11:56 +1100404 instance->irq = NO_IRQ;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 }
406
Finn Thain22f5f102014-11-12 16:11:56 +1100407 if (instance->irq == NO_IRQ) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 printk("scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no);
409 printk("scsi%d : please jumper the board for a free IRQ.\n", instance->host_no);
410 /* Disable 5380 interrupts, leave drive params the same */
411 outb( 0x4d, io_port + SYS_CONFIG_4 );
412 outb( (inb(io_port + IO_CONFIG_3) & 0x0f), io_port + IO_CONFIG_3 );
413 }
414
Finn Thain2f7dba92016-01-03 16:05:04 +1100415 dprintk(NDEBUG_INIT, "scsi%d : irq = %d\n",
416 instance->host_no, instance->irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 ++current_override;
419 ++count;
420 }
421 return count;
Finn Thain0ad0eff2016-01-03 16:05:21 +1100422
423out_unregister:
424 scsi_unregister(instance);
425out:
426 return count;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427}
428
429/*
430 * Function : int pas16_biosparam(Disk *disk, struct block_device *dev, int *ip)
431 *
432 * Purpose : Generates a BIOS / DOS compatible H-C-S mapping for
433 * the specified device / size.
434 *
435 * Inputs : size = size of device in sectors (512 bytes), dev = block device
436 * major / minor, ip[] = {heads, sectors, cylinders}
437 *
438 * Returns : always 0 (success), initializes ip
439 *
440 */
441
442/*
443 * XXX Most SCSI boards use this mapping, I could be incorrect. Some one
444 * using hard disks on a trantor should verify that this mapping corresponds
445 * to that used by the BIOS / ASPI driver by running the linux fdisk program
446 * and matching the H_C_S coordinates to what DOS uses.
447 */
448
Finn Thained8b9e72014-11-12 16:11:51 +1100449static int pas16_biosparam(struct scsi_device *sdev, struct block_device *dev,
450 sector_t capacity, int *ip)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451{
452 int size = capacity;
453 ip[0] = 64;
454 ip[1] = 32;
455 ip[2] = size >> 11; /* I think I have it as /(32*64) */
456 if( ip[2] > 1024 ) { /* yes, >, not >= */
457 ip[0]=255;
458 ip[1]=63;
459 ip[2]=size/(63*255);
460 if( ip[2] > 1023 ) /* yes >1023... */
461 ip[2] = 1023;
462 }
463
464 return 0;
465}
466
467/*
468 * Function : int NCR5380_pread (struct Scsi_Host *instance,
469 * unsigned char *dst, int len)
470 *
471 * Purpose : Fast 5380 pseudo-dma read function, transfers len bytes to
472 * dst
473 *
474 * Inputs : dst = destination, len = length in bytes
475 *
476 * Returns : 0 on success, non zero on a failure such as a watchdog
477 * timeout.
478 */
479
480static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst,
481 int len) {
482 register unsigned char *d = dst;
483 register unsigned short reg = (unsigned short) (instance->io_port +
484 P_DATA_REG_OFFSET);
485 register int i = len;
486 int ii = 0;
Finn Thaina9c2dc42014-11-12 16:11:59 +1100487 struct NCR5380_hostdata *hostdata = shost_priv(instance);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488
489 while ( !(inb(instance->io_port + P_STATUS_REG_OFFSET) & P_ST_RDY) )
490 ++ii;
491
492 insb( reg, d, i );
493
494 if ( inb(instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET) & P_TS_TIM) {
495 outb( P_TS_CT, instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET);
496 printk("scsi%d : watchdog timer fired in NCR5380_pread()\n",
497 instance->host_no);
498 return -1;
499 }
Finn Thaina9c2dc42014-11-12 16:11:59 +1100500 if (ii > hostdata->spin_max_r)
501 hostdata->spin_max_r = ii;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 return 0;
503}
504
505/*
506 * Function : int NCR5380_pwrite (struct Scsi_Host *instance,
507 * unsigned char *src, int len)
508 *
509 * Purpose : Fast 5380 pseudo-dma write function, transfers len bytes from
510 * src
511 *
512 * Inputs : src = source, len = length in bytes
513 *
514 * Returns : 0 on success, non zero on a failure such as a watchdog
515 * timeout.
516 */
517
518static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src,
519 int len) {
520 register unsigned char *s = src;
521 register unsigned short reg = (instance->io_port + P_DATA_REG_OFFSET);
522 register int i = len;
523 int ii = 0;
Finn Thaina9c2dc42014-11-12 16:11:59 +1100524 struct NCR5380_hostdata *hostdata = shost_priv(instance);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700525
526 while ( !((inb(instance->io_port + P_STATUS_REG_OFFSET)) & P_ST_RDY) )
527 ++ii;
528
529 outsb( reg, s, i );
530
531 if (inb(instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET) & P_TS_TIM) {
532 outb( P_TS_CT, instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET);
533 printk("scsi%d : watchdog timer fired in NCR5380_pwrite()\n",
534 instance->host_no);
535 return -1;
536 }
Finn Thaina9c2dc42014-11-12 16:11:59 +1100537 if (ii > hostdata->spin_max_w)
538 hostdata->spin_max_w = ii;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539 return 0;
540}
541
542#include "NCR5380.c"
543
544static int pas16_release(struct Scsi_Host *shost)
545{
Finn Thain22f5f102014-11-12 16:11:56 +1100546 if (shost->irq != NO_IRQ)
Jeff Garzik1e641662007-11-11 19:52:05 -0500547 free_irq(shost->irq, shost);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548 NCR5380_exit(shost);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549 scsi_unregister(shost);
550 return 0;
551}
552
Christoph Hellwigd0be4a7d2005-10-31 18:31:40 +0100553static struct scsi_host_template driver_template = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554 .name = "Pro Audio Spectrum-16 SCSI",
555 .detect = pas16_detect,
556 .release = pas16_release,
Finn Thain4d3d2a52014-11-12 16:11:52 +1100557 .proc_name = "pas16",
558 .show_info = pas16_show_info,
559 .write_info = pas16_write_info,
Finn Thain8c325132014-11-12 16:11:58 +1100560 .info = pas16_info,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 .queuecommand = pas16_queue_command,
562 .eh_abort_handler = pas16_abort,
563 .eh_bus_reset_handler = pas16_bus_reset,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 .bios_param = pas16_biosparam,
565 .can_queue = CAN_QUEUE,
566 .this_id = 7,
567 .sg_tablesize = SG_ALL,
568 .cmd_per_lun = CMD_PER_LUN,
569 .use_clustering = DISABLE_CLUSTERING,
570};
571#include "scsi_module.c"
572
573#ifdef MODULE
574module_param(pas16_addr, ushort, 0);
575module_param(pas16_irq, int, 0);
576#endif
577MODULE_LICENSE("GPL");