2 * Detection routine for the NCR53c710 based BVME6000 SCSI Controllers for Linux.
4 * Based on work by Alan Hourihane and Kars de Jong
6 * Rewritten to use 53c700.c by Richard Hirst <richard@sleepie.demon.co.uk>
9 #include <linux/module.h>
10 #include <linux/blkdev.h>
11 #include <linux/device.h>
12 #include <linux/platform_device.h>
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <asm/bvme6000hw.h>
16 #include <scsi/scsi_host.h>
17 #include <scsi/scsi_device.h>
18 #include <scsi/scsi_transport.h>
19 #include <scsi/scsi_transport_spi.h>
23 MODULE_AUTHOR("Richard Hirst <richard@sleepie.demon.co.uk>");
24 MODULE_DESCRIPTION("BVME6000 NCR53C710 driver");
25 MODULE_LICENSE("GPL");
27 static struct scsi_host_template bvme6000_scsi_driver_template
= {
28 .name
= "BVME6000 NCR53c710 SCSI",
29 .proc_name
= "BVME6000",
31 .module
= THIS_MODULE
,
34 static struct platform_device
*bvme6000_scsi_device
;
37 bvme6000_probe(struct device
*dev
)
39 struct Scsi_Host
*host
;
40 struct NCR_700_Host_Parameters
*hostdata
;
42 if (!MACH_IS_BVME6000
)
45 hostdata
= kzalloc(sizeof(struct NCR_700_Host_Parameters
), GFP_KERNEL
);
47 printk(KERN_ERR
"bvme6000-scsi: "
48 "Failed to allocate host data\n");
52 /* Fill in the required pieces of hostdata */
53 hostdata
->base
= (void __iomem
*)BVME_NCR53C710_BASE
;
54 hostdata
->clock
= 40; /* XXX - depends on the CPU clock! */
55 hostdata
->chip710
= 1;
56 hostdata
->dmode_extra
= DMODE_FC2
;
57 hostdata
->dcntl_extra
= EA_710
;
58 hostdata
->ctest7_extra
= CTEST7_TT1
;
60 /* and register the chip */
61 host
= NCR_700_detect(&bvme6000_scsi_driver_template
, hostdata
, dev
);
63 printk(KERN_ERR
"bvme6000-scsi: No host detected; "
64 "board configuration problem?\n");
67 host
->base
= BVME_NCR53C710_BASE
;
69 host
->irq
= BVME_IRQ_SCSI
;
70 if (request_irq(BVME_IRQ_SCSI
, NCR_700_intr
, 0, "bvme6000-scsi",
72 printk(KERN_ERR
"bvme6000-scsi: request_irq failed\n");
76 dev_set_drvdata(dev
, host
);
90 bvme6000_device_remove(struct device
*dev
)
92 struct Scsi_Host
*host
= dev_get_drvdata(dev
);
93 struct NCR_700_Host_Parameters
*hostdata
= shost_priv(host
);
95 scsi_remove_host(host
);
96 NCR_700_release(host
);
98 free_irq(host
->irq
, host
);
103 static struct device_driver bvme6000_scsi_driver
= {
104 .name
= "bvme6000-scsi",
105 .bus
= &platform_bus_type
,
106 .probe
= bvme6000_probe
,
107 .remove
= __devexit_p(bvme6000_device_remove
),
110 static int __init
bvme6000_scsi_init(void)
114 err
= driver_register(&bvme6000_scsi_driver
);
118 bvme6000_scsi_device
= platform_device_register_simple("bvme6000-scsi",
120 if (IS_ERR(bvme6000_scsi_device
)) {
121 driver_unregister(&bvme6000_scsi_driver
);
122 return PTR_ERR(bvme6000_scsi_device
);
128 static void __exit
bvme6000_scsi_exit(void)
130 platform_device_unregister(bvme6000_scsi_device
);
131 driver_unregister(&bvme6000_scsi_driver
);
134 module_init(bvme6000_scsi_init
);
135 module_exit(bvme6000_scsi_exit
);