linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] hpt366: add debounce delay to cable_detect() method
@ 2010-09-27 14:08 Sergei Shtylyov
  2010-09-27 18:00 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Sergei Shtylyov @ 2010-09-27 14:08 UTC (permalink / raw)
  To: davem; +Cc: linux-ide, stable, bzolnier, alan

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 drivers.

While at it, get rid of unneeded parens/space in the vicinity...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: stable@kernel.org

---
The patcn is atop of ide-2.6.git tree...

 drivers/ide/hpt366.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Index: ide-2.6/drivers/ide/hpt366.c
===================================================================
--- ide-2.6.orig/drivers/ide/hpt366.c
+++ ide-2.6/drivers/ide/hpt366.c
@@ -1173,8 +1173,9 @@ static u8 hpt3xx_cable_detect(ide_hwif_t
 		u16 mcr;
 
 		pci_read_config_word(dev, mcr_addr, &mcr);
-		pci_write_config_word(dev, mcr_addr, (mcr | 0x8000));
-		/* now read cable id register */
+		pci_write_config_word(dev, mcr_addr, mcr | 0x8000);
+		/* Debounce, then read cable ID register */
+		udelay(10);
 		pci_read_config_byte(dev, 0x5a, &scr1);
 		pci_write_config_word(dev, mcr_addr, mcr);
 	} else if (chip_type >= HPT370) {
@@ -1185,10 +1186,11 @@ static u8 hpt3xx_cable_detect(ide_hwif_t
 		u8 scr2 = 0;
 
 		pci_read_config_byte(dev, 0x5b, &scr2);
-		pci_write_config_byte(dev, 0x5b, (scr2 & ~1));
-		/* now read cable id register */
+		pci_write_config_byte(dev, 0x5b, scr2 & ~1);
+		/* Debounce, then read cable ID register */
+		udelay(10);
 		pci_read_config_byte(dev, 0x5a, &scr1);
-		pci_write_config_byte(dev, 0x5b,  scr2);
+		pci_write_config_byte(dev, 0x5b, scr2);
 	} else
 		pci_read_config_byte(dev, 0x5a, &scr1);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] hpt366: add debounce delay to cable_detect() method
  2010-09-27 14:08 [PATCH 1/2] hpt366: add debounce delay to cable_detect() method Sergei Shtylyov
@ 2010-09-27 18:00 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-09-27 18:00 UTC (permalink / raw)
  To: sshtylyov; +Cc: linux-ide, stable, bzolnier, alan

From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Date: Mon, 27 Sep 2010 18:08:15 +0400

> 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 drivers.
> 
> While at it, get rid of unneeded parens/space in the vicinity...
> 
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-27 18:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-27 14:08 [PATCH 1/2] hpt366: add debounce delay to cable_detect() method Sergei Shtylyov
2010-09-27 18:00 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).