2 * Detection routine for the NCR53c710 based Amiga SCSI Controllers for Linux.
3 * Amiga MacroSystemUS WarpEngine SCSI controller.
4 * Amiga Technologies/DKB A4091 SCSI controller.
6 * Written 1997 by Alan Hourihane <alanh@fairlite.demon.co.uk>
7 * plus modifications of the 53c7xx.c driver to support the Amiga.
9 * Rewritten to use 53c700.c by Kars de Jong <jongk@linux-m68k.org>
12 #include <linux/module.h>
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <linux/zorro.h>
16 #include <linux/slab.h>
18 #include <asm/amigahw.h>
19 #include <asm/amigaints.h>
21 #include <scsi/scsi_host.h>
22 #include <scsi/scsi_transport_spi.h>
26 MODULE_AUTHOR("Alan Hourihane <alanh@fairlite.demon.co.uk> / Kars de Jong <jongk@linux-m68k.org>");
27 MODULE_DESCRIPTION("Amiga Zorro NCR53C710 driver");
28 MODULE_LICENSE("GPL");
31 static struct scsi_host_template zorro7xx_scsi_driver_template = {
32 .proc_name = "zorro7xx",
34 .module = THIS_MODULE,
37 static struct zorro_driver_data {
40 int absolute; /* offset is absolute address */
41 } zorro7xx_driver_data[] = {
42 { .name = "PowerUP 603e+", .offset = 0xf40000, .absolute = 1 },
43 { .name = "WarpEngine 40xx", .offset = 0x40000 },
44 { .name = "A4091", .offset = 0x800000 },
45 { .name = "GForce 040/060", .offset = 0x40000 },
49 static struct zorro_device_id zorro7xx_zorro_tbl[] = {
51 .id = ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS,
52 .driver_data = (unsigned long)&zorro7xx_driver_data[0],
55 .id = ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE_40xx,
56 .driver_data = (unsigned long)&zorro7xx_driver_data[1],
59 .id = ZORRO_PROD_CBM_A4091_1,
60 .driver_data = (unsigned long)&zorro7xx_driver_data[2],
63 .id = ZORRO_PROD_CBM_A4091_2,
64 .driver_data = (unsigned long)&zorro7xx_driver_data[2],
67 .id = ZORRO_PROD_GVP_GFORCE_040_060,
68 .driver_data = (unsigned long)&zorro7xx_driver_data[3],
72 MODULE_DEVICE_TABLE(zorro, zorro7xx_zorro_tbl);
74 static int zorro7xx_init_one(struct zorro_dev *z,
75 const struct zorro_device_id *ent)
77 struct Scsi_Host *host;
78 struct NCR_700_Host_Parameters *hostdata;
79 struct zorro_driver_data *zdd;
80 unsigned long board, ioaddr;
82 board = zorro_resource_start(z);
83 zdd = (struct zorro_driver_data *)ent->driver_data;
88 ioaddr = board + zdd->offset;
91 if (!zorro_request_device(z, zdd->name)) {
92 printk(KERN_ERR "zorro7xx: cannot reserve region 0x%lx, abort\n",
97 hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
99 printk(KERN_ERR "zorro7xx: Failed to allocate host data\n");
103 /* Fill in the required pieces of hostdata */
104 if (ioaddr > 0x01000000)
105 hostdata->base = ioremap(ioaddr, zorro_resource_len(z));
107 hostdata->base = ZTWO_VADDR(ioaddr);
109 hostdata->clock = 50;
110 hostdata->chip710 = 1;
112 /* Settings for at least WarpEngine 40xx */
113 hostdata->ctest7_extra = CTEST7_TT1;
115 zorro7xx_scsi_driver_template.name = zdd->name;
117 /* and register the chip */
118 host = NCR_700_detect(&zorro7xx_scsi_driver_template, hostdata,
121 printk(KERN_ERR "zorro7xx: No host detected; "
122 "board configuration problem?\n");
128 host->irq = IRQ_AMIGA_PORTS;
130 if (request_irq(host->irq, NCR_700_intr, IRQF_SHARED, "zorro7xx-scsi",
132 printk(KERN_ERR "zorro7xx: request_irq failed\n");
136 zorro_set_drvdata(z, host);
137 scsi_scan_host(host);
144 if (ioaddr > 0x01000000)
145 iounmap(hostdata->base);
148 zorro_release_device(z);
153 static void zorro7xx_remove_one(struct zorro_dev *z)
155 struct Scsi_Host *host = zorro_get_drvdata(z);
156 struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
158 scsi_remove_host(host);
160 NCR_700_release(host);
162 free_irq(host->irq, host);
163 zorro_release_device(z);
166 static struct zorro_driver zorro7xx_driver = {
167 .name = "zorro7xx-scsi",
168 .id_table = zorro7xx_zorro_tbl,
169 .probe = zorro7xx_init_one,
170 .remove = zorro7xx_remove_one,
173 static int __init zorro7xx_scsi_init(void)
175 return zorro_register_driver(&zorro7xx_driver);
178 static void __exit zorro7xx_scsi_exit(void)
180 zorro_unregister_driver(&zorro7xx_driver);
183 module_init(zorro7xx_scsi_init);
184 module_exit(zorro7xx_scsi_exit);