usb: ehci: tegra: fix hotplug issue on usb2
Ken Chang [Fri, 1 Jul 2011 07:35:06 +0000 (15:35 +0800)]
usb hotplug is supported only for UTMI phy. usb_phy_type should be
carefully checked in ehci irq.

bug 845612

(Cherry picked from commit 894ef272deec269ccbf1caf2b9a5e4ce3bbf7a0f)
(Reviewed on http://git-master/r/39338)

Original-Change-Id: I19e0de3353f17a7d46d097b90009e5182a6c20ba
Reviewed-on: http://git-master/r/40010
Tested-by: Ken Chang <kenc@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: ChihJen Hsu <chhsu@nvidia.com>

Rebase-Id: Rdf9eaa0c1db04beac15686c969fd497a59b2acdd

drivers/usb/host/ehci-tegra.c

index 877d45a..b566a97 100644 (file)
@@ -147,26 +147,29 @@ static irqreturn_t tegra_ehci_irq (struct usb_hcd *hcd)
 {
        struct ehci_hcd *ehci = hcd_to_ehci (hcd);
        struct ehci_regs __iomem *hw = ehci->regs;
+       struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
        u32 val;
 
-       spin_lock(&ehci->lock);
-       val = readl(hcd->regs + TEGRA_USB_SUSP_CTRL_OFFSET);
-       if ((val  & TEGRA_USB_PHY_CLK_VALID_INT_STS)) {
-               val &= ~TEGRA_USB_PHY_CLK_VALID_INT_ENB |
+       if (tegra->phy->usb_phy_type == TEGRA_USB_PHY_TYPE_UTMIP) {
+               spin_lock(&ehci->lock);
+               val = readl(hcd->regs + TEGRA_USB_SUSP_CTRL_OFFSET);
+               if ((val  & TEGRA_USB_PHY_CLK_VALID_INT_STS)) {
+                       val &= ~TEGRA_USB_PHY_CLK_VALID_INT_ENB |
                                TEGRA_USB_PHY_CLK_VALID_INT_STS;
-               writel(val , (hcd->regs + TEGRA_USB_SUSP_CTRL_OFFSET));
+                       writel(val , (hcd->regs + TEGRA_USB_SUSP_CTRL_OFFSET));
 
-               val = readl(hcd->regs + TEGRA_USB_PORTSC1_OFFSET);
-               val &= ~TEGRA_USB_PORTSC1_WKCN;
-               writel(val , (hcd->regs + TEGRA_USB_PORTSC1_OFFSET));
+                       val = readl(hcd->regs + TEGRA_USB_PORTSC1_OFFSET);
+                       val &= ~TEGRA_USB_PORTSC1_WKCN;
+                       writel(val , (hcd->regs + TEGRA_USB_PORTSC1_OFFSET));
 
-               val = readl(&hw->status);
-               if (!(val  & STS_PCD)) {
-                       spin_unlock(&ehci->lock);
-                       return 0;
+                       val = readl(&hw->status);
+                       if (!(val  & STS_PCD)) {
+                               spin_unlock(&ehci->lock);
+                               return 0;
+                       }
                }
+               spin_unlock(&ehci->lock);
        }
-       spin_unlock(&ehci->lock);
        return ehci_irq(hcd);
 }