From: wlf Date: Mon, 12 May 2014 09:02:05 +0000 (+0800) Subject: USB: Fix usb host hotplug bug. X-Git-Tag: firefly_0821_release~5304 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=fbd37031c11761882188e4b1f5c62bdf83a6c6f3;p=firefly-linux-kernel-4.4.55.git USB: Fix usb host hotplug bug. --- diff --git a/drivers/usb/dwc_otg_310/dwc_otg_hcd.c b/drivers/usb/dwc_otg_310/dwc_otg_hcd.c index 1ac55659ca4b..42c241440966 100755 --- a/drivers/usb/dwc_otg_310/dwc_otg_hcd.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_hcd.c @@ -177,7 +177,7 @@ static void kill_urbs_in_qh_list(dwc_otg_hcd_t * hcd, dwc_list_link_t * qh_list) qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); if (qtd->urb != NULL) { hcd->fops->complete(hcd, qtd->urb->priv, - qtd->urb, -DWC_E_TIMEOUT); + qtd->urb, -DWC_E_SHUTDOWN); dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); } @@ -489,7 +489,7 @@ int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * hcd, if (!hcd->flags.b.port_connect_status) { /* No longer connected. */ - DWC_ERROR("Not connected\n"); + DWC_DEBUG("Not connected\n"); return -DWC_E_NO_DEVICE; } diff --git a/drivers/usb/dwc_otg_310/dwc_otg_hcd_intr.c b/drivers/usb/dwc_otg_310/dwc_otg_hcd_intr.c index dfec664b39ce..de629e0e72d9 100755 --- a/drivers/usb/dwc_otg_310/dwc_otg_hcd_intr.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_hcd_intr.c @@ -48,6 +48,7 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) { int retval = 0; + dwc_irqflags_t flags; dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; gintsts_data_t gintsts; @@ -64,12 +65,12 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) if (core_if->hibernation_suspend == 1) { return retval; } - DWC_SPINLOCK(dwc_otg_hcd->lock); + DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); /* Check if HOST Mode */ if (dwc_otg_is_host_mode(core_if)) { gintsts.d32 = dwc_otg_read_core_intr(core_if); if (!gintsts.d32) { - DWC_SPINUNLOCK(dwc_otg_hcd->lock); + DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); return 0; } #ifdef DEBUG @@ -138,7 +139,7 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) #endif } - DWC_SPINUNLOCK(dwc_otg_hcd->lock); + DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); return retval; } @@ -1822,6 +1823,11 @@ static int32_t handle_hc_datatglerr_intr(dwc_otg_hcd_t * hcd, { DWC_ERROR("--Host Channel %d Interrupt: " "Data Toggle Error--\n", hc->hc_num); + if (!hcd->flags.b.port_connect_status) { + /* No longer connected. */ + DWC_ERROR("Not connected\n"); + return 1; + } if (hc->ep_is_in) { qtd->error_count += 3;//Complete the error URB immediately } else {