diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-03-09 08:37:46 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 14:15:57 -0400 |
commit | a73984a0d5664fa1bfdd9f0a475b8d74af7f44a6 (patch) | |
tree | 5d9e919be73fdc84ac66a9822a1a0fcc86840b90 /drivers/ata/pata_artop.c | |
parent | fecfda5d88dcc3775f72d6f3a55d11b77c67f878 (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_artop.c')
-rw-r--r-- | drivers/ata/pata_artop.c | 26 |
1 files changed, 18 insertions, 8 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 | |||
100 | static 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, |