ARM: tegra: usb: check for valid phy clock
Krishna Yarlagadda [Fri, 18 Nov 2011 09:32:17 +0000 (14:32 +0530)]
Check for valid clock after setting up phy
in UTMIP reset

Bug 853708
Bug 886080

(reviewed on http://git-master/r/51555)
(cherry picked from commit 25b340b64ca27971f6d2d555299a749f0394e77e)

Change-Id: I98c79fb1e8961b9af19f3001fe6fbde2b28509a0
Reviewed-on: http://git-master/r/75502
Reviewed-by: Simone Willett <swillett@nvidia.com>
Signed-off-by: Ken Chang <kenc@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/76468
Reviewed-by: Automatic_Commit_Validation_User

arch/arm/mach-tegra/usb_phy.c

index 8c2990b..5eab7cc 100644 (file)
@@ -790,6 +790,7 @@ static void utmi_phy_clk_disable(struct tegra_usb_phy *phy)
 {
        unsigned long val;
        void __iomem *base = phy->regs;
+
 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
        if (phy->instance == 0) {
                val = readl(base + USB_SUSP_CTRL);
@@ -813,6 +814,15 @@ static void utmi_phy_clk_disable(struct tegra_usb_phy *phy)
        val |= HOSTPC1_DEVLC_PHCD;
        writel(val, base + HOSTPC1_DEVLC);
 #endif
+       if (phy->instance == 2) {
+               val = readl(base + USB_SUSP_CTRL);
+               val |= USB_PHY_CLK_VALID_INT_ENB;
+               writel(val, base + USB_SUSP_CTRL);
+       } else {
+               val = readl(base + USB_SUSP_CTRL);
+               val |= UTMIP_RESET;
+               writel(val, base + USB_SUSP_CTRL);
+       }
 
        if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 0) < 0)
                pr_err("%s: timeout waiting for phy to stabilize\n", __func__);
@@ -1360,15 +1370,6 @@ static int utmi_phy_power_off(struct tegra_usb_phy *phy, bool is_dpd)
 
        utmi_phy_clk_disable(phy);
 
-       if (phy->hotplug) {
-               val = readl(base + USB_SUSP_CTRL);
-               val |= USB_PHY_CLK_VALID_INT_ENB;
-               writel(val, base + USB_SUSP_CTRL);
-       } else {
-               val = readl(base + USB_SUSP_CTRL);
-               val |= UTMIP_RESET;
-               writel(val, base + USB_SUSP_CTRL);
-       }
        utmip_pad_power_off(phy, true);
        return 0;
 }