aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2007-04-10 19:04:20 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:16:01 -0400
commiteb4a2c7f03db06dda0370591c958fa5a62ff2ec3 (patch)
tree63933e8f00d363728dfcd9182ed3718dbbf45572 /drivers/ata
parent5a5dbd18a7496ed403f6f54bb20c955c65482fa5 (diff)
pata: cable methods
Versus upstream as requested Last of the trivial switches to cable_detect methods. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ata_generic.c32
-rw-r--r--drivers/ata/ata_piix.c55
-rw-r--r--drivers/ata/pata_amd.c94
-rw-r--r--drivers/ata/pata_cs5535.c24
-rw-r--r--drivers/ata/pata_cypress.c14
-rw-r--r--drivers/ata/pata_hpt366.c1
6 files changed, 67 insertions, 153 deletions
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index d8e79882b880..92a491ddd030 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -33,35 +33,6 @@
33 */ 33 */
34 34
35/** 35/**
36 * generic_pre_reset - probe begin
37 * @ap: ATA port
38 *
39 * Set up cable type and use generic probe init
40 */
41
42static int generic_pre_reset(struct ata_port *ap)
43{
44 ap->cbl = ATA_CBL_PATA80;
45 return ata_std_prereset(ap);
46}
47
48
49/**
50 * generic_error_handler - Probe specified port on PATA host controller
51 * @ap: Port to probe
52 * @classes:
53 *
54 * LOCKING:
55 * None (inherited from caller).
56 */
57
58
59static void generic_error_handler(struct ata_port *ap)
60{
61 ata_bmdma_drive_eh(ap, generic_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
62}
63
64/**
65 * generic_set_mode - mode setting 36 * generic_set_mode - mode setting
66 * @ap: interface to set up 37 * @ap: interface to set up
67 * @unused: returned device on error 38 * @unused: returned device on error
@@ -144,8 +115,9 @@ static struct ata_port_operations generic_port_ops = {
144 115
145 .freeze = ata_bmdma_freeze, 116 .freeze = ata_bmdma_freeze,
146 .thaw = ata_bmdma_thaw, 117 .thaw = ata_bmdma_thaw,
147 .error_handler = generic_error_handler, 118 .error_handler = ata_bmdma_error_handler,
148 .post_internal_cmd = ata_bmdma_post_internal_cmd, 119 .post_internal_cmd = ata_bmdma_post_internal_cmd,
120 .cable_detect = ata_cable_unknown,
149 121
150 .qc_prep = ata_qc_prep, 122 .qc_prep = ata_qc_prep,
151 .qc_issue = ata_qc_issue_prot, 123 .qc_issue = ata_qc_issue_prot,
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index a2c5756c69b6..55d306a3e538 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -93,7 +93,7 @@
93#include <linux/libata.h> 93#include <linux/libata.h>
94 94
95#define DRV_NAME "ata_piix" 95#define DRV_NAME "ata_piix"
96#define DRV_VERSION "2.10ac1" 96#define DRV_VERSION "2.11"
97 97
98enum { 98enum {
99 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ 99 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
@@ -155,11 +155,11 @@ struct piix_host_priv {
155static int piix_init_one (struct pci_dev *pdev, 155static int piix_init_one (struct pci_dev *pdev,
156 const struct pci_device_id *ent); 156 const struct pci_device_id *ent);
157static void piix_pata_error_handler(struct ata_port *ap); 157static void piix_pata_error_handler(struct ata_port *ap);
158static void ich_pata_error_handler(struct ata_port *ap);
159static void piix_sata_error_handler(struct ata_port *ap); 158static void piix_sata_error_handler(struct ata_port *ap);
160static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); 159static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev);
161static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); 160static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev);
162static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev); 161static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev);
162static int ich_pata_cable_detect(struct ata_port *ap);
163 163
164static unsigned int in_module_init = 1; 164static unsigned int in_module_init = 1;
165 165
@@ -305,6 +305,7 @@ static const struct ata_port_operations piix_pata_ops = {
305 .thaw = ata_bmdma_thaw, 305 .thaw = ata_bmdma_thaw,
306 .error_handler = piix_pata_error_handler, 306 .error_handler = piix_pata_error_handler,
307 .post_internal_cmd = ata_bmdma_post_internal_cmd, 307 .post_internal_cmd = ata_bmdma_post_internal_cmd,
308 .cable_detect = ata_cable_40wire,
308 309
309 .irq_handler = ata_interrupt, 310 .irq_handler = ata_interrupt,
310 .irq_clear = ata_bmdma_irq_clear, 311 .irq_clear = ata_bmdma_irq_clear,
@@ -336,8 +337,9 @@ static const struct ata_port_operations ich_pata_ops = {
336 337
337 .freeze = ata_bmdma_freeze, 338 .freeze = ata_bmdma_freeze,
338 .thaw = ata_bmdma_thaw, 339 .thaw = ata_bmdma_thaw,
339 .error_handler = ich_pata_error_handler, 340 .error_handler = piix_pata_error_handler,
340 .post_internal_cmd = ata_bmdma_post_internal_cmd, 341 .post_internal_cmd = ata_bmdma_post_internal_cmd,
342 .cable_detect = ich_pata_cable_detect,
341 343
342 .irq_handler = ata_interrupt, 344 .irq_handler = ata_interrupt,
343 .irq_clear = ata_bmdma_irq_clear, 345 .irq_clear = ata_bmdma_irq_clear,
@@ -586,7 +588,7 @@ static const struct ich_laptop ich_laptop[] = {
586}; 588};
587 589
588/** 590/**
589 * piix_pata_cbl_detect - Probe host controller cable detect info 591 * ich_pata_cable_detect - Probe host controller cable detect info
590 * @ap: Port for which cable detect info is desired 592 * @ap: Port for which cable detect info is desired
591 * 593 *
592 * Read 80c cable indicator from ATA PCI device's PCI config 594 * Read 80c cable indicator from ATA PCI device's PCI config
@@ -596,23 +598,18 @@ static const struct ich_laptop ich_laptop[] = {
596 * None (inherited from caller). 598 * None (inherited from caller).
597 */ 599 */
598 600
599static void ich_pata_cbl_detect(struct ata_port *ap) 601static int ich_pata_cable_detect(struct ata_port *ap)
600{ 602{
601 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 603 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
602 const struct ich_laptop *lap = &ich_laptop[0]; 604 const struct ich_laptop *lap = &ich_laptop[0];
603 u8 tmp, mask; 605 u8 tmp, mask;
604 606
605 /* no 80c support in host controller? */
606 if ((ap->udma_mask & ~ATA_UDMA_MASK_40C) == 0)
607 goto cbl40;
608
609 /* Check for specials - Acer Aspire 5602WLMi */ 607 /* Check for specials - Acer Aspire 5602WLMi */
610 while (lap->device) { 608 while (lap->device) {
611 if (lap->device == pdev->device && 609 if (lap->device == pdev->device &&
612 lap->subvendor == pdev->subsystem_vendor && 610 lap->subvendor == pdev->subsystem_vendor &&
613 lap->subdevice == pdev->subsystem_device) { 611 lap->subdevice == pdev->subsystem_device) {
614 ap->cbl = ATA_CBL_PATA40_SHORT; 612 return ATA_CBL_PATA40_SHORT;
615 return;
616 } 613 }
617 lap++; 614 lap++;
618 } 615 }
@@ -621,20 +618,14 @@ static void ich_pata_cbl_detect(struct ata_port *ap)
621 mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC; 618 mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC;
622 pci_read_config_byte(pdev, PIIX_IOCFG, &tmp); 619 pci_read_config_byte(pdev, PIIX_IOCFG, &tmp);
623 if ((tmp & mask) == 0) 620 if ((tmp & mask) == 0)
624 goto cbl40; 621 return ATA_CBL_PATA40;
625 622 return ATA_CBL_PATA80;
626 ap->cbl = ATA_CBL_PATA80;
627 return;
628
629cbl40:
630 ap->cbl = ATA_CBL_PATA40;
631} 623}
632 624
633/** 625/**
634 * piix_pata_prereset - prereset for PATA host controller 626 * piix_pata_prereset - prereset for PATA host controller
635 * @ap: Target port 627 * @ap: Target port
636 * 628 *
637 *
638 * LOCKING: 629 * LOCKING:
639 * None (inherited from caller). 630 * None (inherited from caller).
640 */ 631 */
@@ -644,8 +635,6 @@ static int piix_pata_prereset(struct ata_port *ap)
644 635
645 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) 636 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no]))
646 return -ENOENT; 637 return -ENOENT;
647
648 ap->cbl = ATA_CBL_PATA40;
649 return ata_std_prereset(ap); 638 return ata_std_prereset(ap);
650} 639}
651 640
@@ -656,30 +645,6 @@ static void piix_pata_error_handler(struct ata_port *ap)
656} 645}
657 646
658 647
659/**
660 * ich_pata_prereset - prereset for PATA host controller
661 * @ap: Target port
662 *
663 *
664 * LOCKING:
665 * None (inherited from caller).
666 */
667static int ich_pata_prereset(struct ata_port *ap)
668{
669 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
670
671 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no]))
672 return -ENOENT;
673 ich_pata_cbl_detect(ap);
674 return ata_std_prereset(ap);
675}
676
677static void ich_pata_error_handler(struct ata_port *ap)
678{
679 ata_bmdma_drive_eh(ap, ich_pata_prereset, ata_std_softreset, NULL,
680 ata_std_postreset);
681}
682
683static void piix_sata_error_handler(struct ata_port *ap) 648static void piix_sata_error_handler(struct ata_port *ap)
684{ 649{
685 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, NULL, 650 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, NULL,
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 18381762908b..5a77e4e60a42 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -25,7 +25,7 @@
25#include <linux/libata.h> 25#include <linux/libata.h>
26 26
27#define DRV_NAME "pata_amd" 27#define DRV_NAME "pata_amd"
28#define DRV_VERSION "0.2.8" 28#define DRV_VERSION "0.3.8"
29 29
30/** 30/**
31 * timing_setup - shared timing computation and load 31 * timing_setup - shared timing computation and load
@@ -119,32 +119,25 @@ static void timing_setup(struct ata_port *ap, struct ata_device *adev, int offse
119} 119}
120 120
121/** 121/**
122 * amd_probe_init - cable detection 122 * amd_probe_init - perform reset handling
123 * @ap: ATA port 123 * @ap: ATA port
124 * 124 *
125 * Perform cable detection. The BIOS stores this in PCI config 125 * Reset sequence checking enable bits to see which ports are
126 * space for us. 126 * active.
127 */ 127 */
128 128
129static int amd_pre_reset(struct ata_port *ap) 129static int amd_pre_reset(struct ata_port *ap)
130{ 130{
131 static const u32 bitmask[2] = {0x03, 0x0C};
132 static const struct pci_bits amd_enable_bits[] = { 131 static const struct pci_bits amd_enable_bits[] = {
133 { 0x40, 1, 0x02, 0x02 }, 132 { 0x40, 1, 0x02, 0x02 },
134 { 0x40, 1, 0x01, 0x01 } 133 { 0x40, 1, 0x01, 0x01 }
135 }; 134 };
136 135
137 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 136 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
138 u8 ata66;
139 137
140 if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no])) 138 if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no]))
141 return -ENOENT; 139 return -ENOENT;
142 140
143 pci_read_config_byte(pdev, 0x42, &ata66);
144 if (ata66 & bitmask[ap->port_no])
145 ap->cbl = ATA_CBL_PATA80;
146 else
147 ap->cbl = ATA_CBL_PATA40;
148 return ata_std_prereset(ap); 141 return ata_std_prereset(ap);
149 142
150} 143}
@@ -156,28 +149,16 @@ static void amd_error_handler(struct ata_port *ap)
156 ata_std_postreset); 149 ata_std_postreset);
157} 150}
158 151
159static int amd_early_pre_reset(struct ata_port *ap) 152static int amd_cable_detect(struct ata_port *ap)
160{ 153{
154 static const u32 bitmask[2] = {0x03, 0x0C};
161 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 155 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
162 static struct pci_bits amd_enable_bits[] = { 156 u8 ata66;
163 { 0x40, 1, 0x02, 0x02 },
164 { 0x40, 1, 0x01, 0x01 }
165 };
166
167 if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no]))
168 return -ENOENT;
169
170 /* No host side cable detection */
171 ap->cbl = ATA_CBL_PATA80;
172 return ata_std_prereset(ap);
173
174}
175 157
176static void amd_early_error_handler(struct ata_port *ap) 158 pci_read_config_byte(pdev, 0x42, &ata66);
177{ 159 if (ata66 & bitmask[ap->port_no])
178 ata_bmdma_drive_eh(ap, amd_early_pre_reset, 160 return ATA_CBL_PATA80;
179 ata_std_softreset, NULL, 161 return ATA_CBL_PATA40;
180 ata_std_postreset);
181} 162}
182 163
183/** 164/**
@@ -247,31 +228,16 @@ static void amd133_set_dmamode(struct ata_port *ap, struct ata_device *adev)
247 */ 228 */
248 229
249static int nv_pre_reset(struct ata_port *ap) { 230static int nv_pre_reset(struct ata_port *ap) {
250 static const u8 bitmask[2] = {0x03, 0x0C};
251 static const struct pci_bits nv_enable_bits[] = { 231 static const struct pci_bits nv_enable_bits[] = {
252 { 0x50, 1, 0x02, 0x02 }, 232 { 0x50, 1, 0x02, 0x02 },
253 { 0x50, 1, 0x01, 0x01 } 233 { 0x50, 1, 0x01, 0x01 }
254 }; 234 };
255 235
256 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 236 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
257 u8 ata66;
258 u16 udma;
259 237
260 if (!pci_test_config_bits(pdev, &nv_enable_bits[ap->port_no])) 238 if (!pci_test_config_bits(pdev, &nv_enable_bits[ap->port_no]))
261 return -ENOENT; 239 return -ENOENT;
262 240
263 pci_read_config_byte(pdev, 0x52, &ata66);
264 if (ata66 & bitmask[ap->port_no])
265 ap->cbl = ATA_CBL_PATA80;
266 else
267 ap->cbl = ATA_CBL_PATA40;
268
269 /* We now have to double check because the Nvidia boxes BIOS
270 doesn't always set the cable bits but does set mode bits */
271
272 pci_read_config_word(pdev, 0x62 - 2 * ap->port_no, &udma);
273 if ((udma & 0xC4) == 0xC4 || (udma & 0xC400) == 0xC400)
274 ap->cbl = ATA_CBL_PATA80;
275 return ata_std_prereset(ap); 241 return ata_std_prereset(ap);
276} 242}
277 243
@@ -281,6 +247,29 @@ static void nv_error_handler(struct ata_port *ap)
281 ata_std_softreset, NULL, 247 ata_std_softreset, NULL,
282 ata_std_postreset); 248 ata_std_postreset);
283} 249}
250
251static int nv_cable_detect(struct ata_port *ap)
252{
253 static const u8 bitmask[2] = {0x03, 0x0C};
254 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
255 u8 ata66;
256 u16 udma;
257 int cbl;
258
259 pci_read_config_byte(pdev, 0x52, &ata66);
260 if (ata66 & bitmask[ap->port_no])
261 cbl = ATA_CBL_PATA80;
262 else
263 cbl = ATA_CBL_PATA40;
264
265 /* We now have to double check because the Nvidia boxes BIOS
266 doesn't always set the cable bits but does set mode bits */
267 pci_read_config_word(pdev, 0x62 - 2 * ap->port_no, &udma);
268 if ((udma & 0xC4) == 0xC4 || (udma & 0xC400) == 0xC400)
269 cbl = ATA_CBL_PATA80;
270 return cbl;
271}
272
284/** 273/**
285 * nv100_set_piomode - set initial PIO mode data 274 * nv100_set_piomode - set initial PIO mode data
286 * @ap: ATA interface 275 * @ap: ATA interface
@@ -353,8 +342,9 @@ static struct ata_port_operations amd33_port_ops = {
353 342
354 .freeze = ata_bmdma_freeze, 343 .freeze = ata_bmdma_freeze,
355 .thaw = ata_bmdma_thaw, 344 .thaw = ata_bmdma_thaw,
356 .error_handler = amd_early_error_handler, 345 .error_handler = amd_error_handler,
357 .post_internal_cmd = ata_bmdma_post_internal_cmd, 346 .post_internal_cmd = ata_bmdma_post_internal_cmd,
347 .cable_detect = ata_cable_40wire,
358 348
359 .bmdma_setup = ata_bmdma_setup, 349 .bmdma_setup = ata_bmdma_setup,
360 .bmdma_start = ata_bmdma_start, 350 .bmdma_start = ata_bmdma_start,
@@ -387,8 +377,9 @@ static struct ata_port_operations amd66_port_ops = {
387 377
388 .freeze = ata_bmdma_freeze, 378 .freeze = ata_bmdma_freeze,
389 .thaw = ata_bmdma_thaw, 379 .thaw = ata_bmdma_thaw,
390 .error_handler = amd_early_error_handler, 380 .error_handler = amd_error_handler,
391 .post_internal_cmd = ata_bmdma_post_internal_cmd, 381 .post_internal_cmd = ata_bmdma_post_internal_cmd,
382 .cable_detect = ata_cable_unknown,
392 383
393 .bmdma_setup = ata_bmdma_setup, 384 .bmdma_setup = ata_bmdma_setup,
394 .bmdma_start = ata_bmdma_start, 385 .bmdma_start = ata_bmdma_start,
@@ -423,6 +414,7 @@ static struct ata_port_operations amd100_port_ops = {
423 .thaw = ata_bmdma_thaw, 414 .thaw = ata_bmdma_thaw,
424 .error_handler = amd_error_handler, 415 .error_handler = amd_error_handler,
425 .post_internal_cmd = ata_bmdma_post_internal_cmd, 416 .post_internal_cmd = ata_bmdma_post_internal_cmd,
417 .cable_detect = ata_cable_unknown,
426 418
427 .bmdma_setup = ata_bmdma_setup, 419 .bmdma_setup = ata_bmdma_setup,
428 .bmdma_start = ata_bmdma_start, 420 .bmdma_start = ata_bmdma_start,
@@ -457,6 +449,7 @@ static struct ata_port_operations amd133_port_ops = {
457 .thaw = ata_bmdma_thaw, 449 .thaw = ata_bmdma_thaw,
458 .error_handler = amd_error_handler, 450 .error_handler = amd_error_handler,
459 .post_internal_cmd = ata_bmdma_post_internal_cmd, 451 .post_internal_cmd = ata_bmdma_post_internal_cmd,
452 .cable_detect = amd_cable_detect,
460 453
461 .bmdma_setup = ata_bmdma_setup, 454 .bmdma_setup = ata_bmdma_setup,
462 .bmdma_start = ata_bmdma_start, 455 .bmdma_start = ata_bmdma_start,
@@ -491,6 +484,7 @@ static struct ata_port_operations nv100_port_ops = {
491 .thaw = ata_bmdma_thaw, 484 .thaw = ata_bmdma_thaw,
492 .error_handler = nv_error_handler, 485 .error_handler = nv_error_handler,
493 .post_internal_cmd = ata_bmdma_post_internal_cmd, 486 .post_internal_cmd = ata_bmdma_post_internal_cmd,
487 .cable_detect = nv_cable_detect,
494 488
495 .bmdma_setup = ata_bmdma_setup, 489 .bmdma_setup = ata_bmdma_setup,
496 .bmdma_start = ata_bmdma_start, 490 .bmdma_start = ata_bmdma_start,
@@ -525,6 +519,7 @@ static struct ata_port_operations nv133_port_ops = {
525 .thaw = ata_bmdma_thaw, 519 .thaw = ata_bmdma_thaw,
526 .error_handler = nv_error_handler, 520 .error_handler = nv_error_handler,
527 .post_internal_cmd = ata_bmdma_post_internal_cmd, 521 .post_internal_cmd = ata_bmdma_post_internal_cmd,
522 .cable_detect = nv_cable_detect,
528 523
529 .bmdma_setup = ata_bmdma_setup, 524 .bmdma_setup = ata_bmdma_setup,
530 .bmdma_start = ata_bmdma_start, 525 .bmdma_start = ata_bmdma_start,
@@ -644,6 +639,11 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
644 if (type == 1 && rev > 0x7) 639 if (type == 1 && rev > 0x7)
645 type = 2; 640 type = 2;
646 641
642#if defined(CONFIG_ATA_ACPI)
643 /* Prefer the ACPI driver for Nvidia hardware */
644 if (pdev->vendor == PCI_VENDOR_ID_NVIDIA && ata_pata_acpi_present(pdev))
645 return -ENODEV;
646#endif
647 /* Check for AMD7411 */ 647 /* Check for AMD7411 */
648 if (type == 3) 648 if (type == 3)
649 /* FIFO is broken */ 649 /* FIFO is broken */
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c
index 1572e5c9031a..08cccc9c659b 100644
--- a/drivers/ata/pata_cs5535.c
+++ b/drivers/ata/pata_cs5535.c
@@ -70,36 +70,23 @@
70#define CS5535_BAD_PIO(timings) ( (timings&~0x80000000UL)==0x00009172 ) 70#define CS5535_BAD_PIO(timings) ( (timings&~0x80000000UL)==0x00009172 )
71 71
72/** 72/**
73 * cs5535_pre_reset - detect cable type 73 * cs5535_cable_detect - detect cable type
74 * @ap: Port to detect on 74 * @ap: Port to detect on
75 * 75 *
76 * Perform cable detection for ATA66 capable cable. Return a libata 76 * Perform cable detection for ATA66 capable cable. Return a libata
77 * cable type. 77 * cable type.
78 */ 78 */
79 79
80static int cs5535_pre_reset(struct ata_port *ap) 80static int cs5535_cable_detect(struct ata_port *ap)
81{ 81{
82 u8 cable; 82 u8 cable;
83 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 83 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
84 84
85 pci_read_config_byte(pdev, CS5535_CABLE_DETECT, &cable); 85 pci_read_config_byte(pdev, CS5535_CABLE_DETECT, &cable);
86 if (cable & 1) 86 if (cable & 1)
87 ap->cbl = ATA_CBL_PATA80; 87 return ATA_CBL_PATA80;
88 else 88 else
89 ap->cbl = ATA_CBL_PATA40; 89 return ATA_CBL_PATA40;
90 return ata_std_prereset(ap);
91}
92
93/**
94 * cs5535_error_handler - reset/probe
95 * @ap: Port to reset
96 *
97 * Reset and configure a port
98 */
99
100static void cs5535_error_handler(struct ata_port *ap)
101{
102 ata_bmdma_drive_eh(ap, cs5535_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
103} 90}
104 91
105/** 92/**
@@ -205,8 +192,9 @@ static struct ata_port_operations cs5535_port_ops = {
205 192
206 .freeze = ata_bmdma_freeze, 193 .freeze = ata_bmdma_freeze,
207 .thaw = ata_bmdma_thaw, 194 .thaw = ata_bmdma_thaw,
208 .error_handler = cs5535_error_handler, 195 .error_handler = ata_bmdma_error_handler,
209 .post_internal_cmd = ata_bmdma_post_internal_cmd, 196 .post_internal_cmd = ata_bmdma_post_internal_cmd,
197 .cable_detect = cs5535_cable_detect,
210 198
211 .bmdma_setup = ata_bmdma_setup, 199 .bmdma_setup = ata_bmdma_setup,
212 .bmdma_start = ata_bmdma_start, 200 .bmdma_start = ata_bmdma_start,
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c
index f69dde5f7066..6ec049c3b1dc 100644
--- a/drivers/ata/pata_cypress.c
+++ b/drivers/ata/pata_cypress.c
@@ -41,17 +41,6 @@ enum {
41 CY82_INDEX_TIMEOUT = 0x32 41 CY82_INDEX_TIMEOUT = 0x32
42}; 42};
43 43
44static int cy82c693_pre_reset(struct ata_port *ap)
45{
46 ap->cbl = ATA_CBL_PATA40;
47 return ata_std_prereset(ap);
48}
49
50static void cy82c693_error_handler(struct ata_port *ap)
51{
52 ata_bmdma_drive_eh(ap, cy82c693_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
53}
54
55/** 44/**
56 * cy82c693_set_piomode - set initial PIO mode data 45 * cy82c693_set_piomode - set initial PIO mode data
57 * @ap: ATA interface 46 * @ap: ATA interface
@@ -156,8 +145,9 @@ static struct ata_port_operations cy82c693_port_ops = {
156 145
157 .freeze = ata_bmdma_freeze, 146 .freeze = ata_bmdma_freeze,
158 .thaw = ata_bmdma_thaw, 147 .thaw = ata_bmdma_thaw,
159 .error_handler = cy82c693_error_handler, 148 .error_handler = ata_bmdma_error_handler,
160 .post_internal_cmd = ata_bmdma_post_internal_cmd, 149 .post_internal_cmd = ata_bmdma_post_internal_cmd,
150 .cable_detect = ata_cable_40wire,
161 151
162 .bmdma_setup = ata_bmdma_setup, 152 .bmdma_setup = ata_bmdma_setup,
163 .bmdma_start = ata_bmdma_start, 153 .bmdma_start = ata_bmdma_start,
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index c3e5ea35e0f8..93cfa6d300a5 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -169,7 +169,6 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, cons
169 169
170/** 170/**
171 * hpt366_filter - mode selection filter 171 * hpt366_filter - mode selection filter
172 * @ap: ATA interface
173 * @adev: ATA device 172 * @adev: ATA device
174 * 173 *
175 * Block UDMA on devices that cause trouble with this controller. 174 * Block UDMA on devices that cause trouble with this controller.