From 69ae0833cd9e4d51d62c9d37eceebe87335b52d5 Mon Sep 17 00:00:00 2001
From: Weixing Shi <weixing.shil@windriver.com>
Date: Mon, 12 Apr 2010 14:58:03 +0800
Subject: [PATCH] malta uhci quirks: make allowance for slow 4k(e)c

This works around an unexpected IRQ #255 seen during initial USB host
mass storage device initialization and access.
* wait up to 50us for HCRESET to clear, a slow 4kc needs a longer time.
* leave FSBR enabled so that a slow 4kec/24kec will not be overwhelmed.

Signed-off-by: <weixing.shil@windriver.com> Weixing Shi
Signed-off-by: <bruce.ashfield@windriver.com> Bruce Ashfield
---
 drivers/usb/host/pci-quirks.c | 14 ++++++++++++--
 drivers/usb/host/uhci-q.c     |  4 +++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 161536717025..cf819d2a5b34 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -518,6 +518,9 @@ EXPORT_SYMBOL_GPL(usb_amd_dev_put);
  */
 void uhci_reset_hc(struct pci_dev *pdev, unsigned long base)
 {
+#ifdef CONFIG_MIPS_MALTA
+	int timeout = 10;
+#endif
 	/* Turn off PIRQ enable and SMI enable.  (This also turns off the
 	 * BIOS's USB Legacy Support.)  Turn off all the R/WC bits too.
 	 */
@@ -531,9 +534,16 @@ void uhci_reset_hc(struct pci_dev *pdev, unsigned long base)
 	outw(UHCI_USBCMD_HCRESET, base + UHCI_USBCMD);
 	mb();
 	udelay(5);
-	if (inw(base + UHCI_USBCMD) & UHCI_USBCMD_HCRESET)
-		dev_warn(&pdev->dev, "HCRESET not completed yet!\n");
 
+#ifdef CONFIG_MIPS_MALTA
+	while (inw(base + UHCI_USBCMD) & UHCI_USBCMD_HCRESET) {
+	        if (--timeout < 0) {
+			dev_warn(&pdev->dev, "HCRESET timed out!\n");
+			break;
+		}
+		udelay(5);
+	}
+#endif
 	/* Just to be safe, disable interrupt requests and
 	 * make sure the controller is stopped.
 	 */
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 35fcb826152c..1cd2808eb455 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -72,7 +72,9 @@ static void uhci_fsbr_off(struct uhci_hcd *uhci)
 static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb)
 {
 	struct urb_priv *urbp = urb->hcpriv;
-
+#ifdef CONFIG_MIPS_MALTA
+       return;
+#endif
 	urbp->fsbr = 1;
 }
 
-- 
2.5.0

