]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.drivers/libata-pata_hpt366-fix-cable-detection
Fix oinkmaster patch.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.drivers / libata-pata_hpt366-fix-cable-detection
1 From: Tejun Heo <tj@kernel.org>
2 Subject: pata_hpt366: fix cable detection,
3 References: bnc#362159
4
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.
8
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>
13 ---
14 drivers/ata/pata_hpt366.c | 8 ++++++--
15 1 file changed, 6 insertions(+), 2 deletions(-)
16
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
22
23 static int hpt36x_cable_detect(struct ata_port *ap)
24 {
25 - u8 ata66;
26 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
27 + u8 ata66;
28
29 + /*
30 + * Each channel of pata_hpt366 occupies separate PCI function
31 + * as the primary channel and bit1 indicates the cable type.
32 + */
33 pci_read_config_byte(pdev, 0x5A, &ata66);
34 - if (ata66 & (1 << ap->port_no))
35 + if (ata66 & 2)
36 return ATA_CBL_PATA40;
37 return ATA_CBL_PATA80;
38 }
39