Received: by 10.213.65.68 with SMTP id h4csp39524imn; Mon, 19 Mar 2018 18:50:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELtKnN7tUFJ6zQHi2QMQS91mgi++uufciNkYFoSa5plHKAsZIo85tU0ZPYTloSs2qjh8zjZP X-Received: by 2002:a17:902:444:: with SMTP id 62-v6mr14900418ple.127.1521510635272; Mon, 19 Mar 2018 18:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521510635; cv=none; d=google.com; s=arc-20160816; b=mbZDgcvuk0kaIxvUrvc4xnFsTjG6Us0OSuMqBDGD2he9eczkQHwtK+APhynli3KNu2 /ghimWhRjITSYJoOJgdbb1hIKvI8gwS5O91wvmDo0q1kbelj5jD4+M5l8ZCjxt5vt3je LyCxeg+M6t6UAP7zNbKg3QPX2TyA+NYUfqbM73aGyEeSOWjSSwnFQ9EZxK7xEHjXDtM+ YJn2fLOl0C52grGDTBGTp0R5qirjuCuifdyWnaq6t4jXqUPV0MAN9bl6bI6M0ya93Erc TOKhx2VE1f7MzrRzWnhURb61twQ/uksUQXrqQYjxJLTYCPEEWW9S7QKD5fOY4tELly65 s/oQ== 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=E6LqrSz3GwkxeRnNfzET8RnXqx2wqBO0xbeFNw9Y9GI=; b=JRM1XaQGHDIGTK1Hx21vQyOQuv8O1SlMkeJo+aDgh66LfeeCfvljWs0P1LyyiFjbAW b/hYX0SHNANjQ3kUmYX7W0u5xcQGJgRovIc/ZjjomjZjbeMYVnK71cvXufhIWNnaz90/ +b8Bj9jdnoAbHhtXw3T+mgQ9EoFJDGwgauCAaQ3RRN7kvHjbN+nzfLEd6x6HHPBcbW7x 1bhyOHzOsAeARw/oOvSW8bVB5J4tQYUNl9JOicMTl+vMn6ZdGbuODMS+82cnfnefDPLp z4P9BaB6LdmIV+oXIxOK7dGbwhaf8ZI+7nruySpmCncD62Kmq5ZWJa4VDLxXIZLV04we ZUdA== 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 n128si382536pga.29.2018.03.19.18.50.21; Mon, 19 Mar 2018 18:50:35 -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 S1031420AbeCSUVe (ORCPT + 99 others); Mon, 19 Mar 2018 16:21:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44340 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968903AbeCSSOu (ORCPT ); Mon, 19 Mar 2018 14:14:50 -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 E4584F61; Mon, 19 Mar 2018 18:14:49 +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.4 068/134] usb: dwc2: Make sure we disconnect the gadget state Date: Mon, 19 Mar 2018 19:05:51 +0100 Message-Id: <20180319171859.057406471@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@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.4-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 @@ -1385,6 +1385,7 @@ static void dwc2_conn_id_status_change(s dwc2_core_init(hsotg, false, -1); 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);