usb: xhci: tegra: Power/Unpowergate PEX partition
Jay Agarwal [Thu, 6 Feb 2014 07:25:57 +0000 (12:25 +0530)]
This is WAR for HW Bug#1320346, PEX partition need
to be unpowergated whenever XUSB is used. Also
powergate it in suspend to save power.

Bug 1451279

Change-Id: I29d6c5182a8b38559911fb3b78d0074f990530f7
Signed-off-by: Jay Agarwal <jagarwal@nvidia.com>
Reviewed-on: http://git-master/r/361864
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

drivers/usb/host/xhci-tegra.c

index 707309c..c83c026 100644 (file)
@@ -2701,6 +2701,14 @@ static int tegra_xhci_host_elpg_entry(struct tegra_xhci_hcd *tegra)
                /* TODO: error handling? */
                return ret;
        }
+       if (tegra_powergate_is_powered(TEGRA_POWERGATE_PCIE)) {
+               ret = tegra_powergate_partition(TEGRA_POWERGATE_PCIE);
+               if (ret) {
+                       xhci_err(xhci, "%s: could not powergate pex partition %d\n",
+                               __func__, ret);
+                       return ret;
+               }
+       }
        tegra->host_pwr_gated = true;
        clk_disable(tegra->host_clk);
 
@@ -3028,6 +3036,15 @@ tegra_xhci_host_partition_elpg_exit(struct tegra_xhci_hcd *tegra)
                        __func__, ret);
                goto out;
        }
+       /* unpwrgate PEX(if not done by PCIE driver) due to HW Bug1320346 */
+       if (!tegra_powergate_is_powered(TEGRA_POWERGATE_PCIE)) {
+               ret = tegra_unpowergate_partition(TEGRA_POWERGATE_PCIE);
+               if (ret) {
+                       xhci_err(xhci, "%s: could not unpowergate pex partition %d\n",
+                               __func__, ret);
+                       goto out;
+               }
+       }
        clk_enable(tegra->host_clk);
 
        /* Step 4: Deassert reset to host partition clk */
@@ -4407,6 +4424,13 @@ static int tegra_xhci_probe(struct platform_device *pdev)
        if (ret)
                dev_err(&pdev->dev, "could not unpowergate xusbc partition\n");
 
+       /* unpwrgate PEX(if not done by PCIE driver) due to HW Bug1320346 */
+       if (!tegra_powergate_is_powered(TEGRA_POWERGATE_PCIE)) {
+               ret = tegra_unpowergate_partition(TEGRA_POWERGATE_PCIE);
+               if (ret)
+                       dev_err(&pdev->dev, "could not unpowergate pex partition\n");
+       }
+
        ret = tegra_enable_xusb_clk(tegra, pdev);
        if (ret)
                dev_err(&pdev->dev, "could not enable partition clock\n");