From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lelnx193.ext.ti.com ([198.47.27.77]:31372 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758335AbdLROpB (ORCPT ); Mon, 18 Dec 2017 09:45:01 -0500 From: Bin Liu To: CC: Greg Kroah-Hartman , Bin Liu Subject: [PATCH] usb: musb: da8xx: fix babble condition handling Date: Mon, 18 Dec 2017 08:44:54 -0600 Message-ID: <1513608294-1488-1-git-send-email-b-liu@ti.com> In-Reply-To: <15135972726154@kroah.com> References: <15135972726154@kroah.com> MIME-Version: 1.0 Content-Type: text/plain Sender: stable-owner@vger.kernel.org List-ID: When babble condition happens, the musb controller might automatically turns off VBUS. On DA8xx platform, the controller generates drvvbus interrupt for turning off VBUS along with the babble interrupt. In this case, we should handle the babble interrupt first and recover from the babble condition. This change ignores the drvvbus interrupt if babble interrupt is also generated, so the babble recovery routine works properly. c: stable@vger.kernel.org # v3.16+ Signed-off-by: Bin Liu --- drivers/usb/musb/da8xx.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 0032441d68dd..ca8151f667c6 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -306,7 +306,15 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; portstate(musb->port1_status |= USB_PORT_STAT_POWER); del_timer(&otg_workaround); - } else { + } else if (!(musb->int_usb & MUSB_INTR_BABBLE)){ + /* + * When babble condition happens, drvvbus interrupt + * is also generated. Ignore this drvvbus interrupt + * and let babble interrupt handler recovers the + * controller; otherwise, the host-mode flag is lost + * due to the MUSB_DEV_MODE() call below and babble + * recovery logic will not called. + */ musb->is_active = 0; MUSB_DEV_MODE(musb); otg->default_a = 0; -- 1.9.1