1 From: Tejun Heo <tj@kernel.org>
2 Subject: pata_hpt366: fix cable detection,
5 pata_hpt366 is strange in that its two channels occupy two PCI
6 functions and both are primary channels and bit1 of PCI configuration
7 register 0x5A indicates cable for both channels.
9 Signed-off-by: Tejun Heo <tj@kernel.org>
10 Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
11 Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
12 Signed-off-by: Tejun Heo <teheo@suse.de>
14 drivers/ata/pata_hpt366.c | 8 ++++++--
15 1 file changed, 6 insertions(+), 2 deletions(-)
17 Index: work/drivers/ata/pata_hpt366.c
18 ===================================================================
19 --- work.orig/drivers/ata/pata_hpt366.c
20 +++ work/drivers/ata/pata_hpt366.c
21 @@ -211,11 +211,15 @@ static u32 hpt36x_find_mode(struct ata_p
23 static int hpt36x_cable_detect(struct ata_port *ap)
26 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
30 + * Each channel of pata_hpt366 occupies separate PCI function
31 + * as the primary channel and bit1 indicates the cable type.
33 pci_read_config_byte(pdev, 0x5A, &ata66);
34 - if (ata66 & (1 << ap->port_no))
36 return ATA_CBL_PATA40;
37 return ATA_CBL_PATA80;