aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_cmd64x.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-03-09 08:37:46 -0500
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:15:57 -0400
commita73984a0d5664fa1bfdd9f0a475b8d74af7f44a6 (patch)
tree5d9e919be73fdc84ac66a9822a1a0fcc86840b90 /drivers/ata/pata_cmd64x.c
parentfecfda5d88dcc3775f72d6f3a55d11b77c67f878 (diff)
[libata] More PATA driver ->cable_detect support
Roll-up of ->cable_detect feature addition patches, authored and signed-off-by Alan Cox. Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_cmd64x.c')
-rw-r--r--drivers/ata/pata_cmd64x.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index 5b13bdd1edc0..3989cc577fcd 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -75,13 +75,7 @@ enum {
75 DTPR1 = 0x7C 75 DTPR1 = 0x7C
76}; 76};
77 77
78static int cmd64x_pre_reset(struct ata_port *ap) 78static int cmd648_cable_detect(struct ata_port *ap)
79{
80 ap->cbl = ATA_CBL_PATA40;
81 return ata_std_prereset(ap);
82}
83
84static int cmd648_pre_reset(struct ata_port *ap)
85{ 79{
86 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 80 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
87 u8 r; 81 u8 r;
@@ -89,21 +83,8 @@ static int cmd648_pre_reset(struct ata_port *ap)
89 /* Check cable detect bits */ 83 /* Check cable detect bits */
90 pci_read_config_byte(pdev, BMIDECSR, &r); 84 pci_read_config_byte(pdev, BMIDECSR, &r);
91 if (r & (1 << ap->port_no)) 85 if (r & (1 << ap->port_no))
92 ap->cbl = ATA_CBL_PATA80; 86 return ATA_CBL_PATA80;
93 else 87 return ATA_CBL_PATA40;
94 ap->cbl = ATA_CBL_PATA40;
95
96 return ata_std_prereset(ap);
97}
98
99static void cmd64x_error_handler(struct ata_port *ap)
100{
101 return ata_bmdma_drive_eh(ap, cmd64x_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
102}
103
104static void cmd648_error_handler(struct ata_port *ap)
105{
106 ata_bmdma_drive_eh(ap, cmd648_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
107} 88}
108 89
109/** 90/**
@@ -304,8 +285,9 @@ static struct ata_port_operations cmd64x_port_ops = {
304 285
305 .freeze = ata_bmdma_freeze, 286 .freeze = ata_bmdma_freeze,
306 .thaw = ata_bmdma_thaw, 287 .thaw = ata_bmdma_thaw,
307 .error_handler = cmd64x_error_handler, 288 .error_handler = ata_bmdma_error_handler,
308 .post_internal_cmd = ata_bmdma_post_internal_cmd, 289 .post_internal_cmd = ata_bmdma_post_internal_cmd,
290 .cable_detect = ata_cable_40wire,
309 291
310 .bmdma_setup = ata_bmdma_setup, 292 .bmdma_setup = ata_bmdma_setup,
311 .bmdma_start = ata_bmdma_start, 293 .bmdma_start = ata_bmdma_start,
@@ -338,8 +320,9 @@ static struct ata_port_operations cmd646r1_port_ops = {
338 320
339 .freeze = ata_bmdma_freeze, 321 .freeze = ata_bmdma_freeze,
340 .thaw = ata_bmdma_thaw, 322 .thaw = ata_bmdma_thaw,
341 .error_handler = cmd64x_error_handler, 323 .error_handler = ata_bmdma_error_handler,
342 .post_internal_cmd = ata_bmdma_post_internal_cmd, 324 .post_internal_cmd = ata_bmdma_post_internal_cmd,
325 .cable_detect = ata_cable_40wire,
343 326
344 .bmdma_setup = ata_bmdma_setup, 327 .bmdma_setup = ata_bmdma_setup,
345 .bmdma_start = ata_bmdma_start, 328 .bmdma_start = ata_bmdma_start,
@@ -372,8 +355,9 @@ static struct ata_port_operations cmd648_port_ops = {
372 355
373 .freeze = ata_bmdma_freeze, 356 .freeze = ata_bmdma_freeze,
374 .thaw = ata_bmdma_thaw, 357 .thaw = ata_bmdma_thaw,
375 .error_handler = cmd648_error_handler, 358 .error_handler = ata_bmdma_error_handler,
376 .post_internal_cmd = ata_bmdma_post_internal_cmd, 359 .post_internal_cmd = ata_bmdma_post_internal_cmd,
360 .cable_detect = cmd648_cable_detect,
377 361
378 .bmdma_setup = ata_bmdma_setup, 362 .bmdma_setup = ata_bmdma_setup,
379 .bmdma_start = ata_bmdma_start, 363 .bmdma_start = ata_bmdma_start,