aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_qdi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_qdi.c')
-rw-r--r--drivers/ata/pata_qdi.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index ededb40e084d..35cfdf0ac3f0 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -36,7 +36,7 @@ struct qdi_data {
36 u8 last; 36 u8 last;
37 int fast; 37 int fast;
38 struct platform_device *platform_dev; 38 struct platform_device *platform_dev;
39 39
40}; 40};
41 41
42static struct ata_host *qdi_host[NR_HOST]; 42static struct ata_host *qdi_host[NR_HOST];
@@ -58,7 +58,7 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)
58 58
59 /* Get the timing data in cycles */ 59 /* Get the timing data in cycles */
60 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 60 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
61 61
62 if (qdi->fast) { 62 if (qdi->fast) {
63 active = 8 - FIT(t.active, 1, 8); 63 active = 8 - FIT(t.active, 1, 8);
64 recovery = 18 - FIT(t.recover, 3, 18); 64 recovery = 18 - FIT(t.recover, 3, 18);
@@ -67,10 +67,10 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)
67 recovery = 15 - FIT(t.recover, 0, 15); 67 recovery = 15 - FIT(t.recover, 0, 15);
68 } 68 }
69 timing = (recovery << 4) | active | 0x08; 69 timing = (recovery << 4) | active | 0x08;
70 70
71 qdi->clock[adev->devno] = timing; 71 qdi->clock[adev->devno] = timing;
72 72
73 outb(timing, qdi->timing); 73 outb(timing, qdi->timing);
74} 74}
75 75
76static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) 76static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev)
@@ -82,7 +82,7 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev)
82 82
83 /* Get the timing data in cycles */ 83 /* Get the timing data in cycles */
84 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 84 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
85 85
86 if (qdi->fast) { 86 if (qdi->fast) {
87 active = 8 - FIT(t.active, 1, 8); 87 active = 8 - FIT(t.active, 1, 8);
88 recovery = 18 - FIT(t.recover, 3, 18); 88 recovery = 18 - FIT(t.recover, 3, 18);
@@ -91,11 +91,11 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev)
91 recovery = 15 - FIT(t.recover, 0, 15); 91 recovery = 15 - FIT(t.recover, 0, 15);
92 } 92 }
93 timing = (recovery << 4) | active | 0x08; 93 timing = (recovery << 4) | active | 0x08;
94 94
95 qdi->clock[adev->devno] = timing; 95 qdi->clock[adev->devno] = timing;
96 96
97 outb(timing, qdi->timing); 97 outb(timing, qdi->timing);
98 98
99 /* Clear the FIFO */ 99 /* Clear the FIFO */
100 if (adev->class != ATA_DEV_ATA) 100 if (adev->class != ATA_DEV_ATA)
101 outb(0x5F, (qdi->timing & 0xFFF0) + 3); 101 outb(0x5F, (qdi->timing & 0xFFF0) + 3);
@@ -128,13 +128,13 @@ static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned
128{ 128{
129 struct ata_port *ap = adev->ap; 129 struct ata_port *ap = adev->ap;
130 int slop = buflen & 3; 130 int slop = buflen & 3;
131 131
132 if (ata_id_has_dword_io(adev->id)) { 132 if (ata_id_has_dword_io(adev->id)) {
133 if (write_data) 133 if (write_data)
134 outsl(ap->ioaddr.data_addr, buf, buflen >> 2); 134 outsl(ap->ioaddr.data_addr, buf, buflen >> 2);
135 else 135 else
136 insl(ap->ioaddr.data_addr, buf, buflen >> 2); 136 insl(ap->ioaddr.data_addr, buf, buflen >> 2);
137 137
138 if (unlikely(slop)) { 138 if (unlikely(slop)) {
139 u32 pad; 139 u32 pad;
140 if (write_data) { 140 if (write_data) {
@@ -181,7 +181,7 @@ static struct ata_port_operations qdi6500_port_ops = {
181 .thaw = ata_bmdma_thaw, 181 .thaw = ata_bmdma_thaw,
182 .error_handler = ata_bmdma_error_handler, 182 .error_handler = ata_bmdma_error_handler,
183 .post_internal_cmd = ata_bmdma_post_internal_cmd, 183 .post_internal_cmd = ata_bmdma_post_internal_cmd,
184 184
185 .qc_prep = ata_qc_prep, 185 .qc_prep = ata_qc_prep,
186 .qc_issue = qdi_qc_issue_prot, 186 .qc_issue = qdi_qc_issue_prot,
187 .eng_timeout = ata_eng_timeout, 187 .eng_timeout = ata_eng_timeout,
@@ -189,11 +189,11 @@ static struct ata_port_operations qdi6500_port_ops = {
189 189
190 .irq_handler = ata_interrupt, 190 .irq_handler = ata_interrupt,
191 .irq_clear = ata_bmdma_irq_clear, 191 .irq_clear = ata_bmdma_irq_clear,
192 192
193 .port_start = ata_port_start, 193 .port_start = ata_port_start,
194 .port_stop = ata_port_stop, 194 .port_stop = ata_port_stop,
195 .host_stop = ata_host_stop 195 .host_stop = ata_host_stop
196}; 196};
197 197
198static struct ata_port_operations qdi6580_port_ops = { 198static struct ata_port_operations qdi6580_port_ops = {
199 .port_disable = ata_port_disable, 199 .port_disable = ata_port_disable,
@@ -209,7 +209,7 @@ static struct ata_port_operations qdi6580_port_ops = {
209 .thaw = ata_bmdma_thaw, 209 .thaw = ata_bmdma_thaw,
210 .error_handler = ata_bmdma_error_handler, 210 .error_handler = ata_bmdma_error_handler,
211 .post_internal_cmd = ata_bmdma_post_internal_cmd, 211 .post_internal_cmd = ata_bmdma_post_internal_cmd,
212 212
213 .qc_prep = ata_qc_prep, 213 .qc_prep = ata_qc_prep,
214 .qc_issue = qdi_qc_issue_prot, 214 .qc_issue = qdi_qc_issue_prot,
215 .eng_timeout = ata_eng_timeout, 215 .eng_timeout = ata_eng_timeout,
@@ -217,11 +217,11 @@ static struct ata_port_operations qdi6580_port_ops = {
217 217
218 .irq_handler = ata_interrupt, 218 .irq_handler = ata_interrupt,
219 .irq_clear = ata_bmdma_irq_clear, 219 .irq_clear = ata_bmdma_irq_clear,
220 220
221 .port_start = ata_port_start, 221 .port_start = ata_port_start,
222 .port_stop = ata_port_stop, 222 .port_stop = ata_port_stop,
223 .host_stop = ata_host_stop 223 .host_stop = ata_host_stop
224}; 224};
225 225
226/** 226/**
227 * qdi_init_one - attach a qdi interface 227 * qdi_init_one - attach a qdi interface
@@ -233,7 +233,7 @@ static struct ata_port_operations qdi6580_port_ops = {
233 * Register an ISA bus IDE interface. Such interfaces are PIO and we 233 * Register an ISA bus IDE interface. Such interfaces are PIO and we
234 * assume do not support IRQ sharing. 234 * assume do not support IRQ sharing.
235 */ 235 */
236 236
237static __init int qdi_init_one(unsigned long port, int type, unsigned long io, int irq, int fast) 237static __init int qdi_init_one(unsigned long port, int type, unsigned long io, int irq, int fast)
238{ 238{
239 struct ata_probe_ent ae; 239 struct ata_probe_ent ae;
@@ -249,11 +249,11 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
249 pdev = platform_device_register_simple(DRV_NAME, nr_qdi_host, NULL, 0); 249 pdev = platform_device_register_simple(DRV_NAME, nr_qdi_host, NULL, 0);
250 if (pdev == NULL) 250 if (pdev == NULL)
251 return -ENOMEM; 251 return -ENOMEM;
252 252
253 memset(&ae, 0, sizeof(struct ata_probe_ent)); 253 memset(&ae, 0, sizeof(struct ata_probe_ent));
254 INIT_LIST_HEAD(&ae.node); 254 INIT_LIST_HEAD(&ae.node);
255 ae.dev = &pdev->dev; 255 ae.dev = &pdev->dev;
256 256
257 if (type == 6580) { 257 if (type == 6580) {
258 ae.port_ops = &qdi6580_port_ops; 258 ae.port_ops = &qdi6580_port_ops;
259 ae.pio_mask = 0x1F; 259 ae.pio_mask = 0x1F;
@@ -261,7 +261,7 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
261 ae.port_ops = &qdi6500_port_ops; 261 ae.port_ops = &qdi6500_port_ops;
262 ae.pio_mask = 0x07; /* Actually PIO3 !IORDY is possible */ 262 ae.pio_mask = 0x07; /* Actually PIO3 !IORDY is possible */
263 } 263 }
264 264
265 ae.sht = &qdi_sht; 265 ae.sht = &qdi_sht;
266 ae.n_ports = 1; 266 ae.n_ports = 1;
267 ae.irq = irq; 267 ae.irq = irq;
@@ -287,9 +287,9 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
287 platform_device_unregister(pdev); 287 platform_device_unregister(pdev);
288 return -ENODEV; 288 return -ENODEV;
289 } 289 }
290 290
291 qdi_host[nr_qdi_host++] = dev_get_drvdata(&pdev->dev); 291 qdi_host[nr_qdi_host++] = dev_get_drvdata(&pdev->dev);
292 return 0; 292 return 0;
293} 293}
294 294
295/** 295/**
@@ -297,29 +297,29 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
297 * 297 *
298 * Attach qdi IDE interfaces by scanning the ports it may occupy. 298 * Attach qdi IDE interfaces by scanning the ports it may occupy.
299 */ 299 */
300 300
301static __init int qdi_init(void) 301static __init int qdi_init(void)
302{ 302{
303 unsigned long flags; 303 unsigned long flags;
304 static const unsigned long qd_port[2] = { 0x30, 0xB0 }; 304 static const unsigned long qd_port[2] = { 0x30, 0xB0 };
305 static const unsigned long ide_port[2] = { 0x170, 0x1F0 }; 305 static const unsigned long ide_port[2] = { 0x170, 0x1F0 };
306 static const int ide_irq[2] = { 14, 15 }; 306 static const int ide_irq[2] = { 14, 15 };
307 307
308 int ct = 0; 308 int ct = 0;
309 int i; 309 int i;
310 310
311 if (probe_qdi == 0) 311 if (probe_qdi == 0)
312 return -ENODEV; 312 return -ENODEV;
313 313
314 /* 314 /*
315 * Check each possible QD65xx base address 315 * Check each possible QD65xx base address
316 */ 316 */
317 317
318 for (i = 0; i < 2; i++) { 318 for (i = 0; i < 2; i++) {
319 unsigned long port = qd_port[i]; 319 unsigned long port = qd_port[i];
320 u8 r, res; 320 u8 r, res;
321 321
322 322
323 if (request_region(port, 2, "pata_qdi")) { 323 if (request_region(port, 2, "pata_qdi")) {
324 /* Check for a card */ 324 /* Check for a card */
325 local_irq_save(flags); 325 local_irq_save(flags);
@@ -328,14 +328,14 @@ static __init int qdi_init(void)
328 res = inb_p(port); 328 res = inb_p(port);
329 outb_p(r, port); 329 outb_p(r, port);
330 local_irq_restore(flags); 330 local_irq_restore(flags);
331 331
332 /* Fail */ 332 /* Fail */
333 if (res == 0x19) 333 if (res == 0x19)
334 { 334 {
335 release_region(port, 2); 335 release_region(port, 2);
336 continue; 336 continue;
337 } 337 }
338 338
339 /* Passes the presence test */ 339 /* Passes the presence test */
340 r = inb_p(port + 1); /* Check port agrees with port set */ 340 r = inb_p(port + 1); /* Check port agrees with port set */
341 if ((r & 2) >> 1 != i) { 341 if ((r & 2) >> 1 != i) {
@@ -343,7 +343,7 @@ static __init int qdi_init(void)
343 continue; 343 continue;
344 } 344 }
345 345
346 /* Check card type */ 346 /* Check card type */
347 if ((r & 0xF0) == 0xC0) { 347 if ((r & 0xF0) == 0xC0) {
348 /* QD6500: single channel */ 348 /* QD6500: single channel */
349 if (r & 8) { 349 if (r & 8) {
@@ -388,7 +388,7 @@ static __exit void qdi_exit(void)
388 */ 388 */
389 release_region(qdi_data[i].timing, 2); 389 release_region(qdi_data[i].timing, 2);
390 platform_device_unregister(qdi_data[i].platform_dev); 390 platform_device_unregister(qdi_data[i].platform_dev);
391 } 391 }
392} 392}
393 393
394MODULE_AUTHOR("Alan Cox"); 394MODULE_AUTHOR("Alan Cox");