Skip to content

Commit

Permalink
pata_hpt366: fix cable detection,
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Dec 16, 2008
1 parent d10d491 commit bab5b32
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/ata/pata_hpt366.c
Original file line number Diff line number Diff line change
@@ -211,11 +211,15 @@ static u32 hpt36x_find_mode(struct ata_port *ap, int speed)

static int hpt36x_cable_detect(struct ata_port *ap)
{
u8 ata66;
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
u8 ata66;

/*
* Each channel of pata_hpt366 occupies separate PCI function
* as the primary channel and bit1 indicates the cable type.
*/
pci_read_config_byte(pdev, 0x5A, &ata66);
if (ata66 & (1 << ap->port_no))
if (ata66 & 2)
return ATA_CBL_PATA40;
return ATA_CBL_PATA80;
}

0 comments on commit bab5b32

Please sign in to comment.