2 /* #define PSEUDO_DMA */
5 * EcoSCSI Generic NCR5380 driver
7 * Copyright 1995, Russell King
11 * For more information, please consult
14 * SCSI Protocol Controller
17 * NCR Microelectronics
18 * 1635 Aeroplaza Drive
19 * Colorado Springs, CO 80916
24 #include <linux/module.h>
25 #include <linux/signal.h>
26 #include <linux/ioport.h>
27 #include <linux/delay.h>
28 #include <linux/init.h>
29 #include <linux/blkdev.h>
32 #include <asm/system.h>
35 #include <scsi/scsi_host.h>
37 #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata)
39 #define NCR5380_local_declare() void __iomem *_base
40 #define NCR5380_setup(host) _base = priv(host)->base
42 #define NCR5380_read(reg) ({ writeb(reg | 8, _base); readb(_base + 4); })
43 #define NCR5380_write(reg, value) ({ writeb(reg | 8, _base); writeb(value, _base + 4); })
45 #define NCR5380_intr ecoscsi_intr
46 #define NCR5380_queue_command ecoscsi_queue_command
47 #define NCR5380_proc_info ecoscsi_proc_info
49 #define NCR5380_implementation_fields \
52 #include "../NCR5380.h"
54 #define ECOSCSI_PUBLIC_RELEASE 1
57 * Function : ecoscsi_setup(char *str, int *ints)
59 * Purpose : LILO command line initialization of the overrides array,
61 * Inputs : str - unused, ints - array of integer parameters with ints[0]
62 * equal to the number of ints.
66 void ecoscsi_setup(char *str, int *ints)
70 const char * ecoscsi_info (struct Scsi_Host *spnt)
75 #define BOARD_NORMAL 0
76 #define BOARD_NCR53C400 1
78 #include "../NCR5380.c"
80 static struct scsi_host_template ecoscsi_template = {
81 .module = THIS_MODULE,
82 .name = "Serial Port EcoSCSI NCR5380",
83 .proc_name = "ecoscsi",
85 .queuecommand = ecoscsi_queue_command,
86 .eh_abort_handler = NCR5380_abort,
87 .eh_bus_reset_handler = NCR5380_bus_reset,
90 .sg_tablesize = SG_ALL,
92 .use_clustering = DISABLE_CLUSTERING
95 static struct Scsi_Host *host;
97 static int __init ecoscsi_init(void)
102 if (!request_mem_region(0x33a0000, 4096, "ecoscsi")) {
107 _base = ioremap(0x33a0000, 4096);
113 NCR5380_write(MODE_REG, 0x20); /* Is it really SCSI? */
114 if (NCR5380_read(MODE_REG) != 0x20) /* Write to a reg. */
117 NCR5380_write(MODE_REG, 0x00); /* it back. */
118 if (NCR5380_read(MODE_REG) != 0x00)
121 host = scsi_host_alloc(tpnt, sizeof(struct NCR5380_hostdata));
127 priv(host)->base = _base;
128 host->irq = IRQ_NONE;
130 NCR5380_init(host, 0);
132 printk("scsi%d: at port 0x%08lx irqs disabled", host->host_no, host->io_port);
133 printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d",
134 host->can_queue, host->cmd_per_lun, ECOSCSI_PUBLIC_RELEASE);
135 printk("\nscsi%d:", host->host_no);
136 NCR5380_print_options(host);
139 scsi_add_host(host, NULL); /* XXX handle failure */
140 scsi_scan_host(host);
146 release_mem_region(0x33a0000, 4096);
151 static void __exit ecoscsi_exit(void)
153 scsi_remove_host(host);
156 release_mem_region(0x33a0000, 4096);
160 module_init(ecoscsi_init);
161 module_exit(ecoscsi_exit);
163 MODULE_AUTHOR("Russell King");
164 MODULE_DESCRIPTION("Econet-SCSI driver for Acorn machines");
165 MODULE_LICENSE("GPL");