summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/tegra3_usb_phy.c
diff options
context:
space:
mode:
authorVenu Byravarasu <vbyravarasu@nvidia.com>2012-07-24 18:12:22 +0530
committerLokesh Pathak <lpathak@nvidia.com>2012-07-30 08:41:48 -0700
commit6d24e4887d377c0318514aea091cf6e3b5e7cf53 (patch)
tree23306ed0a210feaa370cc38169ddceacd96296f6 /arch/arm/mach-tegra/tegra3_usb_phy.c
parent935adef53692ab73a02a7d09876756b30beb5206 (diff)
arm: tegra3: usb_phy: Add support for HSIC wakeup
As part of this patch following changes are made: 1. HSIC regulator enable/disable is added 2. HSIC phy close is added. bug 1010916 Change-Id: I4607a3ac13417a201b62708c6fef5d1117dfdcc5 Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com> Reviewed-on: http://git-master/r/116984 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/tegra3_usb_phy.c')
-rw-r--r--arch/arm/mach-tegra/tegra3_usb_phy.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/tegra3_usb_phy.c b/arch/arm/mach-tegra/tegra3_usb_phy.c
index 0b8ab076693d..171e2ec91ada 100644
--- a/arch/arm/mach-tegra/tegra3_usb_phy.c
+++ b/arch/arm/mach-tegra/tegra3_usb_phy.c
@@ -2065,10 +2065,58 @@ static void uhsic_phy_restore_end(struct tegra_usb_phy *phy)
}
}
+static int hsic_rail_enable(struct tegra_usb_phy *phy)
+{
+ int ret;
+
+ if (phy->hsic_reg == NULL) {
+ phy->hsic_reg = regulator_get(NULL, "avdd_hsic");
+ if (IS_ERR_OR_NULL(phy->hsic_reg)) {
+ pr_err("HSIC: Could not get regulator avdd_hsic\n");
+ phy->hsic_reg = NULL;
+ return PTR_ERR(phy->hsic_reg);
+ }
+ }
+
+ ret = regulator_enable(phy->hsic_reg);
+ if (ret < 0) {
+ pr_err("%s avdd_hsic could not be enabled\n", __func__);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int hsic_rail_disable(struct tegra_usb_phy *phy)
+{
+ int ret;
+
+ if (phy->hsic_reg == NULL) {
+ pr_warn("%s: unbalanced disable\n", __func__);
+ return -EIO;
+ }
+
+ ret = regulator_disable(phy->hsic_reg);
+ if (ret < 0) {
+ pr_err("HSIC regulator avdd_hsic cannot be disabled\n");
+ return ret;
+ }
+
+ return 0;
+}
+
static int uhsic_phy_open(struct tegra_usb_phy *phy)
{
unsigned long parent_rate;
int i;
+ int ret;
+
+ phy->hsic_reg = NULL;
+ ret = hsic_rail_enable(phy);
+ if (ret < 0) {
+ pr_err("%s avdd_hsic could not be enabled\n", __func__);
+ return ret;
+ }
DBG("%s(%d) inst:[%d]\n", __func__, __LINE__, phy->inst);
parent_rate = clk_get_rate(clk_get_parent(phy->pllu_clk));
@@ -2088,6 +2136,15 @@ static int uhsic_phy_open(struct tegra_usb_phy *phy)
return 0;
}
+static void uhsic_phy_close(struct tegra_usb_phy *phy)
+{
+ int ret;
+
+ ret = hsic_rail_disable(phy);
+ if (ret < 0)
+ pr_err("%s avdd_hsic could not be disabled\n", __func__);
+}
+
static int uhsic_phy_irq(struct tegra_usb_phy *phy)
{
usb_phy_fence_read(phy);
@@ -2863,6 +2920,7 @@ static struct tegra_usb_phy_ops utmi_phy_ops = {
static struct tegra_usb_phy_ops uhsic_phy_ops = {
.open = uhsic_phy_open,
+ .close = uhsic_phy_close,
.irq = uhsic_phy_irq,
.power_on = uhsic_phy_power_on,
.power_off = uhsic_phy_power_off,