diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2007-03-08 14:34:28 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 14:15:57 -0400 |
commit | fecfda5d88dcc3775f72d6f3a55d11b77c67f878 (patch) | |
tree | 5a6b0bb270a402ca799b6988e36f068f8fd8b511 | |
parent | 6bfed3fb035b4eff59160c2da5e3fbb69d6b0531 (diff) |
pata_hpt366: support ->cable_detect
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/ata/pata_hpt366.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index baf35f876030..e9ad4eba0670 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/libata.h> | 27 | #include <linux/libata.h> |
28 | 28 | ||
29 | #define DRV_NAME "pata_hpt366" | 29 | #define DRV_NAME "pata_hpt366" |
30 | #define DRV_VERSION "0.6.0" | 30 | #define DRV_VERSION "0.6.1" |
31 | 31 | ||
32 | struct hpt_clock { | 32 | struct hpt_clock { |
33 | u8 xfer_speed; | 33 | u8 xfer_speed; |
@@ -210,24 +210,28 @@ static u32 hpt36x_find_mode(struct ata_port *ap, int speed) | |||
210 | return 0xffffffffU; /* silence compiler warning */ | 210 | return 0xffffffffU; /* silence compiler warning */ |
211 | } | 211 | } |
212 | 212 | ||
213 | static int hpt36x_cable_detect(struct ata_port *ap) | ||
214 | { | ||
215 | u8 ata66; | ||
216 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
217 | |||
218 | pci_read_config_byte(pdev, 0x5A, &ata66); | ||
219 | if (ata66 & (1 << ap->port_no)) | ||
220 | return ATA_CBL_PATA40; | ||
221 | return ATA_CBL_PATA80; | ||
222 | } | ||
223 | |||
213 | static int hpt36x_pre_reset(struct ata_port *ap) | 224 | static int hpt36x_pre_reset(struct ata_port *ap) |
214 | { | 225 | { |
215 | static const struct pci_bits hpt36x_enable_bits[] = { | 226 | static const struct pci_bits hpt36x_enable_bits[] = { |
216 | { 0x50, 1, 0x04, 0x04 }, | 227 | { 0x50, 1, 0x04, 0x04 }, |
217 | { 0x54, 1, 0x04, 0x04 } | 228 | { 0x54, 1, 0x04, 0x04 } |
218 | }; | 229 | }; |
219 | |||
220 | u8 ata66; | ||
221 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 230 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
222 | 231 | ||
223 | if (!pci_test_config_bits(pdev, &hpt36x_enable_bits[ap->port_no])) | 232 | if (!pci_test_config_bits(pdev, &hpt36x_enable_bits[ap->port_no])) |
224 | return -ENOENT; | 233 | return -ENOENT; |
225 | 234 | ||
226 | pci_read_config_byte(pdev, 0x5A, &ata66); | ||
227 | if (ata66 & (1 << ap->port_no)) | ||
228 | ap->cbl = ATA_CBL_PATA40; | ||
229 | else | ||
230 | ap->cbl = ATA_CBL_PATA80; | ||
231 | return ata_std_prereset(ap); | 235 | return ata_std_prereset(ap); |
232 | } | 236 | } |
233 | 237 | ||
@@ -354,6 +358,7 @@ static struct ata_port_operations hpt366_port_ops = { | |||
354 | .thaw = ata_bmdma_thaw, | 358 | .thaw = ata_bmdma_thaw, |
355 | .error_handler = hpt36x_error_handler, | 359 | .error_handler = hpt36x_error_handler, |
356 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 360 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
361 | .cable_detect = hpt36x_cable_detect, | ||
357 | 362 | ||
358 | .bmdma_setup = ata_bmdma_setup, | 363 | .bmdma_setup = ata_bmdma_setup, |
359 | .bmdma_start = ata_bmdma_start, | 364 | .bmdma_start = ata_bmdma_start, |