ChangeSet 1.1722.97.77, 2004/06/17 15:21:44-07:00, david-b@pacbell.net

[PATCH] proper bios handoff in ehci-hcd

Stuart Hayes here at Dell has identified this or/and mix-up in the
ehci-hcd driver.  Because of this, ehci-hcd is not properly released by
BIOSes supporting full 2.0 and port behavior can then become erratic.

(Code predates general availability of such BIOS firmware.  This version
of the patch also fixes minor linewrap issues.)

 From:          Gary Lerhaupt <Gary_Lerhaupt@Dell.com>
 Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
 Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/usb/host/ehci-hcd.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
--- a/drivers/usb/host/ehci-hcd.c	Fri Jun 18 10:52:54 2004
+++ b/drivers/usb/host/ehci-hcd.c	Fri Jun 18 10:52:54 2004
@@ -290,16 +290,17 @@
 {
 	if (cap & (1 << 16)) {
 		int msec = 500;
+		struct pci_dev *pdev = to_pci_dev(ehci->hcd.self.controller);
 
 		/* request handoff to OS */
-		cap &= 1 << 24;
-		pci_write_config_dword (to_pci_dev(ehci->hcd.self.controller), where, cap);
+		cap |= 1 << 24;
+		pci_write_config_dword(pdev, where, cap);
 
 		/* and wait a while for it to happen */
 		do {
 			msleep(10);
 			msec -= 10;
-			pci_read_config_dword (to_pci_dev(ehci->hcd.self.controller), where, &cap);
+			pci_read_config_dword(pdev, where, &cap);
 		} while ((cap & (1 << 16)) && msec);
 		if (cap & (1 << 16)) {
 			ehci_err (ehci, "BIOS handoff failed (%d, %04x)\n",
