usb: musb: Fix for handling overcurrent condition in host mode
authorRavi B <ravibabu@ti.com>
Mon, 28 Nov 2011 13:28:11 +0000 (18:58 +0530)
committerVaibhav Hiremath <hvaibhav@ti.com>
Mon, 23 Jan 2012 19:14:41 +0000 (00:44 +0530)
The overcurrent situation can occur in 2 scenarios
a) when usb device connected directly to musb root-port and device draw the
more current, further the VBUS_ERROR is generated and root-hub port change
status need to be notified to hub driver to handle over-current situation.
b) when usb device connected thrugh HUB, the hub status change will be
notified by hub through interrupt transfer and handled approperiately by HUB
driver.

This patch fixes (a), where root hub status change was not notified to hub driver.

Signed-off-by: Ravi B <ravibabu@ti.com>
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
drivers/usb/musb/musb_core.c

index a65012157228524368e0acf017f09aa7a1ec4e05..ef500aaf4ecb14bf4b6bcb0ac535e94eeefbcf87 100644 (file)
@@ -571,6 +571,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
        }
 
        if (int_usb & MUSB_INTR_VBUSERROR) {
+               struct usb_hcd *hcd = musb_to_hcd(musb);
                int     ignore = 0;
 
                /* During connection as an A-Device, we may see a short
@@ -610,6 +611,13 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
                                musb->port1_status |=
                                          USB_PORT_STAT_OVERCURRENT
                                        | (USB_PORT_STAT_C_OVERCURRENT << 16);
+
+                               if (hcd->status_urb)
+                                       usb_hcd_poll_rh_status(hcd);
+                               else
+                                       usb_hcd_resume_root_hub(hcd);
+
+                               MUSB_HST_MODE(musb);
                        }
                        break;
                default: