diff options
author | Kars de Jong <jongk@linux-m68k.org> | 2007-06-17 08:47:06 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-06-17 17:16:53 -0400 |
commit | 8276b58af4dd1c406aa5fe0fa010a6fc92283cb1 (patch) | |
tree | 3f2478c021dccc97af8a997532481e88210cc882 | |
parent | 632731345bfb87fd1f4dc509928cc4a7efc12a89 (diff) |
[SCSI] 53c700: m68k BVME6000 NCR53C710 SCSI
New driver for the BVME6000 NCR53C710 SCSI controller, using the 53c700 SCSI
core.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/Kconfig | 6 | ||||
-rw-r--r-- | drivers/scsi/Makefile | 1 | ||||
-rw-r--r-- | drivers/scsi/bvme6000_scsi.c | 135 |
3 files changed, 139 insertions, 3 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index da5e888c49d6..17a9efe0f617 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -1008,7 +1008,7 @@ config SCSI_STEX | |||
1008 | 1008 | ||
1009 | config 53C700_BE_BUS | 1009 | config 53C700_BE_BUS |
1010 | bool | 1010 | bool |
1011 | depends on M68K | 1011 | depends on BVME6000_SCSI |
1012 | default y | 1012 | default y |
1013 | 1013 | ||
1014 | config SCSI_SYM53C8XX_2 | 1014 | config SCSI_SYM53C8XX_2 |
@@ -1724,8 +1724,8 @@ config MVME16x_SCSI | |||
1724 | will want to say Y to this question. | 1724 | will want to say Y to this question. |
1725 | 1725 | ||
1726 | config BVME6000_SCSI | 1726 | config BVME6000_SCSI |
1727 | bool "NCR53C710 SCSI driver for BVME6000" | 1727 | tristate "NCR53C710 SCSI driver for BVME6000" |
1728 | depends on BVME6000 && SCSI && BROKEN | 1728 | depends on BVME6000 && SCSI |
1729 | select SCSI_SPI_ATTRS | 1729 | select SCSI_SPI_ATTRS |
1730 | help | 1730 | help |
1731 | The BVME4000 and BVME6000 boards from BVM Ltd use the NCR53C710 | 1731 | The BVME4000 and BVME6000 boards from BVM Ltd use the NCR53C710 |
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index cba39679f947..77dd63d71c5f 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile | |||
@@ -52,6 +52,7 @@ obj-$(CONFIG_ATARI_SCSI) += atari_scsi.o | |||
52 | obj-$(CONFIG_MAC_SCSI) += mac_scsi.o | 52 | obj-$(CONFIG_MAC_SCSI) += mac_scsi.o |
53 | obj-$(CONFIG_SCSI_MAC_ESP) += mac_esp.o NCR53C9x.o | 53 | obj-$(CONFIG_SCSI_MAC_ESP) += mac_esp.o NCR53C9x.o |
54 | obj-$(CONFIG_SUN3_SCSI) += sun3_scsi.o sun3_scsi_vme.o | 54 | obj-$(CONFIG_SUN3_SCSI) += sun3_scsi.o sun3_scsi_vme.o |
55 | obj-$(CONFIG_BVME6000_SCSI) += 53c700.o bvme6000_scsi.o | ||
55 | obj-$(CONFIG_SCSI_SIM710) += 53c700.o sim710.o | 56 | obj-$(CONFIG_SCSI_SIM710) += 53c700.o sim710.o |
56 | obj-$(CONFIG_SCSI_ADVANSYS) += advansys.o | 57 | obj-$(CONFIG_SCSI_ADVANSYS) += advansys.o |
57 | obj-$(CONFIG_SCSI_PSI240I) += psi240i.o | 58 | obj-$(CONFIG_SCSI_PSI240I) += psi240i.o |
diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c new file mode 100644 index 000000000000..1a79e1847d17 --- /dev/null +++ b/drivers/scsi/bvme6000_scsi.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * Detection routine for the NCR53c710 based BVME6000 SCSI Controllers for Linux. | ||
3 | * | ||
4 | * Based on work by Alan Hourihane and Kars de Jong | ||
5 | * | ||
6 | * Rewritten to use 53c700.c by Richard Hirst <richard@sleepie.demon.co.uk> | ||
7 | */ | ||
8 | |||
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> | ||
20 | |||
21 | #include "53c700.h" | ||
22 | |||
23 | MODULE_AUTHOR("Richard Hirst <richard@sleepie.demon.co.uk>"); | ||
24 | MODULE_DESCRIPTION("BVME6000 NCR53C710 driver"); | ||
25 | MODULE_LICENSE("GPL"); | ||
26 | |||
27 | static struct scsi_host_template bvme6000_scsi_driver_template = { | ||
28 | .name = "BVME6000 NCR53c710 SCSI", | ||
29 | .proc_name = "BVME6000", | ||
30 | .this_id = 7, | ||
31 | .module = THIS_MODULE, | ||
32 | }; | ||
33 | |||
34 | static struct platform_device *bvme6000_scsi_device; | ||
35 | |||
36 | static __devinit int | ||
37 | bvme6000_probe(struct device *dev) | ||
38 | { | ||
39 | struct Scsi_Host * host = NULL; | ||
40 | struct NCR_700_Host_Parameters *hostdata; | ||
41 | |||
42 | if (!MACH_IS_BVME6000) | ||
43 | goto out; | ||
44 | |||
45 | hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); | ||
46 | if (hostdata == NULL) { | ||
47 | printk(KERN_ERR "bvme6000-scsi: " | ||
48 | "Failed to allocate host data\n"); | ||
49 | goto out; | ||
50 | } | ||
51 | memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); | ||
52 | |||
53 | /* Fill in the required pieces of hostdata */ | ||
54 | hostdata->base = (void __iomem *)BVME_NCR53C710_BASE; | ||
55 | hostdata->clock = 40; /* XXX - depends on the CPU clock! */ | ||
56 | hostdata->chip710 = 1; | ||
57 | hostdata->dmode_extra = DMODE_FC2; | ||
58 | hostdata->dcntl_extra = EA_710; | ||
59 | hostdata->ctest7_extra = CTEST7_TT1; | ||
60 | |||
61 | /* and register the chip */ | ||
62 | host = NCR_700_detect(&bvme6000_scsi_driver_template, hostdata, dev); | ||
63 | if (!host) { | ||
64 | printk(KERN_ERR "bvme6000-scsi: No host detected; " | ||
65 | "board configuration problem?\n"); | ||
66 | goto out_free; | ||
67 | } | ||
68 | host->base = BVME_NCR53C710_BASE; | ||
69 | host->this_id = 7; | ||
70 | host->irq = BVME_IRQ_SCSI; | ||
71 | if (request_irq(BVME_IRQ_SCSI, NCR_700_intr, 0, "bvme6000-scsi", | ||
72 | host)) { | ||
73 | printk(KERN_ERR "bvme6000-scsi: request_irq failed\n"); | ||
74 | goto out_put_host; | ||
75 | } | ||
76 | |||
77 | scsi_scan_host(host); | ||
78 | |||
79 | return 0; | ||
80 | |||
81 | out_put_host: | ||
82 | scsi_host_put(host); | ||
83 | out_free: | ||
84 | kfree(hostdata); | ||
85 | out: | ||
86 | return -ENODEV; | ||
87 | } | ||
88 | |||
89 | static __devexit int | ||
90 | bvme6000_device_remove(struct device *dev) | ||
91 | { | ||
92 | struct Scsi_Host *host = dev_to_shost(dev); | ||
93 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | ||
94 | |||
95 | scsi_remove_host(host); | ||
96 | NCR_700_release(host); | ||
97 | kfree(hostdata); | ||
98 | free_irq(host->irq, host); | ||
99 | |||
100 | return 0; | ||
101 | } | ||
102 | |||
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), | ||
108 | }; | ||
109 | |||
110 | static int __init bvme6000_scsi_init(void) | ||
111 | { | ||
112 | int err; | ||
113 | |||
114 | err = driver_register(&bvme6000_scsi_driver); | ||
115 | if (err) { | ||
116 | return err; | ||
117 | |||
118 | bvme6000_scsi_device = platform_device_register_simple("bvme6000-scsi", | ||
119 | -1, NULL, 0); | ||
120 | if (IS_ERR(bvme6000_scsi_device)) { | ||
121 | driver_unregister(&bvme6000_scsi_driver); | ||
122 | return PTR_ERR(bvme6000_scsi_device); | ||
123 | } | ||
124 | |||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static void __exit bvme6000_scsi_exit(void) | ||
129 | { | ||
130 | platform_device_unregister(bvme6000_scsi_device); | ||
131 | driver_unregister(&bvme6000_scsi_driver); | ||
132 | } | ||
133 | |||
134 | module_init(bvme6000_scsi_init); | ||
135 | module_exit(bvme6000_scsi_exit); | ||