From: lyz Date: Tue, 27 Jan 2015 07:53:53 +0000 (+0800) Subject: usb: dwc_otg: add condition judgement to filter invalid X-Git-Tag: firefly_0821_release~4263^2~49 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3d2090f53528758b8bc021441973d648943507da;p=firefly-linux-kernel-4.4.55.git usb: dwc_otg: add condition judgement to filter invalid disconnect interrupt In some case, we disconnect a usb device, then usb controller will trigger more the one disconnect interrupt, so check port enable change bit in hprt0 to make sure just one disconnect interrupt be handled. here to Signed-off-by: lyz --- diff --git a/drivers/usb/dwc_otg_310/dwc_otg_hcd.c b/drivers/usb/dwc_otg_310/dwc_otg_hcd.c index 7602e4f851f6..07845a23fc26 100755 --- a/drivers/usb/dwc_otg_310/dwc_otg_hcd.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_hcd.c @@ -288,10 +288,12 @@ static int32_t dwc_otg_hcd_disconnect_cb(void *p) hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); /* In some case, we don't disconnect a usb device, but * disconnect intr was triggered, so check hprt0 here. */ - if ((!hprt0.b.prtenchng) + if (((!hprt0.b.prtenchng) && (!hprt0.b.prtconndet) - && hprt0.b.prtconnsts) { - DWC_PRINTF("%s: hprt0 = 0x%08x\n", __func__, hprt0.d32); + && hprt0.b.prtconnsts) + || !hprt0.b.prtenchng) { + DWC_PRINTF("%s: Invalid disconnect interrupt " + "hprt0 = 0x%08x\n", __func__, hprt0.d32); return 1; } /*