1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * sym53c500_cs.c Bob Tracy (rct@frus.com)
5 * A rewrite of the pcmcia-cs add-on driver for newer (circa 1997)
6 * New Media Bus Toaster PCMCIA SCSI cards using the Symbios Logic
7 * 53c500 controller: intended for use with 2.6 and later kernels.
8 * The pcmcia-cs add-on version of this driver is not supported
9 * beyond 2.4. It consisted of three files with history/copyright
10 * information as follows:
13 * Bob Tracy (rct@frus.com)
14 * Original by Tom Corner (tcorner@via.at).
15 * Adapted from NCR53c406a.h which is Copyrighted (C) 1994
16 * Normunds Saumanis (normunds@rx.tech.swh.lv)
19 * Bob Tracy (rct@frus.com)
20 * Original driver by Tom Corner (tcorner@via.at) was adapted
21 * from NCR53c406a.c which is Copyrighted (C) 1994, 1995, 1996
22 * Normunds Saumanis (normunds@fi.ibm.com)
25 * Bob Tracy (rct@frus.com)
26 * Original by Tom Corner (tcorner@via.at) was adapted from a
27 * driver for the Qlogic SCSI card written by
28 * David Hinds (dhinds@allegro.stanford.edu).
31 #define SYM53C500_DEBUG 0
32 #define VERBOSE_SYM53C500_DEBUG 0
35 * Set this to 0 if you encounter kernel lockups while transferring
36 * data in PIO mode. Note this can be changed via "sysfs".
38 #define USE_FAST_PIO 1
40 /* =============== End of user configurable parameters ============== */
42 #include <linux/module.h>
43 #include <linux/moduleparam.h>
44 #include <linux/errno.h>
45 #include <linux/init.h>
46 #include <linux/interrupt.h>
47 #include <linux/kernel.h>
48 #include <linux/slab.h>
49 #include <linux/string.h>
50 #include <linux/ioport.h>
51 #include <linux/blkdev.h>
52 #include <linux/spinlock.h>
53 #include <linux/bitops.h>
59 #include <scsi/scsi_ioctl.h>
60 #include <scsi/scsi_cmnd.h>
61 #include <scsi/scsi_device.h>
62 #include <scsi/scsi.h>
63 #include <scsi/scsi_host.h>
65 #include <pcmcia/cistpl.h>
66 #include <pcmcia/ds.h>
67 #include <pcmcia/ciscode.h>
70 /* ================================================================== */
72 #define SYNC_MODE 0 /* Synchronous transfer mode */
74 /* Default configuration */
75 #define C1_IMG 0x07 /* ID=7 */
76 #define C2_IMG 0x48 /* FE SCSI2 */
77 #define C3_IMG 0x20 /* CDB */
78 #define C4_IMG 0x04 /* ANE */
79 #define C5_IMG 0xa4 /* ? changed from b6= AA PI SIE POL */
80 #define C7_IMG 0x80 /* added for SYM53C500 t. corner */
82 /* Hardware Registers: offsets from io_port (base) */
84 /* Control Register Set 0 */
85 #define TC_LSB 0x00 /* transfer counter lsb */
86 #define TC_MSB 0x01 /* transfer counter msb */
87 #define SCSI_FIFO 0x02 /* scsi fifo register */
88 #define CMD_REG 0x03 /* command register */
89 #define STAT_REG 0x04 /* status register */
90 #define DEST_ID 0x04 /* selection/reselection bus id */
91 #define INT_REG 0x05 /* interrupt status register */
92 #define SRTIMOUT 0x05 /* select/reselect timeout reg */
93 #define SEQ_REG 0x06 /* sequence step register */
94 #define SYNCPRD 0x06 /* synchronous transfer period */
95 #define FIFO_FLAGS 0x07 /* indicates # of bytes in fifo */
96 #define SYNCOFF 0x07 /* synchronous offset register */
97 #define CONFIG1 0x08 /* configuration register */
98 #define CLKCONV 0x09 /* clock conversion register */
99 /* #define TESTREG 0x0A */ /* test mode register */
100 #define CONFIG2 0x0B /* configuration 2 register */
101 #define CONFIG3 0x0C /* configuration 3 register */
102 #define CONFIG4 0x0D /* configuration 4 register */
103 #define TC_HIGH 0x0E /* transfer counter high */
104 /* #define FIFO_BOTTOM 0x0F */ /* reserve FIFO byte register */
106 /* Control Register Set 1 */
107 /* #define JUMPER_SENSE 0x00 */ /* jumper sense port reg (r/w) */
108 /* #define SRAM_PTR 0x01 */ /* SRAM address pointer reg (r/w) */
109 /* #define SRAM_DATA 0x02 */ /* SRAM data register (r/w) */
110 #define PIO_FIFO 0x04 /* PIO FIFO registers (r/w) */
111 /* #define PIO_FIFO1 0x05 */ /* */
112 /* #define PIO_FIFO2 0x06 */ /* */
113 /* #define PIO_FIFO3 0x07 */ /* */
114 #define PIO_STATUS 0x08 /* PIO status (r/w) */
115 /* #define ATA_CMD 0x09 */ /* ATA command/status reg (r/w) */
116 /* #define ATA_ERR 0x0A */ /* ATA features/error reg (r/w) */
117 #define PIO_FLAG 0x0B /* PIO flag interrupt enable (r/w) */
118 #define CONFIG5 0x09 /* configuration 5 register */
119 /* #define SIGNATURE 0x0E */ /* signature register (r) */
120 /* #define CONFIG6 0x0F */ /* configuration 6 register (r) */
123 /* select register set 0 */
124 #define REG0(x) (outb(C4_IMG, (x) + CONFIG4))
125 /* select register set 1 */
126 #define REG1(x) outb(C7_IMG, (x) + CONFIG7); outb(C5_IMG, (x) + CONFIG5)
134 #if VERBOSE_SYM53C500_DEBUG
140 #define LOAD_DMA_COUNT(x, count) \
141 outb(count & 0xff, (x) + TC_LSB); \
142 outb((count >> 8) & 0xff, (x) + TC_MSB); \
143 outb((count >> 16) & 0xff, (x) + TC_HIGH);
148 #define SCSI_NOP 0x00
149 #define FLUSH_FIFO 0x01
150 #define CHIP_RESET 0x02
151 #define SCSI_RESET 0x03
152 #define RESELECT 0x40
153 #define SELECT_NO_ATN 0x41
154 #define SELECT_ATN 0x42
155 #define SELECT_ATN_STOP 0x43
156 #define ENABLE_SEL 0x44
157 #define DISABLE_SEL 0x45
158 #define SELECT_ATN3 0x46
159 #define RESELECT3 0x47
160 #define TRANSFER_INFO 0x10
161 #define INIT_CMD_COMPLETE 0x11
162 #define MSG_ACCEPT 0x12
163 #define TRANSFER_PAD 0x18
165 #define RESET_ATN 0x1b
166 #define SEND_MSG 0x20
167 #define SEND_STATUS 0x21
168 #define SEND_DATA 0x22
169 #define DISCONN_SEQ 0x23
170 #define TERMINATE_SEQ 0x24
171 #define TARG_CMD_COMPLETE 0x25
173 #define RECV_MSG 0x28
174 #define RECV_CMD 0x29
175 #define RECV_DATA 0x2a
176 #define RECV_CMD_SEQ 0x2b
177 #define TARGET_ABORT_DMA 0x04
179 /* ================================================================== */
182 struct pcmcia_device
*p_dev
;
183 struct Scsi_Host
*host
;
184 unsigned short manf_id
;
188 * Repository for per-instance host data.
190 struct sym53c500_data
{
191 struct scsi_cmnd
*current_SC
;
195 struct sym53c500_cmd_priv
{
211 /* ================================================================== */
214 chip_init(int io_port
)
217 outb(0x01, io_port
+ PIO_STATUS
);
218 outb(0x00, io_port
+ PIO_FLAG
);
220 outb(C4_IMG
, io_port
+ CONFIG4
); /* REG0(io_port); */
221 outb(C3_IMG
, io_port
+ CONFIG3
);
222 outb(C2_IMG
, io_port
+ CONFIG2
);
223 outb(C1_IMG
, io_port
+ CONFIG1
);
225 outb(0x05, io_port
+ CLKCONV
); /* clock conversion factor */
226 outb(0x9C, io_port
+ SRTIMOUT
); /* Selection timeout */
227 outb(0x05, io_port
+ SYNCPRD
); /* Synchronous transfer period */
228 outb(SYNC_MODE
, io_port
+ SYNCOFF
); /* synchronous mode */
232 SYM53C500_int_host_reset(int io_port
)
234 outb(C4_IMG
, io_port
+ CONFIG4
); /* REG0(io_port); */
235 outb(CHIP_RESET
, io_port
+ CMD_REG
);
236 outb(SCSI_NOP
, io_port
+ CMD_REG
); /* required after reset */
237 outb(SCSI_RESET
, io_port
+ CMD_REG
);
241 static __inline__
int
242 SYM53C500_pio_read(int fast_pio
, int base
, unsigned char *request
, unsigned int reqlen
)
245 int len
; /* current scsi fifo size */
249 i
= inb(base
+ PIO_STATUS
);
250 /* VDEB(printk("pio_status=%x\n", i)); */
256 case 0x10: /* fifo empty */
262 case 0x8: /* fifo 1/3 full */
265 case 0xc: /* fifo 2/3 full */
268 case 0xe: /* fifo full */
273 if ((i
& 0x40) && len
== 0) { /* fifo empty and interrupt occurred */
281 if (fast_pio
&& len
> 3) {
282 insl(base
+ PIO_FIFO
, request
, len
>> 2);
283 request
+= len
& 0xfc;
284 reqlen
-= len
& 0xfc;
287 *request
++ = inb(base
+ PIO_FIFO
);
296 static __inline__
int
297 SYM53C500_pio_write(int fast_pio
, int base
, unsigned char *request
, unsigned int reqlen
)
300 int len
; /* current scsi fifo size */
303 while (reqlen
&& !(i
& 0x40)) {
304 i
= inb(base
+ PIO_STATUS
);
305 /* VDEB(printk("pio_status=%x\n", i)); */
306 if (i
& 0x80) /* error */
332 if (fast_pio
&& len
> 3) {
333 outsl(base
+ PIO_FIFO
, request
, len
>> 2);
334 request
+= len
& 0xfc;
335 reqlen
-= len
& 0xfc;
338 outb(*request
++, base
+ PIO_FIFO
);
348 SYM53C500_intr(int irq
, void *dev_id
)
351 struct Scsi_Host
*dev
= dev_id
;
352 DEB(unsigned char fifo_size
;)
353 DEB(unsigned char seq_reg
;)
354 unsigned char status
, int_reg
;
355 unsigned char pio_status
;
356 int port_base
= dev
->io_port
;
357 struct sym53c500_data
*data
=
358 (struct sym53c500_data
*)dev
->hostdata
;
359 struct scsi_cmnd
*curSC
= data
->current_SC
;
360 struct sym53c500_cmd_priv
*scp
= scsi_cmd_priv(curSC
);
361 int fast_pio
= data
->fast_pio
;
363 spin_lock_irqsave(dev
->host_lock
, flags
);
365 VDEB(printk("SYM53C500_intr called\n"));
368 pio_status
= inb(port_base
+ PIO_STATUS
);
370 status
= inb(port_base
+ STAT_REG
);
371 DEB(seq_reg
= inb(port_base
+ SEQ_REG
));
372 int_reg
= inb(port_base
+ INT_REG
);
373 DEB(fifo_size
= inb(port_base
+ FIFO_FLAGS
) & 0x1f);
376 printk("status=%02x, seq_reg=%02x, int_reg=%02x, fifo_size=%02x",
377 status
, seq_reg
, int_reg
, fifo_size
);
378 printk(", pio=%02x\n", pio_status
);
379 #endif /* SYM53C500_DEBUG */
381 if (int_reg
& 0x80) { /* SCSI reset intr */
382 DEB(printk("SYM53C500: reset intr received\n"));
383 curSC
->result
= DID_RESET
<< 16;
387 if (pio_status
& 0x80) {
388 printk("SYM53C500: Warning: PIO error!\n");
389 curSC
->result
= DID_ERROR
<< 16;
393 if (status
& 0x20) { /* Parity error */
394 printk("SYM53C500: Warning: parity error!\n");
395 curSC
->result
= DID_PARITY
<< 16;
399 if (status
& 0x40) { /* Gross error */
400 printk("SYM53C500: Warning: gross error!\n");
401 curSC
->result
= DID_ERROR
<< 16;
405 if (int_reg
& 0x20) { /* Disconnect */
406 DEB(printk("SYM53C500: disconnect intr received\n"));
407 if (scp
->phase
!= message_in
) { /* Unexpected disconnect */
408 curSC
->result
= DID_NO_CONNECT
<< 16;
409 } else { /* Command complete, return status and message */
410 curSC
->result
= (scp
->status
& 0xff) |
411 ((scp
->message
& 0xff) << 8) | (DID_OK
<< 16);
416 switch (status
& 0x07) { /* scsi phase */
417 case 0x00: /* DATA-OUT */
418 if (int_reg
& 0x10) { /* Target requesting info transfer */
419 struct scatterlist
*sg
;
422 scp
->phase
= data_out
;
423 VDEB(printk("SYM53C500: Data-Out phase\n"));
424 outb(FLUSH_FIFO
, port_base
+ CMD_REG
);
425 LOAD_DMA_COUNT(port_base
, scsi_bufflen(curSC
)); /* Max transfer size */
426 outb(TRANSFER_INFO
| DMA_OP
, port_base
+ CMD_REG
);
428 scsi_for_each_sg(curSC
, sg
, scsi_sg_count(curSC
), i
) {
429 SYM53C500_pio_write(fast_pio
, port_base
,
430 sg_virt(sg
), sg
->length
);
436 case 0x01: /* DATA-IN */
437 if (int_reg
& 0x10) { /* Target requesting info transfer */
438 struct scatterlist
*sg
;
441 scp
->phase
= data_in
;
442 VDEB(printk("SYM53C500: Data-In phase\n"));
443 outb(FLUSH_FIFO
, port_base
+ CMD_REG
);
444 LOAD_DMA_COUNT(port_base
, scsi_bufflen(curSC
)); /* Max transfer size */
445 outb(TRANSFER_INFO
| DMA_OP
, port_base
+ CMD_REG
);
447 scsi_for_each_sg(curSC
, sg
, scsi_sg_count(curSC
), i
) {
448 SYM53C500_pio_read(fast_pio
, port_base
,
449 sg_virt(sg
), sg
->length
);
455 case 0x02: /* COMMAND */
456 scp
->phase
= command_ph
;
457 printk("SYM53C500: Warning: Unknown interrupt occurred in command phase!\n");
460 case 0x03: /* STATUS */
461 scp
->phase
= status_ph
;
462 VDEB(printk("SYM53C500: Status phase\n"));
463 outb(FLUSH_FIFO
, port_base
+ CMD_REG
);
464 outb(INIT_CMD_COMPLETE
, port_base
+ CMD_REG
);
467 case 0x04: /* Reserved */
468 case 0x05: /* Reserved */
469 printk("SYM53C500: WARNING: Reserved phase!!!\n");
472 case 0x06: /* MESSAGE-OUT */
473 DEB(printk("SYM53C500: Message-Out phase\n"));
474 scp
->phase
= message_out
;
475 outb(SET_ATN
, port_base
+ CMD_REG
); /* Reject the message */
476 outb(MSG_ACCEPT
, port_base
+ CMD_REG
);
479 case 0x07: /* MESSAGE-IN */
480 VDEB(printk("SYM53C500: Message-In phase\n"));
481 scp
->phase
= message_in
;
483 scp
->status
= inb(port_base
+ SCSI_FIFO
);
484 scp
->message
= inb(port_base
+ SCSI_FIFO
);
486 VDEB(printk("SCSI FIFO size=%d\n", inb(port_base
+ FIFO_FLAGS
) & 0x1f));
487 DEB(printk("Status = %02x Message = %02x\n", scp
->status
, scp
->message
));
489 if (scp
->message
== SAVE_POINTERS
|| scp
->message
== DISCONNECT
) {
490 outb(SET_ATN
, port_base
+ CMD_REG
); /* Reject message */
491 DEB(printk("Discarding SAVE_POINTERS message\n"));
493 outb(MSG_ACCEPT
, port_base
+ CMD_REG
);
497 spin_unlock_irqrestore(dev
->host_lock
, flags
);
507 SYM53C500_release(struct pcmcia_device
*link
)
509 struct scsi_info_t
*info
= link
->priv
;
510 struct Scsi_Host
*shost
= info
->host
;
512 dev_dbg(&link
->dev
, "SYM53C500_release\n");
515 * Do this before releasing/freeing resources.
517 scsi_remove_host(shost
);
520 * Interrupts getting hosed on card removal. Try
521 * the following code, mostly from qlogicfas.c.
524 free_irq(shost
->irq
, shost
);
525 if (shost
->io_port
&& shost
->n_io_port
)
526 release_region(shost
->io_port
, shost
->n_io_port
);
528 pcmcia_disable_device(link
);
530 scsi_host_put(shost
);
531 } /* SYM53C500_release */
534 SYM53C500_info(struct Scsi_Host
*SChost
)
536 static char info_msg
[256];
537 struct sym53c500_data
*data
=
538 (struct sym53c500_data
*)SChost
->hostdata
;
540 DEB(printk("SYM53C500_info called\n"));
541 (void)snprintf(info_msg
, sizeof(info_msg
),
542 "SYM53C500 at 0x%lx, IRQ %d, %s PIO mode.",
543 SChost
->io_port
, SChost
->irq
, data
->fast_pio
? "fast" : "slow");
547 static int SYM53C500_queue_lck(struct scsi_cmnd
*SCpnt
)
549 struct sym53c500_cmd_priv
*scp
= scsi_cmd_priv(SCpnt
);
551 int port_base
= SCpnt
->device
->host
->io_port
;
552 struct sym53c500_data
*data
=
553 (struct sym53c500_data
*)SCpnt
->device
->host
->hostdata
;
555 VDEB(printk("SYM53C500_queue called\n"));
557 DEB(printk("cmd=%02x, cmd_len=%02x, target=%02x, lun=%02x, bufflen=%d\n",
558 SCpnt
->cmnd
[0], SCpnt
->cmd_len
, SCpnt
->device
->id
,
559 (u8
)SCpnt
->device
->lun
, scsi_bufflen(SCpnt
)));
561 VDEB(for (i
= 0; i
< SCpnt
->cmd_len
; i
++)
562 printk("cmd[%d]=%02x ", i
, SCpnt
->cmnd
[i
]));
565 data
->current_SC
= SCpnt
;
566 scp
->phase
= command_ph
;
570 /* We are locked here already by the mid layer */
572 outb(scmd_id(SCpnt
), port_base
+ DEST_ID
); /* set destination */
573 outb(FLUSH_FIFO
, port_base
+ CMD_REG
); /* reset the fifos */
575 for (i
= 0; i
< SCpnt
->cmd_len
; i
++) {
576 outb(SCpnt
->cmnd
[i
], port_base
+ SCSI_FIFO
);
578 outb(SELECT_NO_ATN
, port_base
+ CMD_REG
);
583 static DEF_SCSI_QCMD(SYM53C500_queue
)
586 SYM53C500_host_reset(struct scsi_cmnd
*SCpnt
)
588 int port_base
= SCpnt
->device
->host
->io_port
;
590 DEB(printk("SYM53C500_host_reset called\n"));
591 spin_lock_irq(SCpnt
->device
->host
->host_lock
);
592 SYM53C500_int_host_reset(port_base
);
593 spin_unlock_irq(SCpnt
->device
->host
->host_lock
);
599 SYM53C500_biosparm(struct scsi_device
*disk
,
600 struct block_device
*dev
,
601 sector_t capacity
, int *info_array
)
605 DEB(printk("SYM53C500_biosparm called\n"));
608 info_array
[0] = 64; /* heads */
609 info_array
[1] = 32; /* sectors */
610 info_array
[2] = size
>> 11; /* cylinders */
611 if (info_array
[2] > 1024) { /* big disk */
614 info_array
[2] = size
/ (255 * 63);
620 SYM53C500_show_pio(struct device
*dev
, struct device_attribute
*attr
,
623 struct Scsi_Host
*SHp
= class_to_shost(dev
);
624 struct sym53c500_data
*data
=
625 (struct sym53c500_data
*)SHp
->hostdata
;
627 return snprintf(buf
, 4, "%d\n", data
->fast_pio
);
631 SYM53C500_store_pio(struct device
*dev
, struct device_attribute
*attr
,
632 const char *buf
, size_t count
)
635 struct Scsi_Host
*SHp
= class_to_shost(dev
);
636 struct sym53c500_data
*data
=
637 (struct sym53c500_data
*)SHp
->hostdata
;
639 pio
= simple_strtoul(buf
, NULL
, 0);
640 if (pio
== 0 || pio
== 1) {
641 data
->fast_pio
= pio
;
649 * SCSI HBA device attributes we want to
650 * make available via sysfs.
652 static struct device_attribute SYM53C500_pio_attr
= {
655 .mode
= (S_IRUGO
| S_IWUSR
),
657 .show
= SYM53C500_show_pio
,
658 .store
= SYM53C500_store_pio
,
661 static struct attribute
*SYM53C500_shost_attrs
[] = {
662 &SYM53C500_pio_attr
.attr
,
666 ATTRIBUTE_GROUPS(SYM53C500_shost
);
669 * scsi_host_template initializer
671 static const struct scsi_host_template sym53c500_driver_template
= {
672 .module
= THIS_MODULE
,
674 .info
= SYM53C500_info
,
675 .queuecommand
= SYM53C500_queue
,
676 .eh_host_reset_handler
= SYM53C500_host_reset
,
677 .bios_param
= SYM53C500_biosparm
,
678 .proc_name
= "SYM53C500",
682 .shost_groups
= SYM53C500_shost_groups
,
683 .cmd_size
= sizeof(struct sym53c500_cmd_priv
),
686 static int SYM53C500_config_check(struct pcmcia_device
*p_dev
, void *priv_data
)
688 p_dev
->io_lines
= 10;
689 p_dev
->resource
[0]->flags
&= ~IO_DATA_PATH_WIDTH
;
690 p_dev
->resource
[0]->flags
|= IO_DATA_PATH_WIDTH_AUTO
;
692 if (p_dev
->resource
[0]->start
== 0)
695 return pcmcia_request_io(p_dev
);
699 SYM53C500_config(struct pcmcia_device
*link
)
701 struct scsi_info_t
*info
= link
->priv
;
703 int irq_level
, port_base
;
704 struct Scsi_Host
*host
;
705 const struct scsi_host_template
*tpnt
= &sym53c500_driver_template
;
706 struct sym53c500_data
*data
;
708 dev_dbg(&link
->dev
, "SYM53C500_config\n");
710 info
->manf_id
= link
->manf_id
;
712 ret
= pcmcia_loop_config(link
, SYM53C500_config_check
, NULL
);
719 ret
= pcmcia_enable_device(link
);
724 * That's the trouble with copying liberally from another driver.
725 * Some things probably aren't relevant, and I suspect this entire
726 * section dealing with manufacturer IDs can be scrapped. --rct
728 if ((info
->manf_id
== MANFID_MACNICA
) ||
729 (info
->manf_id
== MANFID_PIONEER
) ||
730 (info
->manf_id
== 0x0098)) {
732 outb(0xb4, link
->resource
[0]->start
+ 0xd);
733 outb(0x24, link
->resource
[0]->start
+ 0x9);
734 outb(0x04, link
->resource
[0]->start
+ 0xd);
738 * irq_level == 0 implies tpnt->can_queue == 0, which
739 * is not supported in 2.6. Thus, only irq_level > 0
742 * Possible port_base values are as follows:
744 * 0x130, 0x230, 0x280, 0x290,
745 * 0x320, 0x330, 0x340, 0x350
747 port_base
= link
->resource
[0]->start
;
748 irq_level
= link
->irq
;
750 DEB(printk("SYM53C500: port_base=0x%x, irq=%d, fast_pio=%d\n",
751 port_base
, irq_level
, USE_FAST_PIO
);)
753 chip_init(port_base
);
755 host
= scsi_host_alloc(tpnt
, sizeof(struct sym53c500_data
));
757 printk("SYM53C500: Unable to register host, giving up.\n");
761 data
= (struct sym53c500_data
*)host
->hostdata
;
764 if (request_irq(irq_level
, SYM53C500_intr
, IRQF_SHARED
, "SYM53C500", host
)) {
765 printk("SYM53C500: unable to allocate IRQ %d\n", irq_level
);
768 DEB(printk("SYM53C500: allocated IRQ %d\n", irq_level
));
769 } else if (irq_level
== 0) {
770 DEB(printk("SYM53C500: No interrupts detected\n"));
773 DEB(printk("SYM53C500: Shouldn't get here!\n"));
777 host
->unique_id
= port_base
;
778 host
->irq
= irq_level
;
779 host
->io_port
= port_base
;
780 host
->n_io_port
= 0x10;
781 host
->dma_channel
= -1;
784 * Note fast_pio is set to USE_FAST_PIO by
785 * default, but can be changed via "sysfs".
787 data
->fast_pio
= USE_FAST_PIO
;
791 if (scsi_add_host(host
, NULL
))
794 scsi_scan_host(host
);
799 free_irq(irq_level
, host
);
803 release_region(port_base
, 0x10);
804 printk(KERN_INFO
"sym53c500_cs: no SCSI devices found\n");
808 SYM53C500_release(link
);
810 } /* SYM53C500_config */
812 static int sym53c500_resume(struct pcmcia_device
*link
)
814 struct scsi_info_t
*info
= link
->priv
;
816 /* See earlier comment about manufacturer IDs. */
817 if ((info
->manf_id
== MANFID_MACNICA
) ||
818 (info
->manf_id
== MANFID_PIONEER
) ||
819 (info
->manf_id
== 0x0098)) {
820 outb(0x80, link
->resource
[0]->start
+ 0xd);
821 outb(0x24, link
->resource
[0]->start
+ 0x9);
822 outb(0x04, link
->resource
[0]->start
+ 0xd);
825 * If things don't work after a "resume",
826 * this is a good place to start looking.
828 SYM53C500_int_host_reset(link
->resource
[0]->start
);
834 SYM53C500_detach(struct pcmcia_device
*link
)
836 dev_dbg(&link
->dev
, "SYM53C500_detach\n");
838 SYM53C500_release(link
);
842 } /* SYM53C500_detach */
845 SYM53C500_probe(struct pcmcia_device
*link
)
847 struct scsi_info_t
*info
;
849 dev_dbg(&link
->dev
, "SYM53C500_attach()\n");
851 /* Create new SCSI device */
852 info
= kzalloc(sizeof(*info
), GFP_KERNEL
);
857 link
->config_flags
|= CONF_ENABLE_IRQ
| CONF_AUTO_SET_IO
;
859 return SYM53C500_config(link
);
860 } /* SYM53C500_attach */
862 MODULE_AUTHOR("Bob Tracy <rct@frus.com>");
863 MODULE_DESCRIPTION("SYM53C500 PCMCIA SCSI driver");
864 MODULE_LICENSE("GPL");
866 static const struct pcmcia_device_id sym53c500_ids
[] = {
867 PCMCIA_DEVICE_PROD_ID12("BASICS by New Media Corporation", "SCSI Sym53C500", 0x23c78a9d, 0x0099e7f7),
868 PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "SCSI Bus Toaster Sym53C500", 0x085a850b, 0x45432eb8),
869 PCMCIA_DEVICE_PROD_ID2("SCSI9000", 0x21648f44),
872 MODULE_DEVICE_TABLE(pcmcia
, sym53c500_ids
);
874 static struct pcmcia_driver sym53c500_cs_driver
= {
875 .owner
= THIS_MODULE
,
876 .name
= "sym53c500_cs",
877 .probe
= SYM53C500_probe
,
878 .remove
= SYM53C500_detach
,
879 .id_table
= sym53c500_ids
,
880 .resume
= sym53c500_resume
,
882 module_pcmcia_driver(sym53c500_cs_driver
);