From patchwork Fri Apr 19 11:25:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 10909525 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B816E1515 for ; Fri, 19 Apr 2019 18:53:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACC5328DF3 for ; Fri, 19 Apr 2019 18:53:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0FA628DF5; Fri, 19 Apr 2019 18:53:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37D5228DF9 for ; Fri, 19 Apr 2019 18:53:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728521AbfDSSxO (ORCPT ); Fri, 19 Apr 2019 14:53:14 -0400 Received: from dc2-smtprelay2.synopsys.com ([198.182.61.142]:37872 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728514AbfDSSxN (ORCPT ); Fri, 19 Apr 2019 14:53:13 -0400 Received: from mailhost.synopsys.com (dc2-mailhost2.synopsys.com [10.12.135.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id ED40BC0BC1; Fri, 19 Apr 2019 11:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1555673120; bh=jsYDCFA4tJZEDXmetIx34ZlNaOFVafPpU0gcrsnjOE8=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=Aui7br864aCSOoJEoExvVrYVgRR7iKMiJwKRqAaGOgf4zH7MmtiL8FGOVzZjqZ7PL Ef2PbDfdBlA29gc9/8Xmhzq4dzgc3OHa7ixf8bQ0Uhw34LFQJnUl9/NHBuv4R44p0Y 9uR3cYQ8+Uw4zG9oRiSw1pEE28+pn6ULtAj2JD2TUjHkW0/1EjuAbVFQEu27mFeHWt iS7VeG+ZsoJTrCezD0FnoIRSJlcsPCVMAq19QCn1a3cv6zoAanx/rtPT08wr6awXCS jiDPXB+xTsLD/xxnTaWApTHCxodUXzZ56oZUeOoBj+EcpEKw83UwMB68G19byzhvKI QrQj1lFJkuhUQ== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2.internal.synopsys.com [10.12.239.237]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 04D36A0096; Fri, 19 Apr 2019 11:25:21 +0000 (UTC) Received: from US01HYBRID2.internal.synopsys.com (10.15.246.24) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 19 Apr 2019 04:25:20 -0700 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (10.13.134.195) by mrs.synopsys.com (10.15.246.24) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 19 Apr 2019 04:25:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.onmicrosoft.com; s=selector1-synopsys-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jsYDCFA4tJZEDXmetIx34ZlNaOFVafPpU0gcrsnjOE8=; b=AIpBJyDrNG/cOv99B7/LwqF3heynEiCNaPLEs4kA0uUE88OY6Mp9IcJPhMIouC99f9I4uf8MhR7NKy/XEe9uQbJWVLZQAk+0YgLZ0x4zMKtPTYAI6xQBR+RCbIno9dRZBr8qDT4ntn35gERXt9bIsutXlhoZDzO/2EpCPSH9YZU= Received: from SN1PR12MB2431.namprd12.prod.outlook.com (52.132.195.146) by SN1PR12MB2383.namprd12.prod.outlook.com (52.132.194.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.14; Fri, 19 Apr 2019 11:25:19 +0000 Received: from SN1PR12MB2431.namprd12.prod.outlook.com ([fe80::5ca6:ee5f:1147:df5a]) by SN1PR12MB2431.namprd12.prod.outlook.com ([fe80::5ca6:ee5f:1147:df5a%4]) with mapi id 15.20.1813.013; Fri, 19 Apr 2019 11:25:19 +0000 From: Artur Petrosyan To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , "linux-usb@vger.kernel.org" CC: John Youn , Artur Petrosyan Subject: [PATCH v1 11/14] usb: dwc2: Allow exiting hibernation from gpwrdn rst detect Thread-Topic: [PATCH v1 11/14] usb: dwc2: Allow exiting hibernation from gpwrdn rst detect Thread-Index: AQHU9qKRRISJYwRGsUeDKE1UxaLfJw== Date: Fri, 19 Apr 2019 11:25:19 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0302CA0023.eurprd03.prod.outlook.com (2603:10a6:800:e9::33) To SN1PR12MB2431.namprd12.prod.outlook.com (2603:10b6:802:27::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=arturp@synopsys.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [84.53.141.196] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 474e08ce-309d-4429-0594-08d6c4b9b38c x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600141)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:SN1PR12MB2383; x-ms-traffictypediagnostic: SN1PR12MB2383: x-microsoft-antispam-prvs: x-forefront-prvs: 0012E6D357 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(136003)(39850400004)(396003)(376002)(346002)(189003)(199004)(6436002)(102836004)(486006)(26005)(186003)(386003)(4326008)(305945005)(2906002)(6506007)(446003)(76176011)(7736002)(97736004)(5660300002)(81156014)(66476007)(11346002)(81166006)(66556008)(6486002)(476003)(256004)(14444005)(53936002)(25786009)(107886003)(71190400001)(71200400001)(86362001)(6512007)(99286004)(54906003)(110136005)(316002)(2616005)(68736007)(8676002)(66066001)(6116002)(36756003)(14454004)(478600001)(2501003)(8936002)(118296001)(3846002)(66446008)(52116002)(64756008)(66946007)(73956011)(40753002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR12MB2383;H:SN1PR12MB2431.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: synopsys.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: P97+9HHGIX4C0z4DdhiO+XmvA8PE24QOGTfY9CHi/8CPlFtxAeecMMQlkZtxmlh1N/Pr/Vpy+hrZBbnfKMfxSKjiECraRN4rdgMf9vguSk5cdZXob5gKImUz9rv2KP7CiyNke3s5YnLiTxawgQSNjNFFDfr50xm2WwDNqvDq+APtjvaRH2/1h+bppETnrlnbywAK5XhpJHqf24RNjNYaa9tUXDvXZRLCA1xSNrUXE60gWnLGSKcZq8qrQuHBrTvRBb7W/IQpTyuopfoAz9gSKOEQ52sQhPTiEHjuDpkEqutebfXACaT2++Z3l3PBY0Ta0pM1o+YqwBE+dWFYX9uY+juqIH8O++4CzXzRG1HWHXS3HURcrVT6ICqbctx84iWqmbKpTNt9pyny/9oLp0U713HSeFcLDQnS5AKvFItpuO0= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 474e08ce-309d-4429-0594-08d6c4b9b38c X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2019 11:25:19.1634 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2383 X-OriginatorOrg: synopsys.com Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When device cable is disconnected core receives suspend interrupt and enters hibernation. After entering into hibernation GPWRDN_RST_DET and GPWRDN_STS_CHGINT interrupts are asserted. From cable disconnection we need to exit from hibernation either by GPWRDN_RST_DET or GPWRDN_STS_CHGINT. If we exit from hibernation by GPWRDN_STS_CHGINT, DEVADDR will not be reset. But we need to exit gadget hibernation properly with resetting the DEVADDR as reset accrued. - Allowed exit from gadget hibernation from GPWRDN_RST_DET by checking only linestate. - Setting hsotg->lx_state = DWC2_L0 in dwc2_hsotg_irq GINTSTS_RESETDET flow without checking if lx_state == DWC2_L2 Signed-off-by: Artur Petrosyan --- drivers/usb/dwc2/core_intr.c | 2 +- drivers/usb/dwc2/gadget.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 40d296d9b6fb..cb827a5e1bfb 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -771,7 +771,7 @@ static void dwc2_handle_gpwrdn_intr(struct dwc2_hsotg *hsotg) if ((gpwrdn & GPWRDN_RST_DET) && (gpwrdn & GPWRDN_RST_DET_MSK)) { dev_dbg(hsotg->dev, "%s: GPWRDN_RST_DET\n", __func__); - if (!linestate && (gpwrdn & GPWRDN_BSESSVLD)) + if (!linestate) dwc2_exit_hibernation(hsotg, 0, 1, 0); } diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 8c3e1f1c1b0f..b35c966d4f63 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3637,8 +3637,8 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw) /* This event must be used only if controller is suspended */ if (hsotg->lx_state == DWC2_L2) { dwc2_exit_partial_power_down(hsotg, true); - hsotg->lx_state = DWC2_L0; } + hsotg->lx_state = DWC2_L0; } if (gintsts & (GINTSTS_USBRST | GINTSTS_RESETDET)) {