This source file includes following definitions.
- lasi700_probe
- lasi700_driver_remove
- lasi700_init
- lasi700_exit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include <linux/kernel.h>
23 #include <linux/module.h>
24 #include <linux/init.h>
25 #include <linux/types.h>
26 #include <linux/stat.h>
27 #include <linux/mm.h>
28 #include <linux/blkdev.h>
29 #include <linux/ioport.h>
30 #include <linux/dma-mapping.h>
31 #include <linux/slab.h>
32
33 #include <asm/page.h>
34 #include <asm/pgtable.h>
35 #include <asm/irq.h>
36 #include <asm/hardware.h>
37 #include <asm/parisc-device.h>
38 #include <asm/delay.h>
39
40 #include <scsi/scsi_host.h>
41 #include <scsi/scsi_device.h>
42 #include <scsi/scsi_transport.h>
43 #include <scsi/scsi_transport_spi.h>
44
45 #include "53c700.h"
46
47 MODULE_AUTHOR("James Bottomley");
48 MODULE_DESCRIPTION("lasi700 SCSI Driver");
49 MODULE_LICENSE("GPL");
50
51 #define LASI_700_SVERSION 0x00071
52 #define LASI_710_SVERSION 0x00082
53
54 #define LASI700_ID_TABLE { \
55 .hw_type = HPHW_FIO, \
56 .sversion = LASI_700_SVERSION, \
57 .hversion = HVERSION_ANY_ID, \
58 .hversion_rev = HVERSION_REV_ANY_ID, \
59 }
60
61 #define LASI710_ID_TABLE { \
62 .hw_type = HPHW_FIO, \
63 .sversion = LASI_710_SVERSION, \
64 .hversion = HVERSION_ANY_ID, \
65 .hversion_rev = HVERSION_REV_ANY_ID, \
66 }
67
68 #define LASI700_CLOCK 25
69 #define LASI710_CLOCK 40
70 #define LASI_SCSI_CORE_OFFSET 0x100
71
72 static const struct parisc_device_id lasi700_ids[] __initconst = {
73 LASI700_ID_TABLE,
74 LASI710_ID_TABLE,
75 { 0 }
76 };
77
78 static struct scsi_host_template lasi700_template = {
79 .name = "LASI SCSI 53c700",
80 .proc_name = "lasi700",
81 .this_id = 7,
82 .module = THIS_MODULE,
83 };
84 MODULE_DEVICE_TABLE(parisc, lasi700_ids);
85
86 static int __init
87 lasi700_probe(struct parisc_device *dev)
88 {
89 unsigned long base = dev->hpa.start + LASI_SCSI_CORE_OFFSET;
90 struct NCR_700_Host_Parameters *hostdata;
91 struct Scsi_Host *host;
92
93 hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL);
94 if (!hostdata) {
95 dev_printk(KERN_ERR, &dev->dev, "Failed to allocate host data\n");
96 return -ENOMEM;
97 }
98
99 hostdata->dev = &dev->dev;
100 dma_set_mask(&dev->dev, DMA_BIT_MASK(32));
101 hostdata->base = ioremap_nocache(base, 0x100);
102 hostdata->differential = 0;
103
104 if (dev->id.sversion == LASI_700_SVERSION) {
105 hostdata->clock = LASI700_CLOCK;
106 hostdata->force_le_on_be = 1;
107 } else {
108 hostdata->clock = LASI710_CLOCK;
109 hostdata->force_le_on_be = 0;
110 hostdata->chip710 = 1;
111 hostdata->dmode_extra = DMODE_FC2;
112 hostdata->burst_length = 8;
113 }
114
115 host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev);
116 if (!host)
117 goto out_kfree;
118 host->this_id = 7;
119 host->base = base;
120 host->irq = dev->irq;
121 if(request_irq(dev->irq, NCR_700_intr, IRQF_SHARED, "lasi700", host)) {
122 printk(KERN_ERR "lasi700: request_irq failed!\n");
123 goto out_put_host;
124 }
125
126 dev_set_drvdata(&dev->dev, host);
127 scsi_scan_host(host);
128
129 return 0;
130
131 out_put_host:
132 scsi_host_put(host);
133 out_kfree:
134 iounmap(hostdata->base);
135 kfree(hostdata);
136 return -ENODEV;
137 }
138
139 static int __exit
140 lasi700_driver_remove(struct parisc_device *dev)
141 {
142 struct Scsi_Host *host = dev_get_drvdata(&dev->dev);
143 struct NCR_700_Host_Parameters *hostdata =
144 (struct NCR_700_Host_Parameters *)host->hostdata[0];
145
146 scsi_remove_host(host);
147 NCR_700_release(host);
148 free_irq(host->irq, host);
149 iounmap(hostdata->base);
150 kfree(hostdata);
151
152 return 0;
153 }
154
155 static struct parisc_driver lasi700_driver __refdata = {
156 .name = "lasi_scsi",
157 .id_table = lasi700_ids,
158 .probe = lasi700_probe,
159 .remove = __exit_p(lasi700_driver_remove),
160 };
161
162 static int __init
163 lasi700_init(void)
164 {
165 return register_parisc_driver(&lasi700_driver);
166 }
167
168 static void __exit
169 lasi700_exit(void)
170 {
171 unregister_parisc_driver(&lasi700_driver);
172 }
173
174 module_init(lasi700_init);
175 module_exit(lasi700_exit);