aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-12-09 03:13:19 -0500
committerJeff Garzik <jgarzik@redhat.com>2008-12-16 05:40:32 -0500
commitbab5b32a537edc83ff86bff91e46f328339f49f8 (patch)
treee6a33ecc8968c1e822ce08d9ffe79a72ae239eb1
parentd10d491f842243e2e3bf5a2714020f9d649e1e38 (diff)
pata_hpt366: fix cable detection,
pata_hpt366 is strange in that its two channels occupy two PCI functions and both are primary channels and bit1 of PCI configuration register 0x5A indicates cable for both channels. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--drivers/ata/pata_hpt366.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index a098ba8eaab6..4824821745a2 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -211,11 +211,15 @@ static u32 hpt36x_find_mode(struct ata_port *ap, int speed)
211 211
212static int hpt36x_cable_detect(struct ata_port *ap) 212static int hpt36x_cable_detect(struct ata_port *ap)
213{ 213{
214 u8 ata66;
215 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 214 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
215 u8 ata66;
216 216
217 /*
218 * Each channel of pata_hpt366 occupies separate PCI function
219 * as the primary channel and bit1 indicates the cable type.
220 */
217 pci_read_config_byte(pdev, 0x5A, &ata66); 221 pci_read_config_byte(pdev, 0x5A, &ata66);
218 if (ata66 & (1 << ap->port_no)) 222 if (ata66 & 2)
219 return ATA_CBL_PATA40; 223 return ATA_CBL_PATA40;
220 return ATA_CBL_PATA80; 224 return ATA_CBL_PATA80;
221} 225}