david-b@pacbell.net
[PATCH] USB: ehci patch for NF4 port miscounting
ChangeSet 1.2055, 2005/02/16 14:26:30-08:00, david-b@pacbell.net

[PATCH] USB: ehci patch for NF4 port miscounting

Turns out that a workaround for a different EHCI chip trips up at
least one NForce4 board.  Neither controller can multiply right.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


 drivers/usb/host/ehci-hcd.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)


diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
--- a/drivers/usb/host/ehci-hcd.c	2005-02-16 14:47:43 -08:00
+++ b/drivers/usb/host/ehci-hcd.c	2005-02-16 14:47:43 -08:00
@@ -389,8 +389,29 @@
 	temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);
 	temp &= 0x0f;
 	if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) {
-		temp |= (ehci->hcs_params & ~0xf);
-		ehci->hcs_params = temp;
+		ehci_dbg (ehci, "bogus port configuration: "
+			"cc=%d x pcc=%d < ports=%d\n",
+			HCS_N_CC(ehci->hcs_params),
+			HCS_N_PCC(ehci->hcs_params),
+			HCS_N_PORTS(ehci->hcs_params));
+
+#ifdef	CONFIG_PCI
+		if (hcd->self.controller->bus == &pci_bus_type) {
+			struct pci_dev	*pdev;
+
+			pdev = to_pci_dev(hcd->self.controller);
+			switch (pdev->vendor) {
+			case 0x17a0:		/* GENESYS */
+				/* GL880S: should be PORTS=2 */
+				temp |= (ehci->hcs_params & ~0xf);
+				ehci->hcs_params = temp;
+				break;
+			case PCI_VENDOR_ID_NVIDIA:
+				/* NF4: should be PCC=10 */
+				break;
+			}
+		}
+#endif
 	}
 
 	/* force HC to halt state */
