arm: tegra: usb: Fix usb crashing issue on p1852
Manoj Chourasia [Thu, 15 Dec 2011 10:42:40 +0000 (15:42 +0530)]
USB driver should not give-up in case if it doesn't get
the required regulator supply. And it should operate only
in case phy regulator is not NULL.

bug 916334

Signed-off-by: Manoj Chourasia <mchourasia@nvidia.com>
Reviewed-on: http://git-master/r/70283
(cherry picked from commit 7e0fa3da23f06f992c462e098c8d7fd762cb91e8)
Change-Id: I97f65e10222fc490c9218f7cb4af922ca72b84a9
Reviewed-on: http://git-master/r/71624
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>

arch/arm/mach-tegra/usb_phy.c

index 9ba8b68..bc18395 100644 (file)
@@ -2221,7 +2221,7 @@ static irqreturn_t usb_phy_vbus_irq_thr(int irq, void *pdata)
 {
        struct tegra_usb_phy *phy = pdata;
 
-       if (!phy->regulator_on) {
+       if (phy->reg_vdd && !phy->regulator_on) {
                regulator_enable(phy->reg_vdd);
                phy->regulator_on = 1;
                /*
@@ -2365,11 +2365,10 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
 #endif
 
        phy->reg_vdd = regulator_get(NULL, "avdd_usb");
-       if (WARN_ON(IS_ERR_OR_NULL(phy->reg_vdd))) {
+       if (IS_ERR_OR_NULL(phy->reg_vdd)) {
                pr_err("couldn't get regulator avdd_usb: %ld \n",
                         PTR_ERR(phy->reg_vdd));
-               err = PTR_ERR(phy->reg_vdd);
-               goto err1;
+               phy->reg_vdd = NULL;
        }
 
        if (instance == 0 && usb_phy_data[0].vbus_irq) {