From patchwork Mon Aug 28 11:05:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 9925277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B377160311 for ; Mon, 28 Aug 2017 11:06:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A78832869D for ; Mon, 28 Aug 2017 11:06:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C500286AB; Mon, 28 Aug 2017 11:06:12 +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=-2.6 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 083F02869D for ; Mon, 28 Aug 2017 11:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=qEn/T20YK+Bg4JkVlLnMEAJcfRuMLtGRbWkw6T3itEg=; b=Nl20p7hC8IXkGa cK4OzFIe/Q7pe01V98xv2Mf5vln7CvsyUfkWhR+L4kz6bjS+LlagR8Q1wirBYWkcEkEV27Do4J/aH UIJkSJ3vl3jBLBRGXpYWdr+8Usog4Jw6iVQEFQVtTAqpDXORZGXQ3D3/urOqlCk+dJ82t0aNpA5Mz c7IwnUXaBiT2KHoqIgxjdT8WosqriNSi0PjgzD2SUDSWE1aj1IwncW4iDWXxU8zreH7eGyqKrwmAS ZHJge2z9zERvi3qs5Udaou3bX6A5NFXLzOxv/W6MtCY9y2lbWasixsfQMxlVMXvGyhp5jD/OllM3j dqf5Yyz5kLAOS/JIa+Ww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dmHrn-0005aQ-2X; Mon, 28 Aug 2017 11:06:03 +0000 Received: from mail-by2nam03on0605.outbound.protection.outlook.com ([2a01:111:f400:fe4a::605] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmHrj-0005Xi-Pf for linux-arm-kernel@lists.infradead.org; Mon, 28 Aug 2017 11:06:01 +0000 Received: from MWHPR03CA0042.namprd03.prod.outlook.com (10.174.173.159) by BN3PR03MB2259.namprd03.prod.outlook.com (10.166.74.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9; Mon, 28 Aug 2017 11:05:36 +0000 Received: from BN1AFFO11OLC002.protection.gbl (2a01:111:f400:7c10::171) by MWHPR03CA0042.outlook.office365.com (2603:10b6:301:3b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9 via Frontend Transport; Mon, 28 Aug 2017 11:05:36 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11OLC002.mail.protection.outlook.com (10.58.53.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1341.15 via Frontend Transport; Mon, 28 Aug 2017 11:05:36 +0000 Received: from fsr-ub1664-115.ea.freescale.net (fsr-ub1664-115.ea.freescale.net [10.171.73.213]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v7SB5VTw030290; Mon, 28 Aug 2017 04:05:32 -0700 From: Leonard Crestez To: Shawn Guo , Viresh Kumar , "Rafael J. Wysocki" Subject: [PATCH] cpufreq: imx6q: Fix imx6sx low frequency support Date: Mon, 28 Aug 2017 14:05:18 +0300 Message-ID: <4304e578a343c9acaed46b7e205d49bb63323f80.1503918257.git.leonard.crestez@nxp.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131483919364582646; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(6306002)(626005)(36756003)(53936002)(68736007)(50226002)(81166006)(54906002)(81156014)(8936002)(4326008)(356003)(8676002)(69596002)(97736004)(85426001)(305945005)(5003940100001)(48376002)(189998001)(50466002)(6666003)(77096006)(118296001)(50986999)(86362001)(47776003)(33646002)(106466001)(105606002)(104016004)(7416002)(5660300001)(966005)(8656003)(2906002)(498600001)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2259; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11OLC002; 1:jUQX3MAvixQvGa1hQILJMhss6PiTj2aga/6oMmds3xBCqj7BHGFAUwZfmUuokUvCbWIvM5UzBSdMprDAytyx0tjLFiKj39mDOzeYxFhbM5qLJJsmtXD6W/CJ647gYcka MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b640949-5801-4bc2-8b96-08d4ee04b5db X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN3PR03MB2259; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2259; 3:UNdZumrPbQrCYraDMwAEdpCI0+1vGlot9DY0ivLFf5htePhPlsHhTCzvt4wzT2yUCyhOJ/ZHU+m8hu9/7iRtO+6mnFE0/nM/xtg7iowGZmE8afX9D1Z2XDk0KpiALrziiLf/vhinaG7Xq0D4e7F9DDx9WV0O9XMzwC33kizCE6AI0WMNtqRGAnP1x+Umi5yD6DexwsrizS4wsj/zL8OzphOz/l3NQ1qhFUZt48sMKYh1uRkHcBkvMEw2slfyhoZV1WRFT/y6mCWbXXcgzZSwDv15XqQ15lhAQezUnnpMhGD4Y2h/eDx/dg9BAy7sgRjhXT5812hBWCK3yf2JSo/EKQ==; 25:sj5zuRWHyWKCQj9sMFX5TCS7tCskbBHFNU6sJxYcC5YzVqh8TG1o2mryh7gRuRumQUk3ehRX3aioqe1wz37UJzOx695igY79V2SF4MgBbMWgMisIjYOMPZy2RUBQEDSQx/w2Z+AXo+xTmtYJlMs5ikHhZB0xpnp3zanqCkWLfvp6dfClad3eZrR12vK8uxVWDY8HNIgIyk7qddhNOXgd0/74lqPe3ZQ4ENVeY8KyNRHGeZa/L/ZIxvCmWh2JSoeXsm3copOuQ9zns8R6xY60ecSWYmfUtVpbaGiky7+Wyi9BtaveiK0FqAzU+B+FY/BeUxd7rUDreCS7yxf4juDbZg==; 31:urDzDYs64HW/ljE6GeA4o6KQp3so/2Mk1r/oiV8GKZ2N8qFMKHnjHszkwFlNc4oN3pwZU0RNMyl80MScYvYXKVnZvv7n6MSajMxVizsdyDvPoU+MzFFtXSZ+Cb+vLt95cZ5p49EK2dkVmePsf6/++PWq2boy0VHr/JdFqWs5YRzMOjplI9TXimDPP3YHbgvh3yd0+vAWk+KLVtnlQvz7fz/9CvDiec0lxGsPO/0Ktek= X-MS-TrafficTypeDiagnostic: BN3PR03MB2259: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(8121501046)(13018025)(13016025)(5005006)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123563025)(20161123565025)(20161123556025)(20161123561025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2259; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2259; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2259; 4:uyHo4CjrSeUvOvlj4BjwJz7WsMQ3ri+AUn5YXH1xo3Aj3COiKYE3/1vgZKDdV0UfZL3GQCowqyhTpCcyQQQb51CXzMW0NDCYrGzLmwuyDp9cXER6HsIVOslDYAEkUY+4dNHjohxVBtn4lHOmMJU1PG/i/ndnVVPJpBkiqq4YH7R0DIiVt27lRDaZzUXiSfEU6IOfKk8N+GJrOgTes9Npa1ad9qhIntCAUxLEuFOV65b4V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xlg==; 24:mOaftC4IsxbAL4UGn6X2B0XSWA526uEg8kdc/EYHxvHAEhjTA4A+ARIL0+1Nc2Plu0K8kBTHqGR1ZbycVfdRqPvr1GWBtfJPoolEtTr3TxA=; 7:5ui/Hl3qdKujMa7teDu5V0TUVb2rEVeccCfljxe/VhdlLLeQq4QrMN+Rd9rHyyDP6k2dKmi6HZXIUORAQZ2+PiJrMmd/qRHOE9X0IaRUd9TPhV/ZVa6U/ZQX95Elhmi2X0Jc0ZT92ZzBv/btd2gQ+Mz1b6D+oDgXXc2jiCZIbyMyfxAfiqfeOYCzZFmMEjFZNAqxVZkSkqmNNZ/z++fyKNz+mMy4ayh6Ba4FghTjXSs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2017 11:05:36.2086 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB2259 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170828_040559_911116_7D3D0624 X-CRM114-Status: GOOD ( 13.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dong Aisheng , Bai Ping , Anson Huang , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Fabio Estevam , linux-arm-kernel@lists.infradead.org, Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch contains the minimal changes required to support imx6sx OPP of 198 Mhz. Without this patch cpufreq still reports success but the frequency is not changed, the "arm" clock will still be at 396000000 in clk_summary. In order to do this PLL1 needs to be still kept enabled while changing the ARM clock. This is a hardware requirement: when ARM_PODF is changed in CCM we need to check the busy bit of CCM_CDHIPR bit 16 arm_podf_busy, and this bit is sync with PLL1 clock, so if PLL1 NOT enabled, this bit will never get clear. Keep pll1_sys explicitly enabled until after the rate is change to deal with this. Otherwise from the clk framework perspective pll1_sys is unused and gets turned off. Signed-off-by: Leonard Crestez Reviewed-by: Lucas Stach Acked-by: Dong Aisheng --- Changes since v1: - Link: https://lkml.org/lkml/2017/7/19/302 - Only keep pll1_sys enabled until after ARM rate is changed. - Incorporate more elaborate explanation from Anson - Do not add new clocks or bypass PLL1. Just let it get disabled. drivers/cpufreq/imx6q-cpufreq.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index b6edd3c..14466a9 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -47,6 +47,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) struct dev_pm_opp *opp; unsigned long freq_hz, volt, volt_old; unsigned int old_freq, new_freq; + bool pll1_sys_temp_enabled = false; int ret; new_freq = freq_table[index].frequency; @@ -124,6 +125,10 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) if (freq_hz > clk_get_rate(pll2_pfd2_396m_clk)) { clk_set_rate(pll1_sys_clk, new_freq * 1000); clk_set_parent(pll1_sw_clk, pll1_sys_clk); + } else { + /* pll1_sys needs to be enabled for divider rate change to work. */ + pll1_sys_temp_enabled = true; + clk_prepare_enable(pll1_sys_clk); } } @@ -135,6 +140,10 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) return ret; } + /* PLL1 is only needed until after ARM-PODF is set. */ + if (pll1_sys_temp_enabled) + clk_disable_unprepare(pll1_sys_clk); + /* scaling down? scale voltage after frequency */ if (new_freq < old_freq) { ret = regulator_set_voltage_tol(arm_reg, volt, 0);