From patchwork Thu Mar 8 04:58:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 130950 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp6103706lja; Wed, 7 Mar 2018 22:34:33 -0800 (PST) X-Google-Smtp-Source: AG47ELugs0db7TccSX0osX6Ki7LFEz6Ru9GDYgDMSmpeOEavDn6JLVPzZ5WhsCGomx6EXQzetsl/ X-Received: by 2002:a17:902:9a45:: with SMTP id x5-v6mr13240921plv.18.1520490872939; Wed, 07 Mar 2018 22:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520490872; cv=none; d=google.com; s=arc-20160816; b=SJv/K7R4EjKeHwPAkFv2yROaL/01VNJUd62NInvRdaKoOHebM9XNlAiJyJTwCdm+Ar CZ8miZs/gAM9i2AxcYLi4t4aLi/zt2q8vDaQCWbfX6aJUSmItixCMFXTJPVKpRM3mit+ oF5ANhH22QB3oSdzzJTfaP9tcLCrrdJydQLcMZY1QfmohwS3GrMH+xbbihirPMFIsG2U zLv5/YD4+ftJPC8xTja94y5eAGX0HrNjAYGmeAcp1+9HaFwxfMYrS9TYsVNLbNBhm5ZW PCkaatbWIi+Rm7/FQ3ksUDv6hUQBpFoQ8HN151YA81R2q8fG2X4t1js+WwJl8xMjWOf/ 1ptQ== 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=UeNFVzNLnGAZT8iKZ99wlrgkFPz9MTFU/KtoJSv8POs=; b=rVc8rdkdQX79SJIa1Q0MOyNIovj8RxXeHc0/gSbH9AWJy/ma90N6BRVTBH+Uy3lqTr So9Ra026BmIYsFw9OESuVOBXhb4vcwwfAH8l+2gIKhT6jJ8ovVeE3TxZuNFHrvCXGVpY T2mE0tFqq/+1GtG+NC2x1uSxLqowoGpqdXOMXl06LRmmOZiFhrh3puqfKBN+erYPksbx lLPH7Pw3GchleavqM3PomLt6HyrMlybrrbxH9dfxDcn5O3sjIfZ5N1aSQkxFV6X9Sxn8 FishC9lEgYYjXbpo6dv1vjUH+mib7H9azsDJjT4If9vmKEyQx/GSrvFBnymzFy9X5FKD 7hdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=k/4akz5h; 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 b13si15032370pfi.53.2018.03.07.22.34.32; Wed, 07 Mar 2018 22:34:32 -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=k/4akz5h; 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 S1755512AbeCHGe3 (ORCPT + 28 others); Thu, 8 Mar 2018 01:34:29 -0500 Received: from mail-co1nam03on0137.outbound.protection.outlook.com ([104.47.40.137]:7440 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965513AbeCHE75 (ORCPT ); Wed, 7 Mar 2018 23:59:57 -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=UeNFVzNLnGAZT8iKZ99wlrgkFPz9MTFU/KtoJSv8POs=; b=k/4akz5hNrVc+UmJ5WPKLQ7mT9KoQvdoYJaTqCtDiLTpa7O9d6xijqnPPBoqY+yZTdwJIQ3EzxOYOZWwFDbiC1j7BjWBRtoGyFjCi6C2nQm5DJFk0HdS9Hzuzr3ykqMVA1RARwPoDVDX8NdWUH7RxrP6CoaKidKvi7poNf2ufng= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0920.namprd21.prod.outlook.com (52.132.132.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.3; Thu, 8 Mar 2018 04:59:51 +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 04:59:51 +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.9 002/190] usb: dwc2: Make sure we disconnect the gadget state Thread-Topic: [PATCH AUTOSEL for 4.9 002/190] usb: dwc2: Make sure we disconnect the gadget state Thread-Index: AQHTtpokoLy+kagVSka7vFFKiMmORg== Date: Thu, 8 Mar 2018 04:58:47 +0000 Message-ID: <20180308045810.8041-2-alexander.levin@microsoft.com> References: <20180308045810.8041-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045810.8041-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; DM5PR2101MB0920; 7:J1O5R6pBAUR2LwBXsqlDUUoFByWY/fzkPHzAZ7Lgdg09k3UyH+2Nc4DYKjp28C88ZK4EKNFOODKVqC3PUv39snvQjCa+GZUY4UNjP7ZNcd+zs0+uHxvk59HGNGKOMLRl38b799Q5y17tH6umJoFFJMuiLRv2aYFbO1LPRYuek/jh2JQx75wsSP1f7Q4eqCEwTXQH+Pv59+GtIMy28eldXYEMjugWATE8WbxLPakDatuqjFA7LPzp4/KxFlb0TAuW; 20:TfsfLdx9vxIqgLIyd1KpNFhojnKN9inP2yRi9VsHTGNs/PH8JKQ8+Z9Cpu43xno9dS/jUTSZuJwA8wAm+ff60KkzGbZbYWSqyYDyxUAS0bZKAbPcYD3/cOkUubTJXnRSUx3s4uKKuJmvJXPscfyFTeo4+7zfnSJy6UAKggIx+qo= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: bb0b05f5-0e91-4718-4b69-08d584b16d05 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0920; x-ms-traffictypediagnostic: DM5PR2101MB0920: 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)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0920; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0920; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(39380400002)(346002)(366004)(376002)(189003)(199004)(81156014)(81166006)(5250100002)(8936002)(54906003)(2501003)(305945005)(8676002)(107886003)(110136005)(97736004)(99286004)(6436002)(36756003)(316002)(72206003)(76176011)(14454004)(6486002)(7736002)(478600001)(10290500003)(186003)(22452003)(59450400001)(68736007)(105586002)(2950100002)(106356001)(7416002)(102836004)(575784001)(26005)(6506007)(86362001)(3660700001)(5660300001)(2906002)(10090500001)(1076002)(25786009)(2900100001)(53936002)(4326008)(66066001)(6512007)(6666003)(6116002)(3280700002)(3846002)(86612001)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0920; H:DM5PR2101MB1032.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: vRcjc97Sv/1Js7Qz5CG3OF+0V6tLrwz8XPy3N8f0b2SYOI+dIJTu1Q+Xekim8WkWrqF/ottDxsJpEjRnK69InXQijYD3JeFMNOojvp1jYAUPLJpUwPrHJXWQQspAATRl6XFXwg++S6ruLdffUN/EXn7DUtO1rPsHJzxKlgiN+O4TLYve/ojE5W0V7GdSjXZvjW2XVvKu8Vw8n5JTEYDoECXruLrnfA8aXxo4u6jirH80CpaRVWS6mAVcHHAn215FSAuY0omvU0zuTndVJ/gfQHIarkjtuySzRCoBEjFHwKAdEDRzZVIGpMORraCqbxDJ/61V7O5JveExf3VVAYFEbw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb0b05f5-0e91-4718-4b69-08d584b16d05 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 04:58:47.2038 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0920 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 df5a06578005..dfc0566bb155 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3220,6 +3220,7 @@ static void dwc2_conn_id_status_change(struct work_struct *work) 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);