From patchwork Fri Apr 12 13:38:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 10898361 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 CA04C14DB for ; Fri, 12 Apr 2019 13:38:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A45E728B74 for ; Fri, 12 Apr 2019 13:38:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A245C28F03; Fri, 12 Apr 2019 13:38:36 +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 2428828B74 for ; Fri, 12 Apr 2019 13:38:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727025AbfDLNif (ORCPT ); Fri, 12 Apr 2019 09:38:35 -0400 Received: from smtprelay4.synopsys.com ([198.182.47.9]:58268 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727021AbfDLNif (ORCPT ); Fri, 12 Apr 2019 09:38:35 -0400 Received: from mailhost.synopsys.com (dc2-mailhost2.synopsys.com [10.12.135.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 2E73B24E3AB2; Fri, 12 Apr 2019 06:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1555076315; bh=4otSVf7CNR/jSoJVB64NRcDq78RaNS4vLvZcpT5/eLY=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=NchDjrO4GpaHDcwTy3EIr4Tqd5ztTh6BAYOVnSI3Co9uszInWlCf5LxL9dPIRNXkt DM8vEhzyxsuAeC7a0n9ZKme+ZJBvrod++CoFWUdUK9PvJCBS4KOc4WY6Hw9c6wtYI3 ZE9Cav7EA1Z4MWwO9Z+asmtn8n58+ka1Xn089ijtqw4ErjNx0wZNu/GGQbNW2xkQZu Vj82oD7FmdjrpcA+87YuFjKGnXscH6cV2IXORIVUlr1nUFQxnzGsctKOSQUr6IAAMo q2rjITvyzrijGwNLLgi4THSd32RF1z37Gzofo2O9JjzzPAGHrFaY1nlNRgA6Ufk2sd 6hl9kkLQQYRRg== 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 F0223A009D; Fri, 12 Apr 2019 13:38:34 +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, 12 Apr 2019 06:38:34 -0700 Received: from NAM03-BY2-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, 12 Apr 2019 06:38:34 -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=4otSVf7CNR/jSoJVB64NRcDq78RaNS4vLvZcpT5/eLY=; b=aqfSxdgF9lsFvydxYCI5j+zYcvdbbqE9bzcaKLzJhIdyVGBlbrDIRQmb61rt6MTd4GEbetexEe43l2yRPVEdlWNARjjcQZSqSBynp1zVLo4zqdRXWLL5oBslz4rWSiTr9za7ovI0AsFHPSNB1gW2xDvXMzXITqc2BRq91ctYe0g= Received: from SN1PR12MB2431.namprd12.prod.outlook.com (52.132.195.146) by SN1PR12MB2445.namprd12.prod.outlook.com (52.132.195.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.15; Fri, 12 Apr 2019 13:38:30 +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.1771.021; Fri, 12 Apr 2019 13:38:30 +0000 From: Artur Petrosyan To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , "linux-usb@vger.kernel.org" CC: John Youn , Artur Petrosyan Subject: [PATCH 01/14] usb: dwc2: Fix dwc2_restore_device_registers() function. Thread-Topic: [PATCH 01/14] usb: dwc2: Fix dwc2_restore_device_registers() function. Thread-Index: AQHU8TUDZJfFc7UTyEqnLp2GuI6d2w== Date: Fri, 12 Apr 2019 13:38:30 +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: VI1PR0302CA0006.eurprd03.prod.outlook.com (2603:10a6:800:e9::16) 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.190] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 32de0ec2-c7a2-414c-1f60-08d6bf4c2582 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328)(7193020);SRVR:SN1PR12MB2445; x-ms-traffictypediagnostic: SN1PR12MB2445: x-microsoft-antispam-prvs: x-forefront-prvs: 0005B05917 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(366004)(39850400004)(136003)(376002)(346002)(199004)(189003)(118296001)(256004)(5660300002)(14444005)(53936002)(86362001)(66066001)(6512007)(2906002)(7736002)(305945005)(4326008)(478600001)(6436002)(68736007)(6486002)(105586002)(316002)(186003)(386003)(6506007)(81166006)(81156014)(3846002)(36756003)(14454004)(107886003)(25786009)(6116002)(106356001)(71200400001)(71190400001)(2501003)(446003)(8936002)(486006)(52116002)(102836004)(476003)(26005)(99286004)(11346002)(110136005)(8676002)(2616005)(54906003)(76176011)(97736004);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR12MB2445;H:SN1PR12MB2431.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: jOOMHKPFYw/M1tJCG9hG2NGAeuSaAB1APpD29wbmVGa42hCD/KHA6LrOrVXfpaWzZ2jVoaJbiHou+bIRnbURK6udl0S8s5oMLFkQP6TVatlBHSi1hi8O0dRg3FGTKI8NwtbwudQ7qeoEkd3IX+qymXUJyDthYIKFzh+5Uj6ucaBmgXCSErKN453sBX1WJ18XQekgtKxi+aVA2bvtNGwmRv0VM/8s8WGijPhmCn1DCouo3mWHz6wgiGk9F208IYIEw8+KLG2x65qOY4omHZap3FzZUCRogNYkmCQTyZHf/yTJbFwXFpZwx9vTksQsR5EZf8ItOYbWyKGb93KI+n/JespeZMbHbu1L17vCjaCIjBSvyvEmdDfHSzkFPukJ+XUV8XT3PyF5JJu02Mf98iowHNvJCTOhz9Qwat3PsQ8vK40= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 32de0ec2-c7a2-414c-1f60-08d6bf4c2582 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2019 13:38:30.0637 (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: SN1PR12MB2445 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 - Added backup of DCFG register. - Added Set the Power-On Programming done bit. Signed-off-by: Artur Petrosyan --- drivers/usb/dwc2/gadget.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 6812a8a3a98b..dcb0fbb8bc42 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -5004,6 +5004,7 @@ int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, int remote_wakeup) { struct dwc2_dregs_backup *dr; int i; + u32 dctl; dev_dbg(hsotg->dev, "%s\n", __func__); @@ -5019,6 +5020,15 @@ int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, int remote_wakeup) if (!remote_wakeup) dwc2_writel(hsotg, dr->dctl, DCTL); + if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_PARTIAL) { + dwc2_writel(hsotg, dr->dcfg, DCFG); + + /* Set the Power-On Programming done bit */ + dctl = dwc2_readl(hsotg, DCTL); + dctl |= DCTL_PWRONPRGDONE; + dwc2_writel(hsotg, dctl, DCTL); + } + dwc2_writel(hsotg, dr->daintmsk, DAINTMSK); dwc2_writel(hsotg, dr->diepmsk, DIEPMSK); dwc2_writel(hsotg, dr->doepmsk, DOEPMSK); From patchwork Fri Apr 12 13:38:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 10898379 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 B529914DB for ; Fri, 12 Apr 2019 13:38:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9203628B74 for ; Fri, 12 Apr 2019 13:38:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FF4028DFB; Fri, 12 Apr 2019 13:38:50 +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 2541628C9C for ; Fri, 12 Apr 2019 13:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726973AbfDLNit (ORCPT ); Fri, 12 Apr 2019 09:38:49 -0400 Received: from smtprelay.synopsys.com ([198.182.60.111]:41162 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbfDLNit (ORCPT ); Fri, 12 Apr 2019 09:38:49 -0400 Received: from mailhost.synopsys.com (dc2-mailhost1.synopsys.com [10.12.135.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 1143310C29D9; Fri, 12 Apr 2019 06:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1555076329; bh=LU2gAx+I/X/6jnrfYmmbpVF2WfkmeV+jJefdKmYPfRY=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=K5APkZfCvFerglCPohK4fagOhk9wu5v9cUGPqafTWWgXrFPeQJfeDQFbJ6gxZpnfL cJr69vScc7LAvIeX5vYveXdEAZSLrWWic9t4zgd4uaHcrShlFgO7p4UWOH4LYoYNcC XQnd/4kXIGhLbmbRyb5S4lG3qUzurWt5FfRVxUAchqylvbC6g+/c65Q1QB4edP9mmU zwlZsgst5CbN+W9qxvYp+q/ZI9Lk/h3Da5SQKMJ92xwifAzZEfugwcuj9mejYqNXmt gdf3ZHhpQtcPXjVLAa8O+gRn4c0NKEfycADc7H06SYuwgcmQMDnrRE/C//CfkJSMt8 /LXGsm3iS3LQw== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id D709AA0070; Fri, 12 Apr 2019 13:38:48 +0000 (UTC) Received: from US01HYBRID2.internal.synopsys.com (10.15.246.24) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 12 Apr 2019 06:38:48 -0700 Received: from NAM05-BY2-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, 12 Apr 2019 06:38:48 -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=LU2gAx+I/X/6jnrfYmmbpVF2WfkmeV+jJefdKmYPfRY=; b=gKB6eYcgFlmbb0HEajlm4DlXnfQy/cw+9c5DEJzOiQcOAs7K5O5qKbF5apCvtFTHGwbPdUYUUbENYW8nl53PZnDtoEg99D3hY73c282LrfEOwUvuDH9clX+qXgPPQBmfFpeHgxl1m2VHMPRoyW8YnenBtGdls6P866VjipvdjPs= Received: from SN1PR12MB2431.namprd12.prod.outlook.com (52.132.195.146) by SN1PR12MB0589.namprd12.prod.outlook.com (10.163.208.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.19; Fri, 12 Apr 2019 13:38:46 +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.1771.021; Fri, 12 Apr 2019 13:38:46 +0000 From: Artur Petrosyan To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , "linux-usb@vger.kernel.org" CC: John Youn , Artur Petrosyan Subject: [PATCH 02/14] usb: dwc2: Add descriptive debug messages for Partial Power Down mode. Thread-Topic: [PATCH 02/14] usb: dwc2: Add descriptive debug messages for Partial Power Down mode. Thread-Index: AQHU8TUNz/+9g0+U80Cc3M0UfRZsTQ== Date: Fri, 12 Apr 2019 13:38:46 +0000 Message-ID: <819a32be398efe3d3682d880a392a1fa54cde9df.1555075928.git.arturp@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR08CA0109.eurprd08.prod.outlook.com (2603:10a6:800:d4::11) 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.184] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e37b52ef-4333-44de-21e4-08d6bf4c2f35 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328)(7193020);SRVR:SN1PR12MB0589; x-ms-traffictypediagnostic: SN1PR12MB0589: x-microsoft-antispam-prvs: x-forefront-prvs: 0005B05917 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(346002)(396003)(376002)(39840400004)(136003)(189003)(199004)(52116002)(256004)(76176011)(110136005)(81156014)(68736007)(2906002)(316002)(8936002)(99286004)(54906003)(81166006)(25786009)(86362001)(7736002)(106356001)(305945005)(97736004)(8676002)(71200400001)(478600001)(71190400001)(4326008)(107886003)(118296001)(14454004)(186003)(2501003)(105586002)(476003)(446003)(26005)(66066001)(486006)(15650500001)(386003)(5660300002)(3846002)(6506007)(6512007)(2616005)(6486002)(11346002)(36756003)(6436002)(53936002)(14444005)(6116002)(102836004);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR12MB0589;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: BPBePV28AqE+9EUW3VE9RNiak8DaluBiL2Dsluvx69G+TXq2NjUZKI9iKtkeCgxKYSChAI9VQ8Ov9dZ2L6uzly8czw2R2NXDcRiY/mvG5fEk+9bpgdfBBjnwQ/geYDBWayQjXx+T+yKSCJQQalYebPXq/sHil1QVzRzzwowSX9J0waznB5PK9s/yKEmz6UZH95oYlrfqnj1c59oyQ4AZVFDqq4JwanMB0YwRGu8IhsyuYONzQcmfIAY+InGX328fwjd6o3WMCXwYV/7PSKtIAStDDW6RS7QGWRodEo8vYQ4jqwTeJIxwEyKA+jriUFt9Yrz0HDJL9Cy6iL8SA7YZtchKfgPMRsRu/4t9hlCTmie8Gw/nXghDoUc2UF8bOJznMsGxS7L5A+984hi+Ywc9v9H44/NSWkSPs3KIlvJoAXk= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e37b52ef-4333-44de-21e4-08d6bf4c2f35 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2019 13:38:46.2533 (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: SN1PR12MB0589 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 Added dev_dbg() messages when entering and exiting from partial power down. It is now more visible when core enters partial power down and when exits form it. Debug messages are added in the following functions. - dwc2_exit_partial_power_down() - dwc2_enter_partial_power_down() Signed-off-by: Artur Petrosyan --- drivers/usb/dwc2/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 55d5ae2a7ec7..fb471d18a3de 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -141,6 +141,8 @@ int dwc2_exit_partial_power_down(struct dwc2_hsotg *hsotg, bool restore) if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL) return -ENOTSUPP; + dev_dbg(hsotg->dev, "Exiting of Partial Power Down started.\n"); + pcgcctl = dwc2_readl(hsotg, PCGCTL); pcgcctl &= ~PCGCTL_STOPPCLK; dwc2_writel(hsotg, pcgcctl, PCGCTL); @@ -178,6 +180,8 @@ int dwc2_exit_partial_power_down(struct dwc2_hsotg *hsotg, bool restore) } } + dev_dbg(hsotg->dev, "Exit Partial Power Down completes here.\n"); + return ret; } @@ -194,6 +198,8 @@ int dwc2_enter_partial_power_down(struct dwc2_hsotg *hsotg) if (!hsotg->params.power_down) return -ENOTSUPP; + dev_dbg(hsotg->dev, "Start of Partial Power Down completed\n"); + /* Backup all registers */ ret = dwc2_backup_global_registers(hsotg); if (ret) { @@ -238,6 +244,8 @@ int dwc2_enter_partial_power_down(struct dwc2_hsotg *hsotg) pcgcctl |= PCGCTL_STOPPCLK; dwc2_writel(hsotg, pcgcctl, PCGCTL); + dev_dbg(hsotg->dev, "Partial Power Down completed\n"); + return ret; } From patchwork Fri Apr 12 13:38:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 10898381 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 EDCE714DB for ; Fri, 12 Apr 2019 13:38:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC92D28A62 for ; Fri, 12 Apr 2019 13:38:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAD6028ED2; Fri, 12 Apr 2019 13:38:59 +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 57F4728A62 for ; Fri, 12 Apr 2019 13:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726825AbfDLNi6 (ORCPT ); Fri, 12 Apr 2019 09:38:58 -0400 Received: from smtprelay.synopsys.com ([198.182.60.111]:41170 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726624AbfDLNi6 (ORCPT ); Fri, 12 Apr 2019 09:38:58 -0400 Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 6D48A10C21A8; Fri, 12 Apr 2019 06:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1555076338; bh=oPx08AyJTpoqv0scWKB2fCluOZU2FZxMwAD3CD8Py7c=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=LkWHbS8hCb8EfjZWKHxcV5zzmHmupPZCha5kEZJu8k2sqy7rDdSEKaWZjssrekXZB yycDZD0HmiofPU8/pP1RUViD49hJrji3PTHzVc7TjOfS7QLIY2HYu4uv8ZMUAvTyzB 4M/+OGz1Gy7zgwBZ8F4y7HZvHhfzZJqkvKr2SGWyXebA88NEDqzH3XWmURRRn+18i3 0oyebxc+fa4A/axHVzUZSx3q9MAO9wnIgQQBMtQOUzKKoJXTfgF2R+4Azw89gSSGZP jwNxIj8514tcbnwvRzOWhmxzpaN1e+YDbNkQxLVp3U0U+RdA9NfqU5W6bbXg2E7uAC NiwZBFn/IHNuA== 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 5F093A006A; Fri, 12 Apr 2019 13:38:58 +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, 12 Apr 2019 06:38:58 -0700 Received: from NAM05-BY2-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, 12 Apr 2019 06:38:58 -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=oPx08AyJTpoqv0scWKB2fCluOZU2FZxMwAD3CD8Py7c=; b=p29d3aP2pNjFwNK1r/3GD1+acsgB3rjY8mcL1zK9azgKqyIv4ohs/xsfbZrue6vufDLksyAgb0CWTXq1JSikeIeF+m086C7ePhMChS7IeEwjAEtHE7szbL+h3f5TvVClCa/fNZbQHx5WqRHE/NxJ9UDRoaFju5lPOMOHrVnGgIk= Received: from SN1PR12MB2431.namprd12.prod.outlook.com (52.132.195.146) by SN1PR12MB0589.namprd12.prod.outlook.com (10.163.208.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.19; Fri, 12 Apr 2019 13:38:56 +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.1771.021; Fri, 12 Apr 2019 13:38:56 +0000 From: Artur Petrosyan To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , "linux-usb@vger.kernel.org" CC: John Youn , Artur Petrosyan Subject: [PATCH 03/14] usb: dwc2: Fix wakeup detected and session request interrupt handlers. Thread-Topic: [PATCH 03/14] usb: dwc2: Fix wakeup detected and session request interrupt handlers. Thread-Index: AQHU8TUTrNB2kRZJNkiYNB9jBPLdtw== Date: Fri, 12 Apr 2019 13:38:56 +0000 Message-ID: <8f99e3ceb45ede4526363bd9b44d417a6b6ff5cd.1555075928.git.arturp@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0302CA0020.eurprd03.prod.outlook.com (2603:10a6:800:e9::30) 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.194] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 43e3975b-1997-430b-422b-08d6bf4c355f x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328)(7193020);SRVR:SN1PR12MB0589; x-ms-traffictypediagnostic: SN1PR12MB0589: x-microsoft-antispam-prvs: x-forefront-prvs: 0005B05917 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(346002)(396003)(376002)(39840400004)(136003)(189003)(199004)(52116002)(256004)(76176011)(110136005)(81156014)(68736007)(2906002)(316002)(8936002)(99286004)(54906003)(81166006)(25786009)(86362001)(7736002)(106356001)(305945005)(97736004)(8676002)(71200400001)(478600001)(71190400001)(4326008)(107886003)(118296001)(14454004)(186003)(2501003)(105586002)(476003)(446003)(26005)(66066001)(486006)(386003)(5660300002)(3846002)(6506007)(6512007)(2616005)(6486002)(11346002)(36756003)(6436002)(53936002)(14444005)(6116002)(102836004);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR12MB0589;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: +9TeNfa596dU/oQ2LvU0FVgGmfa75IzBKzAhm9VAkiHvxWn0pT5Ol7dM7+0A9FIjnMegLxtKULOvIX0qPuEsLjYEsYIBhgmZi4O6fRteud1H0iH96IkPPVvPyN8gRjVf3oLIaNr8fvsFlMfz9VMCyl5ODv4MuK/BzeEehzOmzf0kh8Qv+V0PtaHsqspFzTBfudDMg2nG8kTusMnuWMWn5LqCLiAqjenjFc5CAQXgBsN1xhd6l29tmX7V3djJF1YjqNlfVuz7z1wPI3EeZ7/9RlEC1ZaDwjqvaO0zMF/Nib8wlhE3ycaeyAB92XnCLC5HB03lilnhB8ZP2yUXiGOKGKn2hXpL3Jy67SppEN4RIQi0RHTEW+uUKwBaHjKWNcDjrBsW2CyhLX0pwtcBPyTRbwKxLD1TNDDxS7Z1KVAd3M8= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 43e3975b-1997-430b-422b-08d6bf4c355f X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2019 13:38:56.6158 (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: SN1PR12MB0589 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 In host mode port power must be turned on when wakeup detected or session request interrupt is detected. Because, otherwise core wouldn't exit form partial power down. - Turned on the port power by setting HPRT0_PWR bit. - Called dwc2_hcd_connect() function after enabling the power of the port. Signed-off-by: Artur Petrosyan --- drivers/usb/dwc2/core_intr.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 19ae2595f1c3..ce523fd2b1b4 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -312,6 +312,7 @@ static void dwc2_handle_conn_id_status_change_intr(struct dwc2_hsotg *hsotg) static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) { int ret; + u32 hprt0; /* Clear interrupt */ dwc2_writel(hsotg, GINTSTS_SESSREQINT, GINTSTS); @@ -320,7 +321,8 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) hsotg->lx_state); if (dwc2_is_device_mode(hsotg)) { - if (hsotg->lx_state == DWC2_L2) { + if (hsotg->lx_state == DWC2_L2 && + hsotg->params.power_down == 1) { ret = dwc2_exit_partial_power_down(hsotg, true); if (ret && (ret != -ENOTSUPP)) dev_err(hsotg->dev, @@ -332,6 +334,14 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) * established */ dwc2_hsotg_disconnect(hsotg); + } else { + /* Turn on the port power bit. */ + hprt0 = dwc2_read_hprt0(hsotg); + hprt0 |= HPRT0_PWR; + dwc2_writel(hsotg, hprt0, HPRT0); + + /* Connect hcd after port power is set. */ + dwc2_hcd_connect(hsotg); } } @@ -396,6 +406,7 @@ static void dwc2_wakeup_from_lpm_l1(struct dwc2_hsotg *hsotg) static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) { int ret; + u32 hprt0; /* Clear interrupt */ dwc2_writel(hsotg, GINTSTS_WKUPINT, GINTSTS); @@ -426,8 +437,6 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) /* Change to L0 state */ hsotg->lx_state = DWC2_L0; } else { - if (hsotg->params.power_down) - return; if (hsotg->lx_state != DWC2_L1) { u32 pcgcctl = dwc2_readl(hsotg, PCGCTL); @@ -435,6 +444,15 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) /* Restart the Phy Clock */ pcgcctl &= ~PCGCTL_STOPPCLK; dwc2_writel(hsotg, pcgcctl, PCGCTL); + + /* Turn on the port power bit. */ + hprt0 = dwc2_read_hprt0(hsotg); + hprt0 |= HPRT0_PWR; + dwc2_writel(hsotg, hprt0, HPRT0); + + /* Connect hcd. */ + dwc2_hcd_connect(hsotg); + mod_timer(&hsotg->wkp_timer, jiffies + msecs_to_jiffies(71)); } else { From patchwork Fri Apr 12 13:39:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 10898383 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 EE18D1515 for ; Fri, 12 Apr 2019 13:39:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C911628ED7 for ; Fri, 12 Apr 2019 13:39:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD25E28DAA; Fri, 12 Apr 2019 13:39:10 +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 34F2428ED7 for ; Fri, 12 Apr 2019 13:39:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726826AbfDLNjJ (ORCPT ); Fri, 12 Apr 2019 09:39:09 -0400 Received: from smtprelay.synopsys.com ([198.182.60.111]:41180 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726624AbfDLNjJ (ORCPT ); Fri, 12 Apr 2019 09:39:09 -0400 Received: from mailhost.synopsys.com (dc8-mailhost2.synopsys.com [10.13.135.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 4633010C27BD; Fri, 12 Apr 2019 06:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1555076349; bh=mDfjAdqkxm57zYxGNUScbQgq9XZasF4HeMVlaQdfjyE=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=QtOLECY4tYsLehowTjYWDkS6Aa8ior3B2SPxgDS+Vm+v0v4ahuiV0/O01qszbEyXd Oep1xKO87fpQHGWP47LXouJyzHUbRL2OEjPB58iI4aLRKZYEcExh7OnW9lXp410+Em mNd1OfVfJK/GN4D4ddQZYqUrW3YmOhTmImX8dIloQ4n9NfqrDUUqPtz9vJ65aCNRde WTmKNG/XU1CJP2rZOATyIDX2+s7nlxxjfTL104nsC+NTqVjZ5zSDxE3aNxryT9n4jH eCPop4ozYQtmpYvX76aLaAGMS3P2KOdkDyH6MPgxa/IiA1A8iJMGWUrkTSydPOh1LI GkiK/kXmq8WiA== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 1A4CFA006D; Fri, 12 Apr 2019 13:39:08 +0000 (UTC) Received: from US01HYBRID2.internal.synopsys.com (10.15.246.24) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 12 Apr 2019 06:39:08 -0700 Received: from NAM05-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, 12 Apr 2019 06:39:08 -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=mDfjAdqkxm57zYxGNUScbQgq9XZasF4HeMVlaQdfjyE=; b=NU7/IieP1G8AoTtpUA3BrAXz8EDqIOFdQaKyrBsVzC2XX3nzaYrTOuerHegrMRx1PZRJ3RJs7KZSJu3z/ONQ08nzia02Xr1KIptvxgcErWp0wCW4LbeQv8eA+1aDB3BPdPxrVFpdLmHRplr7hnacIVGNT7kh0CCtuMizZdoc1+k= Received: from SN1PR12MB2431.namprd12.prod.outlook.com (52.132.195.146) by SN1PR12MB0589.namprd12.prod.outlook.com (10.163.208.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.19; Fri, 12 Apr 2019 13:39:06 +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.1771.021; Fri, 12 Apr 2019 13:39:06 +0000 From: Artur Petrosyan To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , "linux-usb@vger.kernel.org" CC: John Youn , Artur Petrosyan Subject: [PATCH 04/14] usb: dwc2: Fix suspend state in host mode for partial power down. Thread-Topic: [PATCH 04/14] usb: dwc2: Fix suspend state in host mode for partial power down. Thread-Index: AQHU8TUZtGehzOo8WEyS5m7LdiRsOg== Date: Fri, 12 Apr 2019 13:39:06 +0000 Message-ID: <88aedc90b7b786cbfbfb80a84abbf707b5777c12.1555075928.git.arturp@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0901CA0092.eurprd09.prod.outlook.com (2603:10a6:800:7e::18) 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.190] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e9292e4a-d505-4d92-6c32-08d6bf4c3b5b x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328)(7193020);SRVR:SN1PR12MB0589; x-ms-traffictypediagnostic: SN1PR12MB0589: x-microsoft-antispam-prvs: x-forefront-prvs: 0005B05917 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(346002)(396003)(376002)(39840400004)(136003)(189003)(199004)(52116002)(256004)(76176011)(110136005)(81156014)(68736007)(2906002)(316002)(8936002)(99286004)(54906003)(81166006)(25786009)(86362001)(7736002)(106356001)(305945005)(97736004)(8676002)(71200400001)(478600001)(71190400001)(4326008)(107886003)(118296001)(14454004)(186003)(2501003)(105586002)(476003)(446003)(26005)(66066001)(486006)(15650500001)(386003)(5660300002)(3846002)(6506007)(6512007)(2616005)(6486002)(11346002)(36756003)(6436002)(53936002)(14444005)(6116002)(102836004);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR12MB0589;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: pjqlSV3+T/C0fJ0ou0zkoTlWGGXFsZ1TLGUGagtCPfvNahTiSkEg+DBPuFbX3fZbEyTrW9qILIS+VTy/zljEFbLcq3zkTS45y/bmFe0HcrBBk6NSuFxXJAuSTmtJrvELr5/RB3/++G1F195iYQmHTiUarNURKvWP8oE61R8yKyrv7W4ZlQTdmN5+69UMCDU6urqvFWaOZLk6MUlEVo5gLndZ8CislwlkLmeXlJb7s+uVgVTReNsE0mMmCfgvOqH6gQ45UK582t/9tnOYtL7y6C5YB46UaFgxUG6ACwcVWOsAUJnT2XUV6mM3OTbpjpcRuYbFE0CDRgUTZzYmsop4obdU8XQGLn7moLXS2/6o2fJtgJKWgEePAIvd9YTIS0GylCK2GmA/dgUi0L79YozhktKCmn0ERv8NO2cLffI6j2s= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e9292e4a-d505-4d92-6c32-08d6bf4c3b5b X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2019 13:39:06.6670 (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: SN1PR12MB0589 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 - In dwc2_port_suspend() function added waiting for the HPRT0.PrtSusp register field to be set. - In _dwc2_hcd_suspend() function added checking of "hsotg->flags.b.port_connect_status" port connection status if port connection status is 0 then skipping power saving (entering partial power down mode). Because if there is no device connected there would be no need to enter partial power down mode. - Added "hsotg->bus_suspended = true" beceuse after entering partial power down in host mode the bus_suspended flag must be set. Signed-off-by: Artur Petrosyan --- drivers/usb/dwc2/hcd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index dd82fa516f3f..1d18258b5ff8 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3479,6 +3479,10 @@ static void dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex) hprt0 |= HPRT0_SUSP; dwc2_writel(hsotg, hprt0, HPRT0); + /* Wait for the HPRT0.PrtSusp register field to be set */ + if (dwc2_hsotg_wait_bit_set(hsotg, HPRT0, HPRT0_SUSP, 3000)) + dev_warn(hsotg->dev, "Suspend wasn't generated\n"); + hsotg->bus_suspended = true; /* @@ -4488,7 +4492,8 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd) if (hsotg->op_state == OTG_STATE_B_PERIPHERAL) goto unlock; - if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL) + if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL || + hsotg->flags.b.port_connect_status == 0) goto skip_power_saving; /* @@ -4514,6 +4519,8 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd) goto skip_power_saving; } + hsotg->bus_suspended = true; + /* Ask phy to be suspended */ if (!IS_ERR_OR_NULL(hsotg->uphy)) { spin_unlock_irqrestore(&hsotg->lock, flags); From patchwork Fri Apr 12 13:39:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 10898385 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 88AEF1515 for ; Fri, 12 Apr 2019 13:39:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6962028EF3 for ; Fri, 12 Apr 2019 13:39:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67E6928ED5; Fri, 12 Apr 2019 13:39:19 +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 0B12028F1C for ; Fri, 12 Apr 2019 13:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726829AbfDLNjS (ORCPT ); Fri, 12 Apr 2019 09:39:18 -0400 Received: from smtprelay.synopsys.com ([198.182.47.9]:58298 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726624AbfDLNjS (ORCPT ); Fri, 12 Apr 2019 09:39:18 -0400 Received: from mailhost.synopsys.com (dc2-mailhost2.synopsys.com [10.12.135.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 1DCC724E3ABC; Fri, 12 Apr 2019 06:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1555076358; bh=2lhgBLvaIPkRZOt9UI2QbxNBZj29AWGnNMoRlexj8dQ=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=dNq0lv3PDL0b6Z3oOnCcAYNuQeN3ycJq14eV4VfHf/9GTFCZTtC/2yTtTbRuHaEWy OJaDzGDqX4Qg2QGu0BFo3bpndgO+51vVYFb4BH6Va90C8H6x13E5F9JQg6gN6zJ92a x8VrJTWiowC8enqWCS5Yvgp3LLI75rjOBfOLef/zKuL+dJd3GfLC5BL9AtVr5RVxTd mw5xcRTsJTj40LDc5tLROgqREv8Mq6MbcZluGdMlbYX5smBJUWHtnocq370u67+IwP a7oEoErUabmpcXWiBu3oyD009zVQMzTwu2LeKnNR9WNw5wZreP/OYdSdF7Kbb1ENfb af8fZtvquPoNA== 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 10730A009F; Fri, 12 Apr 2019 13:39:18 +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, 12 Apr 2019 06:39:17 -0700 Received: from NAM05-BY2-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, 12 Apr 2019 06:39:17 -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=2lhgBLvaIPkRZOt9UI2QbxNBZj29AWGnNMoRlexj8dQ=; b=cMVwxXg2TzHwcGjTNyc1CzaLEy0qI3hS4FfAa2WX/oBKVt07+os8fXtYYJmsW0ehvRHVpongMBIdfYuQEWPpUtA8jA7VFEguep1sIEpT26Y80cl0/zYtjqIlLOCSy5yDyYTCKX6vm9J38elx/Nh7Y3bnix85jAQpFH8HaVKuxdE= Received: from SN1PR12MB2431.namprd12.prod.outlook.com (52.132.195.146) by SN1PR12MB0589.namprd12.prod.outlook.com (10.163.208.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.19; Fri, 12 Apr 2019 13:39:16 +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.1771.021; Fri, 12 Apr 2019 13:39:16 +0000 From: Artur Petrosyan To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , "linux-usb@vger.kernel.org" CC: John Youn , Artur Petrosyan Subject: [PATCH 05/14] usb: dwc2: Add port conn. sts. checking in _dwc2_hcd_resume() function. Thread-Topic: [PATCH 05/14] usb: dwc2: Add port conn. sts. checking in _dwc2_hcd_resume() function. Thread-Index: AQHU8TUfZ5J9Tx3F1ECCKCYFp3qWiQ== Date: Fri, 12 Apr 2019 13:39:16 +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: VI1PR10CA0106.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::35) 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.193] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1843fc35-efd5-4199-3f84-08d6bf4c4147 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328)(7193020);SRVR:SN1PR12MB0589; x-ms-traffictypediagnostic: SN1PR12MB0589: x-microsoft-antispam-prvs: x-forefront-prvs: 0005B05917 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(346002)(396003)(376002)(39840400004)(136003)(189003)(199004)(52116002)(256004)(76176011)(110136005)(81156014)(68736007)(2906002)(316002)(8936002)(99286004)(54906003)(81166006)(25786009)(86362001)(7736002)(106356001)(305945005)(97736004)(8676002)(71200400001)(478600001)(71190400001)(4326008)(107886003)(118296001)(14454004)(186003)(2501003)(105586002)(476003)(446003)(26005)(66066001)(486006)(386003)(5660300002)(3846002)(6506007)(6512007)(2616005)(6486002)(11346002)(36756003)(6436002)(53936002)(14444005)(6116002)(102836004);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR12MB0589;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: N3KK6puKsU8SchNrjiU13BLIXUM0L6CdEOhMvG+o1iqDj9XuojUjJCCg48Tsh9cFkpOUTyrfjuP3Pc3nFIb0OHrGj6iTYywlTEfkj60myejDqH61D+dZ+fDNgxzYZFudsZDb+DNougQjbqTk+7z7SNxisdNJi/AcJ+u0kwmVPoUVcU2Gzwg5sX0BZupxjdY+84r4Lz6v/TPJSnm/FLEXq9nYWxMguAE3IswJtlI9lQTVl2srRdnWsThiaQVaArlZ+a9U1ISGtHEBaxpg5OGgMb8rWkTTKOo7sUMxbLfnUr9ZxMVa3eGho0XEu6JO3qy51oNWB08qYvwiV/6LAzPV8p++ooZCDwsrqCwL4s12VjCRV2GsQlm11oC787A1TeWi+STJRALf5NCAkZOqlGjnOh9h58ibodhB8D35URvAiig= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 1843fc35-efd5-4199-3f84-08d6bf4c4147 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2019 13:39:16.5690 (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: SN1PR12MB0589 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 Added port connection status checking which prevents exiting from Partial Power Down mode from _dwc2_hcd_resume() when no entering to Partial Power Down mode happened. Signed-off-by: Artur Petrosyan --- drivers/usb/dwc2/hcd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 1d18258b5ff8..8367902a47eb 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4544,6 +4544,9 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd) struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); unsigned long flags; int ret = 0; + u32 hprt0; + + hprt0 = dwc2_read_hprt0(hsotg); spin_lock_irqsave(&hsotg->lock, flags); @@ -4553,7 +4556,8 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd) if (hsotg->lx_state != DWC2_L2) goto unlock; - if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL) { + if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL || + hprt0 & HPRT0_CONNSTS) { hsotg->lx_state = DWC2_L0; goto unlock; } From patchwork Fri Apr 12 13:44:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 10898445 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 0C9DE14DB for ; Fri, 12 Apr 2019 13:44:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9A69284C0 for ; Fri, 12 Apr 2019 13:44:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB35428868; Fri, 12 Apr 2019 13:44:24 +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 2EC6C284C0 for ; Fri, 12 Apr 2019 13:44:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726829AbfDLNoX (ORCPT ); Fri, 12 Apr 2019 09:44:23 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:41350 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbfDLNoX (ORCPT ); Fri, 12 Apr 2019 09:44:23 -0400 Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 1356B10C29EA; Fri, 12 Apr 2019 06:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1555076663; bh=v+9OxjaWjTsT3Sz7TqYx6KCARUL2gWv5o0BpBc79B5Y=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=NdLo+VPCu6WocATFdq1tDI3waZQBw8wQJ+82cj0okbzKgL+T9vyPP5GoRsxJF8WI3 tVdriBk3QGJ1Zz0VJCpk0vOM9QdnZz6Ln0m3XjbDCQUwamaupPFP168bpVRhz0Y2si mA7tarKS5IFPham2jCOumUSATRd/X3vOq4N90hyN2yfo4B08ynQOcLNQAJuGuROE3Y nTCjyo1ifPFbKLRaES0+amM8ofk2GbO7vZMY/WaMy/cuXLfwijny+hvo4y/+XXCsUg lRiKmCZIO3KOdcHFBvV+LTRVa5dvGw+sT/wbqBArOTsN8hiBEvEkgQXCKf0yuq8LEl gM0/b3ISIATHQ== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id D217AA006A; Fri, 12 Apr 2019 13:44:22 +0000 (UTC) Received: from US01HYBRID2.internal.synopsys.com (10.15.246.24) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 12 Apr 2019 06:44:22 -0700 Received: from NAM04-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, 12 Apr 2019 06:44:22 -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=v+9OxjaWjTsT3Sz7TqYx6KCARUL2gWv5o0BpBc79B5Y=; b=tJNMPU8GIXg8d7KRqD7RKDREtAC6fYxqFTQgS7s33uPqdL47wJ5UwCeOemF33subHpNPMErI6earpg8H3zTkqX/LPwHL/r92lUBcNbq3ATZEpWj5eAszjYXIVLYey+Jlq6J2c24cBwph1SFuF8fDPDjYY5ciE/Lsgzber4CpXXc= Received: from SN1PR12MB2431.namprd12.prod.outlook.com (52.132.195.146) by SN1PR12MB0512.namprd12.prod.outlook.com (10.162.105.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.17; Fri, 12 Apr 2019 13:44:18 +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.1771.021; Fri, 12 Apr 2019 13:44:18 +0000 From: Artur Petrosyan To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , "linux-usb@vger.kernel.org" CC: John Youn , Artur Petrosyan Subject: [PATCH 06/14] usb: dwc2: Add part. power down exit from dwc2_conn_id_status_change(). Thread-Topic: [PATCH 06/14] usb: dwc2: Add part. power down exit from dwc2_conn_id_status_change(). Thread-Index: AQHU8TXTw6FMdm7vbEWwDIDxru8qeg== Date: Fri, 12 Apr 2019 13:44:18 +0000 Message-ID: <38533d799cc5cd10f6d4ca39e8423820a98ebda6.1555075928.git.arturp@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR01CA0011.prod.exchangelabs.com (2603:10b6:a02:80::24) 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: [209.107.194.221] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 92980a36-faeb-4791-ef8f-08d6bf4cf50d x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328)(7193020);SRVR:SN1PR12MB0512; x-ms-traffictypediagnostic: SN1PR12MB0512: x-microsoft-antispam-prvs: x-forefront-prvs: 0005B05917 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39850400004)(366004)(346002)(376002)(136003)(199004)(189003)(71200400001)(14454004)(476003)(71190400001)(36756003)(68736007)(107886003)(3846002)(118296001)(6116002)(6436002)(106356001)(4326008)(105586002)(2906002)(256004)(25786009)(66066001)(81156014)(99286004)(186003)(7736002)(8676002)(26005)(53936002)(6486002)(102836004)(2501003)(386003)(6506007)(81166006)(86362001)(52116002)(6512007)(110136005)(316002)(76176011)(305945005)(97736004)(5660300002)(54906003)(486006)(446003)(11346002)(478600001)(8936002)(2616005);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR12MB0512;H:SN1PR12MB2431.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:3; received-spf: None (protection.outlook.com: synopsys.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: dDPD4Oe79fH5tLk78W8bAj3jbximvgc/jDOVQ8Qsoajz1fXlNq5s07guKtUjSDpDVBVmhG9WGlYcAmt6TvdzEk7yhaYys3/3shO48vzSd4dycAhrDqy3XP+iCEkKM75MPU5j4xD4f2qFf1tVFm0F6xSTPGMr8EYJT/pQtf9RobP+0xEydeOcZmQ3+SPECpiGGJOSd5Eyo/w87y/0p4jgrZJr4y7PmUSWSpqqgtaVirNjzZl72z10ZbyDTJlLgxCxb/8C28IME6KuFozrt0y0IxHPHBkx5NBfkK/InH4zMNfJJ5/rVRyiZbWcIUFtfxzTHS9JmZS60cnJ1ReXNWu+WzrVrIrgBtwitqzkzEzhSr4GnOb1pZiSffUSLyYVET5ofhvixgAbMYa/3h8zrNZ2hL6xpTmsZ9j1Z88W/amQqhE= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 92980a36-faeb-4791-ef8f-08d6bf4cf50d X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2019 13:44:18.2784 (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: SN1PR12MB0512 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 Before changing to connector B exiting from Partial Power Down is required. - Added exiting from Partial Power Down mode when connector ID status changes to "connId B". Because if connector ID status changed to B connector while core was in partial power down mode, HANG would accrue from a soft reset. Signed-off-by: Artur Petrosyan --- drivers/usb/dwc2/hcd.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 8367902a47eb..54450fa352cf 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3348,6 +3348,7 @@ static void dwc2_conn_id_status_change(struct work_struct *work) wf_otg); u32 count = 0; u32 gotgctl; + u32 pcgcctl; unsigned long flags; dev_dbg(hsotg->dev, "%s()\n", __func__); @@ -3387,6 +3388,23 @@ static void dwc2_conn_id_status_change(struct work_struct *work) if (count > 250) dev_err(hsotg->dev, "Connection id status change timed out\n"); + + if (hsotg->params.power_down == + DWC2_POWER_DOWN_PARAM_PARTIAL && + hsotg->lx_state == DWC2_L2) { + pcgcctl = dwc2_readl(hsotg, PCGCTL); + pcgcctl &= ~PCGCTL_STOPPCLK; + dwc2_writel(hsotg, pcgcctl, PCGCTL); + + pcgcctl = dwc2_readl(hsotg, PCGCTL); + pcgcctl &= ~PCGCTL_PWRCLMP; + dwc2_writel(hsotg, pcgcctl, PCGCTL); + + pcgcctl = dwc2_readl(hsotg, PCGCTL); + pcgcctl &= ~PCGCTL_RSTPDWNMODULE; + dwc2_writel(hsotg, pcgcctl, PCGCTL); + } + hsotg->op_state = OTG_STATE_B_PERIPHERAL; dwc2_core_init(hsotg, false); dwc2_enable_global_interrupts(hsotg);