Received: by 10.223.185.116 with SMTP id b49csp6330684wrg; Wed, 28 Feb 2018 07:41:28 -0800 (PST) X-Google-Smtp-Source: AG47ELuwc7GsikxPxQy3KC5eSBQcJw2pHbDFXOsGTctHiZEPaVB1+VrUBKgiDBMxwJ01WslDmHKS X-Received: by 2002:a17:902:b7cc:: with SMTP id v12-v6mr11014800plz.249.1519832488151; Wed, 28 Feb 2018 07:41:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519832488; cv=none; d=google.com; s=arc-20160816; b=ida4/Nt5Jj3nH3tz3wDnbnH6GIMSqPewteBSjGOv8/JVEqqHpKoBMfNrJEbVHOPIdH i0yFIUi5d/G/bQZMH7gkTU/FOR7tTN+TZS0D9wVfN0KNRL96GZ3IEe5Eda7pveGhaBNC 3iyB8WR3SEDCaPHaPUG3lj4Cc7AI9pMATYT4MsnEGUQ2Vw/hQWynppo9u/FmDg3GCUqa FOeCZGtgkv4G8bOdpPTB2tMlMBqod1aITfA51pQI7/cnvuPXBSnxg6PF1j7y5zyzPm3i gCr+NxWljewEog3NVQAnsFmirgtcRIBujrz0v/UAzTknDUdqtmgHuBAfcIGlt94N3xbJ cXGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=o7xGbiYGzyS8HQaxfo3P7evG+W8BdH4l0ByUI/uk+zw=; b=l+jbeKrXFAQBbPBT4Qo40Bzij115BsYp4MPRn2sezu7Kxllxd5WrtCKWkjvOMaFQJd HSB7MIBVlgMjqYu+sgcjTmmyp9FDa6RUlyBRZP1/Soe5AstVip8xcE/WrLL+310MIlm/ SMClXIprNpVFYJyHTQO4KW2cP8ot8ajmOz24U3YtXK9xQSsdphrOWPDav9T+dxuROg8b 1F4I5ehkPos0SmrJnjIdYngw+wppi9GRvZpUxNKwk8MHdeQCpX3JJ5cA1i6mM/QW8mti /Hsq+mGTmT07SecXgEUv6TMNmZJdvDHiqDbEAwzREMfeXNp9fwnEoElg/tiY6QwVPUUw YVPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y24-v6si1390354pll.412.2018.02.28.07.41.13; Wed, 28 Feb 2018 07:41:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933281AbeB1PjE (ORCPT + 99 others); Wed, 28 Feb 2018 10:39:04 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:33227 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752659AbeB1PWc (ORCPT ); Wed, 28 Feb 2018 10:22:32 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yg-0006XP-PR; Wed, 28 Feb 2018 15:22:19 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yf-0008TP-Ab; Wed, 28 Feb 2018 15:22:17 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Greg Kroah-Hartman" , "Bin Liu" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 077/254] usb: musb: da8xx: fix babble condition handling In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Bin Liu commit bd3486ded7a0c313a6575343e6c2b21d14476645 upstream. 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 at the same time, so the babble recovery routine works properly. Signed-off-by: Bin Liu Signed-off-by: Greg Kroah-Hartman [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- drivers/usb/musb/da8xx.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -350,7 +350,15 @@ static irqreturn_t da8xx_musb_interrupt( musb->xceiv->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 be called. + */ musb->is_active = 0; MUSB_DEV_MODE(musb); otg->default_a = 0;