From patchwork Tue Jan 22 10:37:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10775341 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 5DADF6C2 for ; Tue, 22 Jan 2019 10:38:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DA252A519 for ; Tue, 22 Jan 2019 10:38:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F3F02A527; Tue, 22 Jan 2019 10:38:32 +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 214522A519 for ; Tue, 22 Jan 2019 10:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727468AbfAVKi3 (ORCPT ); Tue, 22 Jan 2019 05:38:29 -0500 Received: from mail-eopbgr60052.outbound.protection.outlook.com ([40.107.6.52]:33024 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726284AbfAVKi3 (ORCPT ); Tue, 22 Jan 2019 05:38:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ab9iXoEeQsA5rX1lFleKF8H8Lm8kD5qmNjHMM1buuqU=; b=jzHskTW3Qo+JMibOW/6zWxiIzivnTlytv56gxpo+sm8IFEGoBsYAxFZbJsnyfwO9KN5jwUMsS8qMWijnUOg0/2wWj9UtZ9J0u7ZMLfmemR7/QFSTja/45OmwDknWMw4DL+LplX8Hzn3MBrsDMM8vdJJ+p9ysnOWXI2vUcVvjY+A= Received: from VI1PR04MB4558.eurprd04.prod.outlook.com (20.177.55.216) by VI1PR04MB5678.eurprd04.prod.outlook.com (20.178.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.29; Tue, 22 Jan 2019 10:38:25 +0000 Received: from VI1PR04MB4558.eurprd04.prod.outlook.com ([fe80::b031:35a0:6edf:62c7]) by VI1PR04MB4558.eurprd04.prod.outlook.com ([fe80::b031:35a0:6edf:62c7%3]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 10:38:25 +0000 From: Jun Li To: "robh+dt@kernel.org" , "mark.rutland@arm.com" , "balbi@kernel.org" CC: "linux-usb@vger.kernel.org" , "devicetree@vger.kernel.org" , dl-linux-imx Subject: [PATCH 2/2] dwc3: add power down clock scale setting when init core Thread-Topic: [PATCH 2/2] dwc3: add power down clock scale setting when init core Thread-Index: AQHUsj5zJCT2wHIZlk2LuLZ4zbBXUA== Date: Tue, 22 Jan 2019 10:37:19 +0000 Message-ID: <1548152179-19472-2-git-send-email-jun.li@nxp.com> References: <1548152179-19472-1-git-send-email-jun.li@nxp.com> In-Reply-To: <1548152179-19472-1-git-send-email-jun.li@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0183.apcprd02.prod.outlook.com (2603:1096:201:21::19) To VI1PR04MB4558.eurprd04.prod.outlook.com (2603:10a6:803:6f::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR04MB5678;6:dEr3IDiU96G2w9LEki52CTjySsHxCMO+68Iui4tidAghqK630sUI789lTvLZTU51W5c2HVPgsICR7HJ0Y6ukzCKZzHnyUH5n8ZqP+6CeufkhvRovKI4W5fy/uWMVabEKeWCZIcZyUiw17UXAWx981Pg22Gq50wZ6zuTxmxSOBZUEggS62eyNBGrQh4BHuB/flXVoZI95JiRFliiHUSqQ7joW5qK8Iu7qlGH9hoJQd9wddJ2xnPTLlR8uFOnzjSIsNwG+Do6NQDMJknhWXqm3PWgnY2ipb+mH1u/XIzo3007utzPmQc9zQ4PRTTliihntcW5hk+H4JrwkIipgAfYBcTBVMrpkl8/zIMbYcu79FNr3Df1QK9/8wcxvco+ea9+REniNUjAlvMPSodPxmC22D32LQ7TwSSw1HWJzSRoDUZUjDuI1jEW13zXXyefESAZRfCElRcPCDpA25Flsdt08Uw==;5:dlmgQ9vTOf3lDMmvPGb5ckPxO0luklhTlRxd9PBwYRSGSVimi7We8QpKRUfZyi8sDGE+XM6ki3/CkFqjJ7WBixSmga3pPGZr0v6YRRC5japvUj/EIYJUNn9HNn4a5LXoYoEZAIAjolo2uumn8MJ1qb5YzYIRp1TI4BGpC0j5PpuX0nd1WGcwX5X+hChI67rAywskLJT4RFJS9lDYthO6sQ==;7:6uCFZg+zSBIZ/ZPlKT8t1Uvo+w02/WgiyPlCeE1t0gbIpnPRUo7V6mDsYnZC/S2vYiuCh15V7hg9a249FGPQZI1Nduk1HWUkVZr+IfB9JR8EM5/ItvUwUSIbsL1Z7LSLKcPVEwkk2LgsWaPAjvAbyA== x-ms-office365-filtering-correlation-id: 38afcb24-b78a-4371-fd33-08d680559606 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB5678; x-ms-traffictypediagnostic: VI1PR04MB5678: x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(396003)(366004)(136003)(376002)(346002)(189003)(199004)(2906002)(36756003)(50226002)(6506007)(386003)(26005)(7736002)(486006)(305945005)(44832011)(54906003)(316002)(99286004)(110136005)(256004)(52116002)(8936002)(186003)(81156014)(8676002)(81166006)(6666004)(76176011)(102836004)(86362001)(4326008)(6116002)(3846002)(476003)(2616005)(11346002)(2501003)(66066001)(97736004)(105586002)(71200400001)(6436002)(71190400001)(106356001)(6512007)(14454004)(446003)(478600001)(53936002)(25786009)(6486002)(68736007);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB5678;H:VI1PR04MB4558.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: gS7PIsTOpr2dcNIlFJgXvC9uR4H0mzRLhoypPAOJ1ukEjEcrgJ8pzdNCE+s5w1I/Mpya6QwnqfqS2JtBYMiEmJqW7sbm+5eICnw53yV9K46AN+ojyQLC/JO2LvfPwv7tSC8s2UMg7WyUZHY1XM7KikAv8dlpSSI05WYlbAW4Ifjl3i6uqTQ/cd6GOEMb83nQw6ewicplJCMFbbOlx0n7DCiNDlR7SQeiFs2q2MIBwREgZulwP1Vhp1j560LvYJ1crlqTNiVvnZHQU3m1HGVWaWqUJmiIx4Lu62Mq9fNbxNs5mMBJKH18xFj/OiQp/3WQhFK9YXKp2uGOCf/YlhkQmbkYN83a0tbw05UT7xyYO0Du+RJyGnFScKjm77m6PT48Io7kOabp/sV8uiLzUlR0zVbV5CcHVoiue9W6ufSCDbg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38afcb24-b78a-4371-fd33-08d680559606 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 10:37:17.4543 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5678 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 Set the right power down clock scale if the property "snps,power-down-scale" is specified. Signed-off-by: Li Jun --- drivers/usb/dwc3/core.c | 15 +++++++++++++++ drivers/usb/dwc3/core.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 88c80fc..c41c0b2 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -878,6 +878,19 @@ static void dwc3_set_incr_burst_type(struct dwc3 *dwc) dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, cfg); } +static void dwc3_set_power_down_clk_scale(struct dwc3 *dwc) +{ + u32 reg, scale; + + if (!device_property_read_u32(dwc->dev, "snps,power-down-scale", + &scale)) { + reg = dwc3_readl(dwc->regs, DWC3_GCTL); + reg &= ~(DWC3_GCTL_PWRDNSCALE_MASK); + reg |= DWC3_GCTL_PWRDNSCALE(scale); + dwc3_writel(dwc->regs, DWC3_GCTL, reg); + } +} + /** * dwc3_core_init - Low-level initialization of DWC3 Core * @dwc: Pointer to our controller context structure @@ -908,6 +921,8 @@ static int dwc3_core_init(struct dwc3 *dwc) dwc->maximum_speed = USB_SPEED_HIGH; } + dwc3_set_power_down_clk_scale(dwc); + ret = dwc3_phy_setup(dwc); if (ret) goto err0; diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 5bfb625..8cdaab3 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -216,6 +216,7 @@ /* Global Configuration Register */ #define DWC3_GCTL_PWRDNSCALE(n) ((n) << 19) +#define DWC3_GCTL_PWRDNSCALE_MASK DWC3_GCTL_PWRDNSCALE(0x1fff) #define DWC3_GCTL_U2RSTECN BIT(16) #define DWC3_GCTL_RAMCLKSEL(x) (((x) & DWC3_GCTL_CLK_MASK) << 6) #define DWC3_GCTL_CLK_BUS (0)