From: Bartlomiej Zolnierkiewicz Date: Thu, 19 Nov 2009 19:31:31 +0000 (+0100) Subject: pata_hpt{37x,3x2n}: add debounce delay to cable detection methods X-Git-Tag: v2.6.33-rc1~380^2~41 X-Git-Url: http://ftp.safe.ca/?p=safe%2Fjmp%2Flinux-2.6;a=commitdiff_plain;h=10a9c969222de5302cff0bb41dd7f114f9aa8e5d pata_hpt{37x,3x2n}: add debounce delay to cable detection methods Alan Cox reported that cable detection sometimes works unreliably for HPT3xxN and that the issue is fixed by adding debounce delay as used by the vendor driver. Sergei Shtylyov also noticed that debounce delay is needed for all HPT37x and HPT3xxN chipsets according to vendor drivers. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Jeff Garzik --- diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 0921e8b..9f5189c 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c @@ -316,6 +316,9 @@ static int hpt37x_cable_detect(struct ata_port *ap) pci_read_config_byte(pdev, 0x5B, &scr2); pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01); + + udelay(10); /* debounce */ + /* Cable register now active */ pci_read_config_byte(pdev, 0x5A, &ata66); /* Restore state */ diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index 2ab9fd6..8d63eba 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c @@ -128,6 +128,9 @@ static int hpt3x2n_cable_detect(struct ata_port *ap) pci_read_config_byte(pdev, 0x5B, &scr2); pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01); + + udelay(10); /* debounce */ + /* Cable register now active */ pci_read_config_byte(pdev, 0x5A, &ata66); /* Restore state */