aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/ata/pata_artop.c26
-rw-r--r--drivers/ata/pata_cmd64x.c34
-rw-r--r--drivers/ata/pata_cs5520.c15
-rw-r--r--drivers/ata/pata_cs5530.c15
-rw-r--r--drivers/ata/pata_hpt3x3.c22
-rw-r--r--drivers/ata/pata_isapnp.c1
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c1
-rw-r--r--drivers/ata/pata_legacy.c7
8 files changed, 42 insertions, 79 deletions
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index 21c30282717c..00e9ec342db0 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -49,8 +49,6 @@ static int artop6210_pre_reset(struct ata_port *ap)
49 49
50 if (!pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) 50 if (!pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no]))
51 return -ENOENT; 51 return -ENOENT;
52
53 ap->cbl = ATA_CBL_PATA40;
54 return ata_std_prereset(ap); 52 return ata_std_prereset(ap);
55} 53}
56 54
@@ -85,18 +83,28 @@ static int artop6260_pre_reset(struct ata_port *ap)
85 }; 83 };
86 84
87 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 85 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
88 u8 tmp;
89 86
90 /* Odd numbered device ids are the units with enable bits (the -R cards) */ 87 /* Odd numbered device ids are the units with enable bits (the -R cards) */
91 if (pdev->device % 1 && !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) 88 if (pdev->device % 1 && !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no]))
92 return -ENOENT; 89 return -ENOENT;
90 return ata_std_prereset(ap);
91}
93 92
93/**
94 * artop6260_cable_detect - identify cable type
95 * @ap: Port
96 *
97 * Identify the cable type for the ARTOp interface in question
98 */
99
100static int artop6260_cable_detect(struct ata_port *ap)
101{
102 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
103 u8 tmp;
94 pci_read_config_byte(pdev, 0x49, &tmp); 104 pci_read_config_byte(pdev, 0x49, &tmp);
95 if (tmp & (1 << ap->port_no)) 105 if (tmp & (1 << ap->port_no))
96 ap->cbl = ATA_CBL_PATA40; 106 return ATA_CBL_PATA40;
97 else 107 return ATA_CBL_PATA80;
98 ap->cbl = ATA_CBL_PATA80;
99 return ata_std_prereset(ap);
100} 108}
101 109
102/** 110/**
@@ -225,7 +233,7 @@ static void artop6260_set_piomode(struct ata_port *ap, struct ata_device *adev)
225/** 233/**
226 * artop6210_set_dmamode - Initialize host controller PATA PIO timings 234 * artop6210_set_dmamode - Initialize host controller PATA PIO timings
227 * @ap: Port whose timings we are configuring 235 * @ap: Port whose timings we are configuring
228 * @adev: um 236 * @adev: Device whose timings we are configuring
229 * 237 *
230 * Set DMA mode for device, in host controller PCI config space. 238 * Set DMA mode for device, in host controller PCI config space.
231 * 239 *
@@ -333,6 +341,7 @@ static const struct ata_port_operations artop6210_ops = {
333 .thaw = ata_bmdma_thaw, 341 .thaw = ata_bmdma_thaw,
334 .error_handler = artop6210_error_handler, 342 .error_handler = artop6210_error_handler,
335 .post_internal_cmd = ata_bmdma_post_internal_cmd, 343 .post_internal_cmd = ata_bmdma_post_internal_cmd,
344 .cable_detect = ata_cable_40wire,
336 345
337 .bmdma_setup = ata_bmdma_setup, 346 .bmdma_setup = ata_bmdma_setup,
338 .bmdma_start = ata_bmdma_start, 347 .bmdma_start = ata_bmdma_start,
@@ -366,6 +375,7 @@ static const struct ata_port_operations artop6260_ops = {
366 .thaw = ata_bmdma_thaw, 375 .thaw = ata_bmdma_thaw,
367 .error_handler = artop6260_error_handler, 376 .error_handler = artop6260_error_handler,
368 .post_internal_cmd = ata_bmdma_post_internal_cmd, 377 .post_internal_cmd = ata_bmdma_post_internal_cmd,
378 .cable_detect = artop6260_cable_detect,
369 379
370 .bmdma_setup = ata_bmdma_setup, 380 .bmdma_setup = ata_bmdma_setup,
371 .bmdma_start = ata_bmdma_start, 381 .bmdma_start = ata_bmdma_start,
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,
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index 55cc293e7487..b5b27baa0be1 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -139,18 +139,6 @@ static void cs5520_set_piomode(struct ata_port *ap, struct ata_device *adev)
139 cs5520_set_timings(ap, adev, adev->pio_mode); 139 cs5520_set_timings(ap, adev, adev->pio_mode);
140} 140}
141 141
142
143static int cs5520_pre_reset(struct ata_port *ap)
144{
145 ap->cbl = ATA_CBL_PATA40;
146 return ata_std_prereset(ap);
147}
148
149static void cs5520_error_handler(struct ata_port *ap)
150{
151 return ata_bmdma_drive_eh(ap, cs5520_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
152}
153
154static struct scsi_host_template cs5520_sht = { 142static struct scsi_host_template cs5520_sht = {
155 .module = THIS_MODULE, 143 .module = THIS_MODULE,
156 .name = DRV_NAME, 144 .name = DRV_NAME,
@@ -186,8 +174,9 @@ static struct ata_port_operations cs5520_port_ops = {
186 174
187 .freeze = ata_bmdma_freeze, 175 .freeze = ata_bmdma_freeze,
188 .thaw = ata_bmdma_thaw, 176 .thaw = ata_bmdma_thaw,
189 .error_handler = cs5520_error_handler, 177 .error_handler = ata_bmdma_error_handler,
190 .post_internal_cmd = ata_bmdma_post_internal_cmd, 178 .post_internal_cmd = ata_bmdma_post_internal_cmd,
179 .cable_detect = ata_cable_40wire,
191 180
192 .bmdma_setup = ata_bmdma_setup, 181 .bmdma_setup = ata_bmdma_setup,
193 .bmdma_start = ata_bmdma_start, 182 .bmdma_start = ata_bmdma_start,
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index db63e80e608b..29642d5ee189 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -160,18 +160,6 @@ static unsigned int cs5530_qc_issue_prot(struct ata_queued_cmd *qc)
160 return ata_qc_issue_prot(qc); 160 return ata_qc_issue_prot(qc);
161} 161}
162 162
163static int cs5530_pre_reset(struct ata_port *ap)
164{
165 ap->cbl = ATA_CBL_PATA40;
166 return ata_std_prereset(ap);
167}
168
169static void cs5530_error_handler(struct ata_port *ap)
170{
171 return ata_bmdma_drive_eh(ap, cs5530_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
172}
173
174
175static struct scsi_host_template cs5530_sht = { 163static struct scsi_host_template cs5530_sht = {
176 .module = THIS_MODULE, 164 .module = THIS_MODULE,
177 .name = DRV_NAME, 165 .name = DRV_NAME,
@@ -213,8 +201,9 @@ static struct ata_port_operations cs5530_port_ops = {
213 201
214 .freeze = ata_bmdma_freeze, 202 .freeze = ata_bmdma_freeze,
215 .thaw = ata_bmdma_thaw, 203 .thaw = ata_bmdma_thaw,
216 .error_handler = cs5530_error_handler, 204 .error_handler = ata_bmdma_error_handler,
217 .post_internal_cmd = ata_bmdma_post_internal_cmd, 205 .post_internal_cmd = ata_bmdma_post_internal_cmd,
206 .cable_detect = ata_cable_40wire,
218 207
219 .qc_prep = ata_qc_prep, 208 .qc_prep = ata_qc_prep,
220 .qc_issue = cs5530_qc_issue_prot, 209 .qc_issue = cs5530_qc_issue_prot,
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c
index 813485c8526c..ac28ec8c50aa 100644
--- a/drivers/ata/pata_hpt3x3.c
+++ b/drivers/ata/pata_hpt3x3.c
@@ -25,25 +25,6 @@
25#define DRV_NAME "pata_hpt3x3" 25#define DRV_NAME "pata_hpt3x3"
26#define DRV_VERSION "0.4.2" 26#define DRV_VERSION "0.4.2"
27 27
28static int hpt3x3_probe_init(struct ata_port *ap)
29{
30 ap->cbl = ATA_CBL_PATA40;
31 return ata_std_prereset(ap);
32}
33
34/**
35 * hpt3x3_probe_reset - reset the hpt3x3 bus
36 * @ap: ATA port to reset
37 *
38 * Perform the housekeeping when doing an ATA bus reeset. We just
39 * need to force the cable type.
40 */
41
42static void hpt3x3_error_handler(struct ata_port *ap)
43{
44 return ata_bmdma_drive_eh(ap, hpt3x3_probe_init, ata_std_softreset, NULL, ata_std_postreset);
45}
46
47/** 28/**
48 * hpt3x3_set_piomode - PIO setup 29 * hpt3x3_set_piomode - PIO setup
49 * @ap: ATA interface 30 * @ap: ATA interface
@@ -139,8 +120,9 @@ static struct ata_port_operations hpt3x3_port_ops = {
139 120
140 .freeze = ata_bmdma_freeze, 121 .freeze = ata_bmdma_freeze,
141 .thaw = ata_bmdma_thaw, 122 .thaw = ata_bmdma_thaw,
142 .error_handler = hpt3x3_error_handler, 123 .error_handler = ata_bmdma_error_handler,
143 .post_internal_cmd = ata_bmdma_post_internal_cmd, 124 .post_internal_cmd = ata_bmdma_post_internal_cmd,
125 .cable_detect = ata_cable_40wire,
144 126
145 .bmdma_setup = ata_bmdma_setup, 127 .bmdma_setup = ata_bmdma_setup,
146 .bmdma_start = ata_bmdma_start, 128 .bmdma_start = ata_bmdma_start,
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 1a61cc891741..2580ab3146bf 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -49,6 +49,7 @@ static struct ata_port_operations isapnp_port_ops = {
49 .thaw = ata_bmdma_thaw, 49 .thaw = ata_bmdma_thaw,
50 .error_handler = ata_bmdma_error_handler, 50 .error_handler = ata_bmdma_error_handler,
51 .post_internal_cmd = ata_bmdma_post_internal_cmd, 51 .post_internal_cmd = ata_bmdma_post_internal_cmd,
52 .cable_detect = ata_cable_40wire,
52 53
53 .qc_prep = ata_qc_prep, 54 .qc_prep = ata_qc_prep,
54 .qc_issue = ata_qc_issue_prot, 55 .qc_issue = ata_qc_issue_prot,
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index c6f0e1927551..8257af84ff7c 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -129,6 +129,7 @@ static struct ata_port_operations ixp4xx_port_ops = {
129 .qc_issue = ata_qc_issue_prot, 129 .qc_issue = ata_qc_issue_prot,
130 .eng_timeout = ata_eng_timeout, 130 .eng_timeout = ata_eng_timeout,
131 .data_xfer = ixp4xx_mmio_data_xfer, 131 .data_xfer = ixp4xx_mmio_data_xfer,
132 .cable_detect = ata_cable_40wire,
132 133
133 .irq_handler = ata_interrupt, 134 .irq_handler = ata_interrupt,
134 .irq_clear = ixp4xx_irq_clear, 135 .irq_clear = ixp4xx_irq_clear,
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 86fbcd6a742b..0b1749a84df2 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -162,6 +162,7 @@ static struct ata_port_operations simple_port_ops = {
162 .thaw = ata_bmdma_thaw, 162 .thaw = ata_bmdma_thaw,
163 .error_handler = ata_bmdma_error_handler, 163 .error_handler = ata_bmdma_error_handler,
164 .post_internal_cmd = ata_bmdma_post_internal_cmd, 164 .post_internal_cmd = ata_bmdma_post_internal_cmd,
165 .cable_detect = ata_cable_40wire,
165 166
166 .qc_prep = ata_qc_prep, 167 .qc_prep = ata_qc_prep,
167 .qc_issue = ata_qc_issue_prot, 168 .qc_issue = ata_qc_issue_prot,
@@ -185,6 +186,7 @@ static struct ata_port_operations legacy_port_ops = {
185 .check_status = ata_check_status, 186 .check_status = ata_check_status,
186 .exec_command = ata_exec_command, 187 .exec_command = ata_exec_command,
187 .dev_select = ata_std_dev_select, 188 .dev_select = ata_std_dev_select,
189 .cable_detect = ata_cable_40wire,
188 190
189 .freeze = ata_bmdma_freeze, 191 .freeze = ata_bmdma_freeze,
190 .thaw = ata_bmdma_thaw, 192 .thaw = ata_bmdma_thaw,
@@ -305,6 +307,7 @@ static struct ata_port_operations pdc20230_port_ops = {
305 .thaw = ata_bmdma_thaw, 307 .thaw = ata_bmdma_thaw,
306 .error_handler = ata_bmdma_error_handler, 308 .error_handler = ata_bmdma_error_handler,
307 .post_internal_cmd = ata_bmdma_post_internal_cmd, 309 .post_internal_cmd = ata_bmdma_post_internal_cmd,
310 .cable_detect = ata_cable_40wire,
308 311
309 .qc_prep = ata_qc_prep, 312 .qc_prep = ata_qc_prep,
310 .qc_issue = ata_qc_issue_prot, 313 .qc_issue = ata_qc_issue_prot,
@@ -360,6 +363,7 @@ static struct ata_port_operations ht6560a_port_ops = {
360 .thaw = ata_bmdma_thaw, 363 .thaw = ata_bmdma_thaw,
361 .error_handler = ata_bmdma_error_handler, 364 .error_handler = ata_bmdma_error_handler,
362 .post_internal_cmd = ata_bmdma_post_internal_cmd, 365 .post_internal_cmd = ata_bmdma_post_internal_cmd,
366 .cable_detect = ata_cable_40wire,
363 367
364 .qc_prep = ata_qc_prep, 368 .qc_prep = ata_qc_prep,
365 .qc_issue = ata_qc_issue_prot, 369 .qc_issue = ata_qc_issue_prot,
@@ -426,6 +430,7 @@ static struct ata_port_operations ht6560b_port_ops = {
426 .thaw = ata_bmdma_thaw, 430 .thaw = ata_bmdma_thaw,
427 .error_handler = ata_bmdma_error_handler, 431 .error_handler = ata_bmdma_error_handler,
428 .post_internal_cmd = ata_bmdma_post_internal_cmd, 432 .post_internal_cmd = ata_bmdma_post_internal_cmd,
433 .cable_detect = ata_cable_40wire,
429 434
430 .qc_prep = ata_qc_prep, 435 .qc_prep = ata_qc_prep,
431 .qc_issue = ata_qc_issue_prot, 436 .qc_issue = ata_qc_issue_prot,
@@ -547,6 +552,7 @@ static struct ata_port_operations opti82c611a_port_ops = {
547 .thaw = ata_bmdma_thaw, 552 .thaw = ata_bmdma_thaw,
548 .error_handler = ata_bmdma_error_handler, 553 .error_handler = ata_bmdma_error_handler,
549 .post_internal_cmd = ata_bmdma_post_internal_cmd, 554 .post_internal_cmd = ata_bmdma_post_internal_cmd,
555 .cable_detect = ata_cable_40wire,
550 556
551 .qc_prep = ata_qc_prep, 557 .qc_prep = ata_qc_prep,
552 .qc_issue = ata_qc_issue_prot, 558 .qc_issue = ata_qc_issue_prot,
@@ -680,6 +686,7 @@ static struct ata_port_operations opti82c46x_port_ops = {
680 .thaw = ata_bmdma_thaw, 686 .thaw = ata_bmdma_thaw,
681 .error_handler = ata_bmdma_error_handler, 687 .error_handler = ata_bmdma_error_handler,
682 .post_internal_cmd = ata_bmdma_post_internal_cmd, 688 .post_internal_cmd = ata_bmdma_post_internal_cmd,
689 .cable_detect = ata_cable_40wire,
683 690
684 .qc_prep = ata_qc_prep, 691 .qc_prep = ata_qc_prep,
685 .qc_issue = opti82c46x_qc_issue_prot, 692 .qc_issue = opti82c46x_qc_issue_prot,