Received: by 10.223.185.116 with SMTP id b49csp1082432wrg; Sat, 3 Mar 2018 15:03:41 -0800 (PST) X-Google-Smtp-Source: AG47ELtrV6wzvU+X6f54mM8+0B9XQxmWMEzxQxyws61DRntaOQ9zR6gbWeXnykyIyBmlsQ1Quw8K X-Received: by 2002:a17:902:6ecf:: with SMTP id l15-v6mr8930015pln.443.1520118221109; Sat, 03 Mar 2018 15:03:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520118221; cv=none; d=google.com; s=arc-20160816; b=v+O/DKz4nKXwbfti6zfvm3qVgxe+C02ZENJG3c5E8dRXXAmMmi1yS/65ARsdEJuNpe TNfT6yu9j7ZaR1RoVRrS80eFGGmthoWSPbHogxJwgGQMQNU+TiId7286uYsPAH3QPaBi Ei/N+t4LQ0T8r3H7/NH+3czKwLyd3pTTdU4X0Yxiw87wbCqEo6M2JQ3fcyS7qpalKH7y CVkaLwpQuMoXivx/V27xNzdLGQKxK6oWuOT6MitKJjq+JeQuw9JW9zxvpNIcRwqclFBi G+ZDgpd2mvxMJDGi4DTOyDp2t9ayl13n/GyHKsicPCtlmEljp4/D8eEDcP/qXXPBaprl pwTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=TzAPGmNKMMGBvJ9+kDIZDy6948Pq1oUGymC0IPsj4WI=; b=ECyDg1qWReGDHL9dNT6eaoKCPvy4EE/lZWX060QgmwVuD0s0VRpYGxdFc36q1/048c UbiizNdVQDN3mQ+HPKuv9RPE3i0n11J+g0VkJ1V0Lq8uuv9bPXMYYbZSfllgdsXym9Xp 1q7h+9zEb4tAnQywUOKMkY6LlIUfNzhNrk5mOBsJ2iWOlx7fgdsE63vCHSGFpgkf2mQd vrd1hR+r9Xd6DlgZsiyUt9jju6pnrxghb7zLkfR3Sfir91N/nT3aqFiAb0RV7/UDlzZu /Bf4LXshJy/k9ZOt+vUbBqYJ4j7U33NhQuyoyvobCdsepmeF9Jpphetn4QslRpRFCd+Z rWRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=IOBdTu7w; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y21-v6si6834661pll.475.2018.03.03.15.03.27; Sat, 03 Mar 2018 15:03:41 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=IOBdTu7w; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935261AbeCCWkW (ORCPT + 99 others); Sat, 3 Mar 2018 17:40:22 -0500 Received: from mail-bl2nam02on0124.outbound.protection.outlook.com ([104.47.38.124]:62688 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935129AbeCCWkJ (ORCPT ); Sat, 3 Mar 2018 17:40:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=TzAPGmNKMMGBvJ9+kDIZDy6948Pq1oUGymC0IPsj4WI=; b=IOBdTu7wniD6GzSwY3b6p/Z04XTL3NhQ+eeucXShGoEvaFTu5grnOwm/yH8Zv7n3EhWDV4I9ZP/7cyMZgnQ/kmUoj/rIr8igEB0mW4MrCuHBGHMgXMf79mJsPw613AQ4aOFeSMV8jqg2MKFIDndfFsCOXast65x+r3px7nx9DpA= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1033.namprd21.prod.outlook.com (52.132.146.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.3; Sat, 3 Mar 2018 22:39:59 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:39:59 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: John Stultz , Wei Xu , Guodong Xu , Amit Pundir , Rob Herring , John Youn , Douglas Anderson , Chen Yu , Felipe Balbi , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 073/115] usb: dwc2: Make sure we disconnect the gadget state Thread-Topic: [PATCH AUTOSEL for 4.4 073/115] usb: dwc2: Make sure we disconnect the gadget state Thread-Index: AQHTsz9hy/Z6R3PvHkiHHXeka1Ap+Q== Date: Sat, 3 Mar 2018 22:31:32 +0000 Message-ID: <20180303223010.27106-73-alexander.levin@microsoft.com> References: <20180303223010.27106-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223010.27106-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1033;7:73JIeeyrMm+kmpvXy44P4ZCjRBE9MqZ/fWQYAnQQjvoQQh2F093BqPtb45/KxYEgA7tubCDjBppMpqkgjac6+3+uI6xNUmfVKIH7uJPgQcNhE58Chvt9U0eIS4o/bFIUYGy293pfSNlk05Df03sDcIDQ98LHi1HwA8vyuNMxHUrg8AzBbla/Nd4Sif/UHSwrDJtW2g44VarfxByGtDcnLbm7P94jn1IptYQNFJgHa3pt5kbvdbHEm9Qdw+nZWnNv x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3a11f144-12c4-4aeb-79f7-08d58157b213 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB1033; x-ms-traffictypediagnostic: MW2PR2101MB1033: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(9452136761055)(50582790962513)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231220)(944501244)(52105095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB1033;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1033; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(39380400002)(376002)(366004)(346002)(396003)(189003)(199004)(3280700002)(3846002)(316002)(6666003)(99286004)(110136005)(2900100001)(54906003)(2501003)(10090500001)(53936002)(5250100002)(106356001)(76176011)(36756003)(107886003)(2950100002)(6486002)(22452003)(6512007)(6436002)(575784001)(86362001)(6116002)(1076002)(6506007)(2906002)(68736007)(102836004)(4326008)(59450400001)(97736004)(186003)(478600001)(72206003)(26005)(3660700001)(8676002)(25786009)(7416002)(66066001)(14454004)(5660300001)(305945005)(86612001)(81166006)(8936002)(10290500003)(105586002)(7736002)(81156014)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1033;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 7wobwU38L8Gx6jKtAxvoq3ScRLAL9czV981wvhBdk/X4YVF1LQsoSK7nFsiQFXjySqT4hmptkBfJFPeMIIyN/IpKyng+6hq5xgdNYC9Ar+ai8xRTHQLUGZTyUT6X06MQFC3kHGqMZYn1Hi9c6aQvX9oA0MqowfHYl/flhPv7Q4s= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a11f144-12c4-4aeb-79f7-08d58157b213 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:31:32.1353 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1033 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/usb/dwc2/hcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 571c21727ff9..88bd950665fa 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -1385,6 +1385,7 @@ static void dwc2_conn_id_status_change(struct work_st= ruct *work) 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); --=20 2.14.1