arm: tegra: usb_phy: vddio_hsic power rail control
Seshendra Gadagottu [Wed, 3 Aug 2011 14:14:54 +0000 (19:14 +0530)]
Switching off vddio_hsic power rail when hsic interface is
not getting used.

BUG 856606

Original-Change-Id: I804303a933a63e6af0faa035da889ebc65769137
Reviewed-on: http://git-master/r/44773
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: Rececab71649aaeaa644cf949033485dc0b977b69

arch/arm/mach-tegra/usb_phy.c

index a7fe6e2..31dfea1 100644 (file)
@@ -1425,6 +1425,12 @@ static int uhsic_phy_power_on(struct tegra_usb_phy *phy, bool is_dpd)
        void __iomem *base = phy->regs;
        struct tegra_uhsic_config *uhsic_config = phy->config;
 
+       if (uhsic_config->enable_gpio != -1) {
+               gpio_set_value_cansleep(uhsic_config->enable_gpio, 1);
+               /* keep hsic reset asserted for 1 ms */
+               udelay(1000);
+       }
+
        val = readl(base + UHSIC_PADS_CFG1);
        val &= ~(UHSIC_PD_BG | UHSIC_PD_TX | UHSIC_PD_TRK | UHSIC_PD_RX |
                        UHSIC_PD_ZI | UHSIC_RPD_DATA | UHSIC_RPD_STROBE);
@@ -1504,6 +1510,7 @@ static int uhsic_phy_power_off(struct tegra_usb_phy *phy, bool is_dpd)
 {
        unsigned long val;
        void __iomem *base = phy->regs;
+       struct tegra_uhsic_config *uhsic_config = phy->config;
 
        val = readl(base + UHSIC_PADS_CFG1);
        val &= ~UHSIC_RPU_STROBE;
@@ -1519,6 +1526,12 @@ static int uhsic_phy_power_off(struct tegra_usb_phy *phy, bool is_dpd)
        val &= ~UHSIC_PHY_ENABLE;
        writel(val, base + USB_SUSP_CTRL);
 
+       if (uhsic_config->enable_gpio != -1) {
+               gpio_set_value_cansleep(uhsic_config->enable_gpio, 0);
+               /* keep hsic reset de-asserted for 1 ms */
+               udelay(1000);
+       }
+
        return 0;
 }