From patchwork Thu Mar 8 05:01:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 130941 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp6065610lja; Wed, 7 Mar 2018 21:47:06 -0800 (PST) X-Google-Smtp-Source: AG47ELuzsjOWQwwoa6nX7bAttCfyROvRg8u76g1nRQiXANiVp4ZkCceHxciE5B/yJumNjKmJpBem X-Received: by 10.98.249.10 with SMTP id o10mr25097861pfh.222.1520488026355; Wed, 07 Mar 2018 21:47:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520488026; cv=none; d=google.com; s=arc-20160816; b=dJ6iUA6gWeYDUiKNxAT45UA6gFcgGvrAcYG++NxM4mzbg+1Som5UrSpwVA0w58V1bf yhwYsckTa1UYghyCs3XyRAValjoK3CQmdtXMK1LWs1YQKNIh2uWW7gvaq4hLtiQm0whd XfgDHzcikK4KUPcqTepy6r6P2AzoFrSJp1Vtk4yMJd8QuzUNQ37yZzUjOKDeA0AUfsFM QE6BjwycBdlalXvpmOIXWK912RZP0CQAlq719gJy5j76ul7AUu7FhN2UaIBkHpUt8g4p Z04PZunyzOwhKraPFtRk+0x4DlQBKQeENQd3BWcBmCQdGFQbv+UQjMtuPtzo/D32ixSn Y5xQ== 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:message-id:date:thread-index:thread-topic:subject :cc:to:from:dkim-signature:arc-authentication-results; bh=TzAPGmNKMMGBvJ9+kDIZDy6948Pq1oUGymC0IPsj4WI=; b=ZGV2SZ9dp+0TyNf++wm38L2R5Uhj3Av4cemvbKLTXZeBpm1md2FFtHpWXsQvMTe682 Om99R4Aht+Upj8rrgo1ccelAHwaRP1He/TDl3GvvRLcvoOwnqpVx3GIWFNEQ6EU4rsgb iA1KF0Zi2cz+H5hCn7ooPXzDBYOd/XyLfM3tZ/XLXbSJ1vRAiHBR7T/RLlcaSfQpHgHr HBL0+avjqV+FezFq5bxLe5kHHqBc27KTCAxEeQ2J3NE1Wl0fPT5grXgvy/ZV7XrV5Pom YvcBt5AfPPkNypvBUnQPvfoj2ahWI5PXl9FU3YGvuZLcr2p2VZsy53d6RTcfORUD5Y2C nnBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Cnn4ffEf; 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 p1si12590581pgc.280.2018.03.07.21.47.06; Wed, 07 Mar 2018 21:47:06 -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=Cnn4ffEf; 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 S966424AbeCHFrD (ORCPT + 28 others); Thu, 8 Mar 2018 00:47:03 -0500 Received: from mail-cys01nam02on0130.outbound.protection.outlook.com ([104.47.37.130]:16451 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965957AbeCHFFJ (ORCPT ); Thu, 8 Mar 2018 00:05: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=Cnn4ffEfe1RPKf9gjb1FfIegAjGMoW4hhXD09D3u3kPni7vH0OpU8bK7Mb3mGsorJPTYm3OvtHR2I0Cr/TfqeOwCsAiw5rkj6R/0OBnfSP4A6EFfIdkCN2oDagA4TyAnJqwxkv7z1SLUTQVttHpY/I3+JG3ojyelfaGKSX7bCRg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0981.namprd21.prod.outlook.com (52.132.133.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.1; Thu, 8 Mar 2018 05:05:02 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0588.008; Thu, 8 Mar 2018 05:05:02 +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 001/101] usb: dwc2: Make sure we disconnect the gadget state Thread-Topic: [PATCH AUTOSEL for 4.4 001/101] usb: dwc2: Make sure we disconnect the gadget state Thread-Index: AQHTtpp4PSxFJnxF0UW0CSuxCwf8TA== Date: Thu, 8 Mar 2018 05:01:07 +0000 Message-ID: <20180308050023.8548-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; DM5PR2101MB0981; 7:ub9P3eiK5uXSXgM9DlsnTPVVQ5sjfdT9abj4dY75+ELAMvL8aewIQj5NO9BGfNb1IxHHYPAfxaVVAEMje+gKzytgmpWIw5x/zzEN99dIno3kq1TEbk8X1uC9T7bTkseisnU5v2+cjd0yuaZyxkXVMBIllTH40nkPX06QJwkwbcuaJDcuU/5DHBDcSZkQ9bV6GD18k+z25lQOQNgqnL8fyQz66ja0dmgIUk5lZ2eeYcaShpo4RDvJDgMEfqNF+bcS; 20:4JnEC2v3MTUZoGHloYrRXnFjdlpVdNPm4G7IsDoe8KT1/qKc7NyWMxdCPPyD4qoQ43Q82v3RTFpkp+/QGp3VjLOgSW0fhsP/9jZaWE4H+cKA7tvPYtU3nIlC8EuS19eFeApgpskO6iIV37NtysJglpB2iTqMJUJpBkAWgGSramk= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 85094276-87fc-4d81-f433-08d584b2268e x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0981; x-ms-traffictypediagnostic: DM5PR2101MB0981: 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)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB0981; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0981; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(39380400002)(396003)(366004)(346002)(376002)(199004)(189003)(305945005)(86612001)(7416002)(2906002)(7736002)(6486002)(36756003)(54906003)(110136005)(6436002)(10290500003)(316002)(186003)(22452003)(10090500001)(478600001)(105586002)(6512007)(53936002)(66066001)(68736007)(102836004)(3280700002)(107886003)(25786009)(8936002)(59450400001)(106356001)(6506007)(5660300001)(3846002)(97736004)(14454004)(2501003)(26005)(5250100002)(4326008)(3660700001)(86362001)(575784001)(6116002)(81166006)(99286004)(72206003)(2900100001)(1076002)(8676002)(81156014)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0981; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: OcLlqJ6fLdQbrparQjP7bZMfI3dz2YE8uZvLsQkbRiDaRHkZ6dCZmaMbXFAFWq1sFkJiGwflapAgDfr3AQBKefkX0+316U0Qp85V0H9GjkSNhh0S4bP3a1DPlEY309a74B71u/ExxOJxs5iuZgk/JGR0Kv13WxIilhsmxKMQ0/jkh9p7h4Wme+fckbPcLnA3DUQcMJGvsGxkwSkiL+VgQFMEBOIA4jdqhKcxR0H1KXxo6PM3EZrHLP6UVzAUzCC7Inv+N/qxdaIzIkgt14BjpL0AGY58pRwx3JlKjLOiikUIKHxCLJ8tGWT2jCm8QAq4kuXtBuMb5xvtUTNeoL+B+w== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85094276-87fc-4d81-f433-08d584b2268e X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 05:01:07.9344 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0981 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(+) -- 2.14.1 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_struct *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);