aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorKars de Jong <jongk@linux-m68k.org>2007-06-17 08:47:07 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-06-17 17:17:40 -0400
commit506c7bbcd9bc042a782bdcdb0c926de4c9d62028 (patch)
tree47ad6a88bea43d2dcae6d3e5315e28df4b8c6710 /drivers/scsi
parent8276b58af4dd1c406aa5fe0fa010a6fc92283cb1 (diff)
[SCSI] 53c700: m68k MVME16x NCR53C710 SCSI
New driver for the MVME16x 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>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/Kconfig6
-rw-r--r--drivers/scsi/Makefile1
-rw-r--r--drivers/scsi/mvme16x_scsi.c158
3 files changed, 162 insertions, 3 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 17a9efe0f617..915bf6caffe0 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1008,7 +1008,7 @@ config SCSI_STEX
1008 1008
1009config 53C700_BE_BUS 1009config 53C700_BE_BUS
1010 bool 1010 bool
1011 depends on BVME6000_SCSI 1011 depends on MVME16x_SCSI || BVME6000_SCSI
1012 default y 1012 default y
1013 1013
1014config SCSI_SYM53C8XX_2 1014config SCSI_SYM53C8XX_2
@@ -1715,8 +1715,8 @@ config MVME147_SCSI
1715 single-board computer. 1715 single-board computer.
1716 1716
1717config MVME16x_SCSI 1717config MVME16x_SCSI
1718 bool "NCR53C710 SCSI driver for MVME16x" 1718 tristate "NCR53C710 SCSI driver for MVME16x"
1719 depends on MVME16x && SCSI && BROKEN 1719 depends on MVME16x && SCSI
1720 select SCSI_SPI_ATTRS 1720 select SCSI_SPI_ATTRS
1721 help 1721 help
1722 The Motorola MVME162, 166, 167, 172 and 177 boards use the NCR53C710 1722 The Motorola MVME162, 166, 167, 172 and 177 boards use the NCR53C710
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 77dd63d71c5f..4bc4ef8d4209 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -52,6 +52,7 @@ obj-$(CONFIG_ATARI_SCSI) += atari_scsi.o
52obj-$(CONFIG_MAC_SCSI) += mac_scsi.o 52obj-$(CONFIG_MAC_SCSI) += mac_scsi.o
53obj-$(CONFIG_SCSI_MAC_ESP) += mac_esp.o NCR53C9x.o 53obj-$(CONFIG_SCSI_MAC_ESP) += mac_esp.o NCR53C9x.o
54obj-$(CONFIG_SUN3_SCSI) += sun3_scsi.o sun3_scsi_vme.o 54obj-$(CONFIG_SUN3_SCSI) += sun3_scsi.o sun3_scsi_vme.o
55obj-$(CONFIG_MVME16x_SCSI) += 53c700.o mvme16x_scsi.o
55obj-$(CONFIG_BVME6000_SCSI) += 53c700.o bvme6000_scsi.o 56obj-$(CONFIG_BVME6000_SCSI) += 53c700.o bvme6000_scsi.o
56obj-$(CONFIG_SCSI_SIM710) += 53c700.o sim710.o 57obj-$(CONFIG_SCSI_SIM710) += 53c700.o sim710.o
57obj-$(CONFIG_SCSI_ADVANSYS) += advansys.o 58obj-$(CONFIG_SCSI_ADVANSYS) += advansys.o
diff --git a/drivers/scsi/mvme16x_scsi.c b/drivers/scsi/mvme16x_scsi.c
new file mode 100644
index 000000000000..d6ef22a941c4
--- /dev/null
+++ b/drivers/scsi/mvme16x_scsi.c
@@ -0,0 +1,158 @@
1/*
2 * Detection routine for the NCR53c710 based MVME16x SCSI Controllers for Linux.
3 *
4 * Based on work by Alan Hourihane
5 *
6 * Rewritten to use 53c700.c by Kars de Jong <jongk@linux-m68k.org>
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/mvme16xhw.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
23MODULE_AUTHOR("Kars de Jong <jongk@linux-m68k.org>");
24MODULE_DESCRIPTION("MVME16x NCR53C710 driver");
25MODULE_LICENSE("GPL");
26
27static struct scsi_host_template mvme16x_scsi_driver_template = {
28 .name = "MVME16x NCR53c710 SCSI",
29 .proc_name = "MVME16x",
30 .this_id = 7,
31 .module = THIS_MODULE,
32};
33
34static struct platform_device *mvme16x_scsi_device;
35
36static __devinit int
37mvme16x_probe(struct device *dev)
38{
39 struct Scsi_Host * host = NULL;
40 struct NCR_700_Host_Parameters *hostdata;
41
42 if (!MACH_IS_MVME16x)
43 goto out;
44
45 if (mvme16x_config & MVME16x_CONFIG_NO_SCSICHIP) {
46 printk(KERN_INFO "mvme16x-scsi: detection disabled, "
47 "SCSI chip not present\n");
48 goto out;
49 }
50
51 hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
52 if (hostdata == NULL) {
53 printk(KERN_ERR "mvme16x-scsi: "
54 "Failed to allocate host data\n");
55 goto out;
56 }
57 memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));
58
59 /* Fill in the required pieces of hostdata */
60 hostdata->base = (void __iomem *)0xfff47000UL;
61 hostdata->clock = 50; /* XXX - depends on the CPU clock! */
62 hostdata->chip710 = 1;
63 hostdata->dmode_extra = DMODE_FC2;
64 hostdata->dcntl_extra = EA_710;
65 hostdata->ctest7_extra = CTEST7_TT1;
66
67 /* and register the chip */
68 host = NCR_700_detect(&mvme16x_scsi_driver_template, hostdata, dev);
69 if (!host) {
70 printk(KERN_ERR "mvme16x-scsi: No host detected; "
71 "board configuration problem?\n");
72 goto out_free;
73 }
74 host->this_id = 7;
75 host->base = 0xfff47000UL;
76 host->irq = MVME16x_IRQ_SCSI;
77 if (request_irq(host->irq, NCR_700_intr, 0, "mvme16x-scsi", host)) {
78 printk(KERN_ERR "mvme16x-scsi: request_irq failed\n");
79 goto out_put_host;
80 }
81
82 /* Enable scsi chip ints */
83 {
84 volatile unsigned long v;
85
86 /* Enable scsi interrupts at level 4 in PCCchip2 */
87 v = in_be32(0xfff4202c);
88 v = (v & ~0xff) | 0x10 | 4;
89 out_be32(0xfff4202c, v);
90 }
91
92 scsi_scan_host(host);
93
94 return 0;
95
96 out_put_host:
97 scsi_host_put(host);
98 out_free:
99 kfree(hostdata);
100 out:
101 return -ENODEV;
102}
103
104static __devexit int
105mvme16x_device_remove(struct device *dev)
106{
107 struct Scsi_Host *host = dev_to_shost(dev);
108 struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
109
110 /* Disable scsi chip ints */
111 {
112 volatile unsigned long v;
113
114 v = in_be32(0xfff4202c);
115 v &= ~0x10;
116 out_be32(0xfff4202c, v);
117 }
118 scsi_remove_host(host);
119 NCR_700_release(host);
120 kfree(hostdata);
121 free_irq(host->irq, host);
122
123 return 0;
124}
125
126static struct device_driver mvme16x_scsi_driver = {
127 .name = "mvme16x-scsi",
128 .bus = &platform_bus_type,
129 .probe = mvme16x_probe,
130 .remove = __devexit_p(mvme16x_device_remove),
131};
132
133static int __init mvme16x_scsi_init(void)
134{
135 int err;
136
137 err = driver_register(&mvme16x_scsi_driver);
138 if (err)
139 return err;
140
141 mvme16x_scsi_device = platform_device_register_simple("mvme16x-scsi",
142 -1, NULL, 0);
143 if (IS_ERR(mvme16x_scsi_device)) {
144 driver_unregister(&mvme16x_scsi_driver);
145 return PTR_ERR(mvme16x_scsi_device);
146 }
147
148 return 0;
149}
150
151static void __exit mvme16x_scsi_exit(void)
152{
153 platform_device_unregister(mvme16x_scsi_device);
154 driver_unregister(&mvme16x_scsi_driver);
155}
156
157module_init(mvme16x_scsi_init);
158module_exit(mvme16x_scsi_exit);