diff options
author | Seongho Joo <sjoo@nvidia.com> | 2011-08-26 00:01:23 +0900 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-09-02 17:55:39 -0700 |
commit | c2d98e286f6e4082d723f7cef45f9c87d12dcb7a (patch) | |
tree | 77d78b9fe85e9286ad7c22a80607997ed1013943 /arch | |
parent | 08d70a350e6171b4f774b4293af9557ef1f3ce36 (diff) |
arm: tegra: usb_phy: check gpio if it is valid
only reset gpio is checked if it is valid.
additionally check enable gpio.
gpio validation is checked by gpio_request.
Bug 851098
Change-Id: I5b27310e7126074020ab5bdedc33bb62b14351cc
Reviewed-on: http://git-master/r/49239
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Diffstat (limited to 'arch')
-rwxr-xr-x[-rw-r--r--] | arch/arm/mach-tegra/usb_phy.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c index ef22c89e59f5..adf7a4f3aad1 100644..100755 --- a/arch/arm/mach-tegra/usb_phy.c +++ b/arch/arm/mach-tegra/usb_phy.c @@ -1923,6 +1923,7 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs, unsigned long parent_rate; int i; int err; + int reset_gpio, enable_gpio; phy = kzalloc(sizeof(struct tegra_usb_phy), GFP_KERNEL); if (!phy) @@ -2005,27 +2006,29 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs, #ifndef CONFIG_ARCH_TEGRA_2x_SOC else if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_HSIC) { uhsic_config = config; - gpio_request(uhsic_config->enable_gpio, + enable_gpio = gpio_request(uhsic_config->enable_gpio, "uhsic_enable"); - if (uhsic_config->reset_gpio != -1) - gpio_request(uhsic_config->reset_gpio, + reset_gpio = gpio_request(uhsic_config->reset_gpio, "uhsic_reset"); /* hsic enable signal deasserted, hsic reset asserted */ - gpio_direction_output(uhsic_config->enable_gpio, + if (!enable_gpio) + gpio_direction_output(uhsic_config->enable_gpio, 0 /* deasserted */); - if (uhsic_config->reset_gpio != -1) + if (!reset_gpio) gpio_direction_output(uhsic_config->reset_gpio, 0 /* asserted */); - tegra_gpio_enable(uhsic_config->enable_gpio); - if (uhsic_config->reset_gpio != -1) + if (!enable_gpio) + tegra_gpio_enable(uhsic_config->enable_gpio); + if (!reset_gpio) tegra_gpio_enable(uhsic_config->reset_gpio); /* keep hsic reset asserted for 1 ms */ udelay(1000); /* enable (power on) hsic */ - gpio_set_value_cansleep(uhsic_config->enable_gpio, 1); + if (!enable_gpio) + gpio_set_value_cansleep(uhsic_config->enable_gpio, 1); udelay(1000); /* deassert reset */ - if (uhsic_config->reset_gpio != -1) + if (!reset_gpio) gpio_set_value_cansleep(uhsic_config->reset_gpio, 1); } #endif |