usb: otg: tegra: change logic for 'from' in irq_work
Tom Cherry [Tue, 29 May 2012 22:54:57 +0000 (15:54 -0700)]
Change-Id: I8e23c1d1afd67e5b7456d63b0aa2db254c6434cf
Signed-off-by: Tom Cherry <tcherry@nvidia.com>
Reviewed-on: http://git-master/r/105211

drivers/usb/otg/tegra-otg.c

index d95d238..f72e222 100644 (file)
@@ -288,6 +288,15 @@ static void irq_work(struct work_struct *work)
        else
                to = OTG_STATE_A_SUSPEND;
 
+       if (from != OTG_STATE_A_HOST) {
+               if (tegra->int_status & USB_VBUS_INT_STATUS) {
+                       if (status & USB_VBUS_STATUS)
+                               to = OTG_STATE_B_PERIPHERAL;
+                       else
+                               to = OTG_STATE_A_SUSPEND;
+               }
+       }
+
        spin_unlock_irqrestore(&tegra->lock, flags);
        tegra_change_otg_state(tegra, to);
        clk_disable(tegra->clk);