USB: tegra: reinit hw fixes upon phy_on
Suresh Mangipudi [Thu, 5 Sep 2013 09:40:40 +0000 (14:40 +0530)]
H/W fixes have to be reinitialized after the tegra resumes from LP0.
TXFILL_TUNING needs to be programmed properly for resume from LP0 and
Non LP0 cases.

Bug 1347167

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

drivers/usb/phy/tegra11x_usb_phy.c

index c8665d6..592217a 100644 (file)
@@ -1161,6 +1161,14 @@ static int utmi_phy_power_on(struct tegra_usb_phy *phy)
                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;
 
@@ -1326,6 +1334,12 @@ static int utmi_phy_resume(struct tegra_usb_phy *phy)
                        DBG("USB_USBSTS[0x%x] USB_PORTSC[0x%x]\n",
                        readl(base + USB_USBSTS), readl(base + USB_PORTSC));
                }
+               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 status;
@@ -1976,6 +1990,9 @@ static int uhsic_phy_power_on(struct tegra_usb_phy *phy)
        phy->phy_clk_on = true;
        phy->hw_accessible = true;
 
+       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);