usb: otg: tegra: change logic for enable clock
Andy Carman [Wed, 7 Mar 2012 05:25:18 +0000 (10:25 +0530)]
When there is PMU interrupt we need to enable controller
clock. For this currently, work is being schedule, removing
this as clock can be enabled directly without scheduling
any work.

bug 925958
bug 941899

Signed-off-by: Andy Carman <acarman@nvidia.com>
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-on: http://git-master/r/88777
(cherry picked from commit fc31c04b7124f30970e862dd1b21a97d18dca38e)

Change-Id: I8f6e7325771219488440226ddde97a32da228608
Reviewed-on: http://git-master/r/97882
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

drivers/usb/otg/tegra-otg.c

index ecb88ac..68d402a 100644 (file)
@@ -62,7 +62,6 @@ struct tegra_otg_data {
        struct platform_device *pdev;
        struct work_struct work;
        unsigned int intr_reg_data;
-       bool detect_vbus;
        bool clk_enabled;
        callback_t      charger_cb;
        void    *charger_cb_data;
@@ -257,12 +256,6 @@ static void irq_work(struct work_struct *work)
        unsigned long flags;
        unsigned long status;
 
-       if (tegra->detect_vbus) {
-               tegra->detect_vbus = false;
-               tegra_otg_enable_clk();
-               return;
-       }
-
        clk_enable(tegra->clk);
 
        spin_lock_irqsave(&tegra->lock, flags);
@@ -307,7 +300,6 @@ static irqreturn_t tegra_otg_irq(int irq, void *data)
                otg_writel(tegra, val, USB_PHY_WAKEUP);
                if ((val & USB_ID_INT_STATUS) || (val & USB_VBUS_INT_STATUS)) {
                        tegra->int_status = val;
-                       tegra->detect_vbus = false;
                        schedule_work(&tegra->work);
                }
        }
@@ -319,8 +311,7 @@ static irqreturn_t tegra_otg_irq(int irq, void *data)
 
 void tegra_otg_check_vbus_detection(void)
 {
-       tegra_clone->detect_vbus = true;
-       schedule_work(&tegra_clone->work);
+       tegra_otg_enable_clk();
 }
 EXPORT_SYMBOL(tegra_otg_check_vbus_detection);
 
@@ -345,7 +336,6 @@ static int tegra_otg_set_peripheral(struct otg_transceiver *otg,
 
        if ((val & USB_ID_INT_STATUS) || (val & USB_VBUS_INT_STATUS)) {
                tegra->int_status = val;
-               tegra->detect_vbus = false;
                schedule_work (&tegra->work);
        }