ARM: tegra: usb: reinit hw fixes upon phy_on
Suresh Mangipudi [Thu, 22 Aug 2013 05:36:02 +0000 (10:36 +0530)]
H/W fixes have to be reinitialized after the tegra resumes from LP0.
Set TXFILLTUNING for UTMI after resuming from LP0.

Bug 1318125

Change-Id: I3a64d7622df9a45c2849a40ea5a75fe35f86392d
Signed-off-by: Suresh Mangipudi <smangipudi@nvidia.com>
Reviewed-on: http://git-master/r/264708
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

arch/arm/mach-tegra/tegra11x_usb_phy.c

index 22fbb5c..5df653d 100644 (file)
@@ -1150,6 +1150,16 @@ static int utmi_phy_power_on(struct tegra_usb_phy *phy)
        if (phy->pdata->op_mode == TEGRA_USB_OPMODE_DEVICE)
                pmc->pmc_ops->powerup_pmc_wake_detect(pmc);
 
+       if (!readl(base + USB_ASYNCLISTADDR)) {
+               _usb_phy_init(phy);
+               val = readl(base + USB_TXFILLTUNING);
+               if ((val & USB_FIFO_TXFILL_MASK) !=
+                       USB_FIFO_TXFILL_THRES(0x10)) {
+                       val = USB_FIFO_TXFILL_THRES(0x10);
+                       writel(val, base + USB_TXFILLTUNING);
+               }
+       }
+
        phy->phy_clk_on = true;
        phy->hw_accessible = true;
 
@@ -1960,6 +1970,15 @@ static int uhsic_phy_power_on(struct tegra_usb_phy *phy)
        phy->phy_clk_on = true;
        phy->hw_accessible = true;
 
+       val = readl(base + USB_TXFILLTUNING);
+       if ((val & USB_FIFO_TXFILL_MASK) != USB_FIFO_TXFILL_THRES(0x10)) {
+               val = USB_FIFO_TXFILL_THRES(0x10);
+               writel(val, base + USB_TXFILLTUNING);
+       }
+
+       if (!readl(base + USB_ASYNCLISTADDR))
+               _usb_phy_init(phy);
+
        if (phy->pmc_sleepwalk) {
                DBG("%s(%d) inst:[%d] restore phy\n", __func__, __LINE__,
                                        phy->inst);
@@ -1969,12 +1988,6 @@ static int uhsic_phy_power_on(struct tegra_usb_phy *phy)
                phy->pmc_sleepwalk = false;
        }
 
-       val = readl(base + USB_TXFILLTUNING);
-       if ((val & USB_FIFO_TXFILL_MASK) != USB_FIFO_TXFILL_THRES(0x10)) {
-               val = USB_FIFO_TXFILL_THRES(0x10);
-               writel(val, base + USB_TXFILLTUNING);
-       }
-
        return 0;
 }