Received: by 10.213.65.68 with SMTP id h4csp14094imn; Mon, 19 Mar 2018 17:55:57 -0700 (PDT) X-Google-Smtp-Source: AG47ELtKTUPJ/vntoadq+KdY5nbLODPNtIIeJWa3QNnWu7XQ11OMWvIDGQzg/Nja3j2SPcNGnksO X-Received: by 10.99.151.26 with SMTP id n26mr10637523pge.370.1521507357870; Mon, 19 Mar 2018 17:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521507357; cv=none; d=google.com; s=arc-20160816; b=JQ8+24UK7tFDzt6kUfRJf108vRrk5XB7LUhCkDxY+4T8mhM/LEkDTMJ45Kh/vFK0Un jiqdd2unycxN+kiBE3Pezk8B8PfCGiaDY23hM0s3W0RmCXq1mdhAO2MzJoijURVqVb/C OnUMM1720HopfmG2WAiR2BSfxZ8tqnLg+NaHAARZJRo3orNJKwxmf6Iim0fJnKq4/9to Dwx0FfLlT3xtMHnTFNnKJJd6V7wYJWNxM1/maOtI8q1ClGIG0UMMP1s2ZVZDxRzq31HM vcJIrT7oSu5eKCYmf7B9xffqRwZgewBsuEu56ZjoQIzMItVOLyq+ehXaOASFnHREnes9 Bd2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=QR8qPRV2ZmGuzBGYTOTvZyZ/Kx0IV9ML0os/Ndey8Iw=; b=j41Lye2QMqGfvHRHsVPqEwnQhn2f8KoHJ94pH+1/qG0DruMyFcq0Y2/jfTLL0XzY16 heslgB+xiIgxGqUEZtMjHOvu8/Ra9+AA2UeEBXDbef1kZFSHMH8G8GP5V73u6/AUb8SY 5EqIiwsOhfsjOVc1o8vPHDE1fCPHSRf+qGmQuy3zvOd3MvCVt+u5YVHgMejRDIAwWDbI C4qV0FnMgscEvw983b1/umAT70+/iWqBAapA9pchsALHB9Hi3aHbXeHDOK5UHPT7MYKt U7P8G5Uq3QZfaSdLgPNEJs/PBnB/E/Byq5tw/RQ1NlRmF4MRg5LJEDzk74Pdgt/PBwSg dlKg== 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 k63si364963pfh.372.2018.03.19.17.55.43; Mon, 19 Mar 2018 17:55:57 -0700 (PDT) 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 S969687AbeCSSYf (ORCPT + 99 others); Mon, 19 Mar 2018 14:24:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49946 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969639AbeCSSY2 (ORCPT ); Mon, 19 Mar 2018 14:24:28 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A9B61FB0; Mon, 19 Mar 2018 18:24:27 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Xu , Guodong Xu , Amit Pundir , Rob Herring , John Youn , Douglas Anderson , Chen Yu , Felipe Balbi , linux-usb@vger.kernel.org, John Stultz , Sasha Levin Subject: [PATCH 4.9 139/241] usb: dwc2: Make sure we disconnect the gadget state Date: Mon, 19 Mar 2018 19:06:44 +0100 Message-Id: <20180319180756.939772565@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: John Stultz [ Upstream commit dad3f793f20fbb5c0c342f0f5a0bdf69a4d76089 ] I had seen some odd behavior with HiKey's usb-gadget interface that I finally seemed to have chased down. Basically every other time I plugged in the OTG port, the gadget interface would properly initialize. The other times, I'd get a big WARN_ON in dwc2_hsotg_init_fifo() about the fifo_map not being clear. Ends up if we don't disconnect the gadget state, the fifo-map doesn't get cleared properly, which causes WARN_ON messages and also results in the device not properly being setup as a gadget every other time the OTG port is connected. So this patch adds a call to dwc2_hsotg_disconnect() in the reset path so the state is properly cleared. With it, the gadget interface initializes properly on every plug in. Cc: Wei Xu Cc: Guodong Xu Cc: Amit Pundir Cc: Rob Herring Cc: John Youn Cc: Douglas Anderson Cc: Chen Yu Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Acked-by: John Youn Signed-off-by: John Stultz Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc2/hcd.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3220,6 +3220,7 @@ static void dwc2_conn_id_status_change(s dwc2_core_init(hsotg, false); dwc2_enable_global_interrupts(hsotg); spin_lock_irqsave(&hsotg->lock, flags); + dwc2_hsotg_disconnect(hsotg); dwc2_hsotg_core_init_disconnected(hsotg, false); spin_unlock_irqrestore(&hsotg->lock, flags); dwc2_hsotg_core_connect(hsotg);