Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754784AbdDKMHR (ORCPT ); Tue, 11 Apr 2017 08:07:17 -0400 Received: from mail-sn1nam01on0089.outbound.protection.outlook.com ([104.47.32.89]:32192 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752397AbdDKMHI (ORCPT ); Tue, 11 Apr 2017 08:07:08 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; From: Dong Aisheng To: CC: , , , , , , , , , , , , , , , Subject: [RFC PATCH 3/3] cpufreq: imx6q: refine clk operations Date: Wed, 12 Apr 2017 12:03:29 +0800 Message-ID: <1491969809-20154-4-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491969809-20154-1-git-send-email-aisheng.dong@nxp.com> References: <1491969809-20154-1-git-send-email-aisheng.dong@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131363860250559054;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(336005)(39380400002)(39450400003)(39860400002)(39400400002)(39840400002)(39850400002)(39410400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(2950100002)(6916009)(6666003)(50466002)(47776003)(85426001)(7416002)(8936002)(305945005)(105606002)(5660300001)(36756003)(110136004)(8676002)(53936002)(81166006)(38730400002)(4326008)(86362001)(189998001)(50226002)(97736004)(48376002)(356003)(2906002)(54906002)(76176999)(77096006)(50986999)(2351001)(106466001)(33646002)(104016004)(8656002)(5003940100001)(32563001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR03MB2282;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:ovrnspm;A:1;MX:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD007;1:pqv8brfclEXRNOnplYlYSvU+6VshXf2umgWKkiWsM3NDQ8g49qimJ8T5sZMx+i4IjYmyXl2XjszPqf82P4DBPvapbim3oUZ2fetqbAU+N9X1niprVfPj92L42/BlUjIVdsqkbEmEJUYWdLw6Jt7vVwokETdcC8FoXpIDIyvJLAgJnxrBc4krrWZcjLpJRHntnYMg/hDUapoaEZUhim8hhH1lGMbrmZGmd+cqk4AbfxR9xIL5j/yhvalE7J6/jTeQOzTSKUQV5YHlt6X0YM4Ta6iTG1rQxw9S5T5d7PU/G6Rb+xP1PKZFuWhAmhfOHHOJAzi7C1ddOEUuGFuS+njjKhJOms93TV6fAeYP9Q4O9SuzbPx/+KigYCPB3MmT/sVcca6flVXkO2MNLuooWLeSxKhMU81Obs8/wkvI2QeKvceOj7ACIGY9DiGcxFKfxGZCc2/rjVEI8JhMI55Q99wO7ebVRyuZ570m7PE4y5lvK+R/Yc1Y2DEWG9Mcb8JXV3PgC568ru+ahJOGkZ++HAD8j2z674aOIeSAgOdF4ytqah8ID68uSxmgaJTnaCSJj2Ub3ED8V8kQCtJU+fGReOyCIgIp5duAK10IzBjqYtqN3MgOX7qaGNL/flkpIWmqwdSKhkQIYqFN8ZhOls3yHKSqCdjNt5ncFIwIWbb/kymLN8PkCKHafIECXtOYDsQYR30BnV/b1FLuO3itOBT04X+9c0FBKfK/S6U438PvdS0Io8M= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: dff31f8f-ecb0-48b3-f536-08d480d344f2 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030255120)(201703131430075)(201703131517081);SRVR:CY1PR03MB2282; X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2282;3:3qxc0qqUUDZZWAiVXJ7H9aIhlRydeMQMkY658MsF4UuVEtpNJwoIdjlAmJ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X7d9WV7steizTolcp8fr77CAyREXYjg/2t0gNXAl0lbo8SIe+uwsa4dECC8+nQXfT+N3Ak36NiQt2CQB8MOm3UpsyFRe/Z2zh1zi12T7Sm6tD3yJwwKWTOgre9iTe/ghpWDbXg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(601004)(2401047)(8121501046)(13015025)(5005006)(13017025)(13018025)(13024025)(13023025)(3002001)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123561025)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703161259075)(20161123556025);SRVR:CY1PR03MB2282;BCL:0;PCL:0;RULEID:(400006);SRVR:CY1PR03MB2282; X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2282;4:zRUwguJEV/+vf5fqi2lziYq6Q2UztJ9tg/DtyLid3ByBpFyQoCWDFSQga9WW79QZjEaqfUjhUy4BCdXYs+Lx9xBqTGTZWTqo5Oq76iPwTBKnxWwPbSUSl+ujGJd/7KBfAeZ9HBagLqn9UYqMs2oo/JXDi9V+twYMQGhEp7qmg7PT04Vm8a/BGrAE2ntNKPv06uVm3rVHHPcHT8C3y7CfpLVMkj3yGA5yF96woCEIqnUYQy2uIpH78tW01AlP1Dw16xSXza9iutZkRGcyqGN4QYQoZAOE7ubtFtOYuv3yQ25ceEp4CrQcdyws07Zn93RWUzhA4ANIp80ZE0RZhx9Wf9pagOPOgeayv6s49f70a/SfSPd5LjRt0q8IxBV4nVwidj+rIFdTXIgdETdbiW8gLl24/F2lHzE7hM1h6hsr79NAsXBCpH5YMBmSdnFgiEl1/vZvHfVm+tmkhAI32glATNSoGIysOpnjQa4U/nbf1hrd71qo8z2TusiJyuqU/upNHyB29LxINHqBeJx8yLmZSAZnhIyLuEE3TiRIYdTLhj9I2UnG0wJ+jzrm0KtIcU11BrV7PVlj1kZnne66EO4opruThv5G5MaNr5owMgMLMR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D74sHU7j6PFP/B8vTdbY7raibGQVp61Ftj94EttWAM/u1uR7Og3KtWd23fTgHFUYiBkwvdKRyfaLjuVKy309BWIdw6c9v7l+6cHemFHsvX/22sRjkE4RIC/TdWVslSwiFin7f9MYxDm+WZo6wfEcnTXyBptILumMrB9TdT3cNPaAjdYc+M9EtDFQEJKmU8mhtBJW2LaAh5ngc74PZNI2IN8xD0axDcC/YtfPC+RJskXnBzn+JD8Wjdm9kcTjN8/KyoOsleU4KytsJATzz81isu4D3i/FzUR06xZrnz3xKUtHDco/8o6pPzCW3zLxzd9fPR9MiPRB+g==;5:XtaWHGWV8UH4JK5OECEVelbftilJpSMgEa84JIkhoINosIgc/qGpZ/I5gooXPvepNwSHPiM9BD48/0IHdBcoDz17xw2NFheq98SuiMGVCXaaJ8Re4LLLClnWoALxwJ64KX4T03VWTxSHG1AjJD/41rCq31y2ip051RuCYwYw/9SSokLDTVYH2TUsdpyFzz4o;24:rZZA48lWIy2+ZbYRugIshXnvYeCnPPLuflcyQBMMxqLHLIIzsXdNZzI9aGwMYWwYPnh4ZR76U2QCXUrcVUvqz9w2PrkBKOtD0Gv2TNQt72w= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR03MB2282;7:xFJCZOy/f1K+TBu0jFpcERz39ODj3TCbAwUJdCr58fet+Twl7mcaZWNI3o6HZZGAV+60lKYRXKcxWBVCb8009BGLmbeQpF2agBsv3qChVgQvKadQPAMnWPp5gudVYpxFvB2oWBm9CmmU41u1i4yDYK9uysTYRb15nVNrc08eW6yIxwohuiXcSqM2wcFGShTfyqcHBsjgDQV799nJz8q1KPhc85bdCK12H6txyqaD4stMPyM14K2Vu7BHhTUORQBBfPzubTKmx0Z/zGfBob6hO/Vfq2RXYmWkqkgmZw66yl6LcyO0U/Q17n8Q2OuJA7ztDqMrWp22KWjIFupSR84J3Q== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2017 12:07:04.6969 (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.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2282 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6558 Lines: 202 Use clk_bulk_get to ease the driver clocks handling. Cc: Michael Turquette Cc: Stephen Boyd Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: Mark Brown Cc: Shawn Guo Cc: Fabio Estevam Cc: Sascha Hauer Cc: Anson Huang Cc: Robin Gong Cc: Bai Ping Cc: Leonard Crestez Cc: Octavian Purdila Signed-off-by: Dong Aisheng --- drivers/cpufreq/imx6q-cpufreq.c | 119 ++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 66 deletions(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 7719b02..6158910 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -24,15 +24,29 @@ static struct regulator *arm_reg; static struct regulator *pu_reg; static struct regulator *soc_reg; -static struct clk *arm_clk; -static struct clk *pll1_sys_clk; -static struct clk *pll1_sw_clk; -static struct clk *step_clk; -static struct clk *pll2_pfd2_396m_clk; - -/* clk used by i.MX6UL */ -static struct clk *pll2_bus_clk; -static struct clk *secondary_sel_clk; +enum IMX6_CPUFREQ_CLKS { + ARM, + PLL1_SYS, + STEP, + PLL1_SW, + PLL2_PFD2_396M, + /* MX6UL requires two more clks */ + PLL2_BUS, + SECONDARY_SEL, +}; +#define IMX6Q_CPUFREQ_CLK_NUM 5 +#define IMX6UL_CPUFREQ_CLK_NUM 7 + +static int num_clks; +static struct clk_bulk_data clks[] = { + { .id = "arm" }, + { .id = "pll1_sys" }, + { .id = "step" }, + { .id = "pll1_sw" }, + { .id = "pll2_pfd2_396m" }, + { .id = "pll2_bus" }, + { .id = "secondary_sel" }, +}; static struct device *cpu_dev; static bool free_opp; @@ -51,7 +65,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) new_freq = freq_table[index].frequency; freq_hz = new_freq * 1000; - old_freq = clk_get_rate(arm_clk) / 1000; + old_freq = clk_get_rate(clks[ARM].clk) / 1000; opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_hz); if (IS_ERR(opp)) { @@ -109,25 +123,27 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) * voltage of 528MHz, so lower the CPU frequency to one * half before changing CPU frequency. */ - clk_set_rate(arm_clk, (old_freq >> 1) * 1000); - clk_set_parent(pll1_sw_clk, pll1_sys_clk); - if (freq_hz > clk_get_rate(pll2_pfd2_396m_clk)) - clk_set_parent(secondary_sel_clk, pll2_bus_clk); + clk_set_rate(clks[ARM].clk, (old_freq >> 1) * 1000); + clk_set_parent(clks[PLL1_SW].clk, clks[PLL1_SYS].clk); + if (freq_hz > clk_get_rate(clks[PLL2_PFD2_396M].clk)) + clk_set_parent(clks[SECONDARY_SEL].clk, + clks[PLL2_BUS].clk); else - clk_set_parent(secondary_sel_clk, pll2_pfd2_396m_clk); - clk_set_parent(step_clk, secondary_sel_clk); - clk_set_parent(pll1_sw_clk, step_clk); + clk_set_parent(clks[SECONDARY_SEL].clk, + clks[PLL2_PFD2_396M].clk); + clk_set_parent(clks[STEP].clk, clks[SECONDARY_SEL].clk); + clk_set_parent(clks[PLL1_SW].clk, clks[STEP].clk); } else { - clk_set_parent(step_clk, pll2_pfd2_396m_clk); - clk_set_parent(pll1_sw_clk, step_clk); - 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); + clk_set_parent(clks[STEP].clk, clks[PLL2_PFD2_396M].clk); + clk_set_parent(clks[PLL1_SW].clk, clks[STEP].clk); + if (freq_hz > clk_get_rate(clks[PLL2_PFD2_396M].clk)) { + clk_set_rate(clks[PLL1_SYS].clk, new_freq * 1000); + clk_set_parent(clks[PLL1_SW].clk, clks[PLL1_SYS].clk); } } /* Ensure the arm clock divider is what we expect */ - ret = clk_set_rate(arm_clk, new_freq * 1000); + ret = clk_set_rate(clks[ARM].clk, new_freq * 1000); if (ret) { dev_err(cpu_dev, "failed to set clock rate: %d\n", ret); regulator_set_voltage_tol(arm_reg, volt_old, 0); @@ -161,7 +177,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) static int imx6q_cpufreq_init(struct cpufreq_policy *policy) { - policy->clk = arm_clk; + policy->clk = clks[ARM].clk; return cpufreq_generic_init(policy, freq_table, transition_latency); } @@ -197,27 +213,14 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) return -ENOENT; } - arm_clk = clk_get(cpu_dev, "arm"); - pll1_sys_clk = clk_get(cpu_dev, "pll1_sys"); - pll1_sw_clk = clk_get(cpu_dev, "pll1_sw"); - step_clk = clk_get(cpu_dev, "step"); - pll2_pfd2_396m_clk = clk_get(cpu_dev, "pll2_pfd2_396m"); - if (IS_ERR(arm_clk) || IS_ERR(pll1_sys_clk) || IS_ERR(pll1_sw_clk) || - IS_ERR(step_clk) || IS_ERR(pll2_pfd2_396m_clk)) { - dev_err(cpu_dev, "failed to get clocks\n"); - ret = -ENOENT; - goto put_clk; - } + if (of_machine_is_compatible("fsl,imx6ul")) + num_clks = IMX6UL_CPUFREQ_CLK_NUM; + else + num_clks = IMX6Q_CPUFREQ_CLK_NUM; - if (of_machine_is_compatible("fsl,imx6ul")) { - pll2_bus_clk = clk_get(cpu_dev, "pll2_bus"); - secondary_sel_clk = clk_get(cpu_dev, "secondary_sel"); - if (IS_ERR(pll2_bus_clk) || IS_ERR(secondary_sel_clk)) { - dev_err(cpu_dev, "failed to get clocks specific to imx6ul\n"); - ret = -ENOENT; - goto put_clk; - } - } + ret = clk_bulk_get(cpu_dev, num_clks, clks); + if (ret) + goto put_node; arm_reg = regulator_get(cpu_dev, "arm"); pu_reg = regulator_get_optional(cpu_dev, "pu"); @@ -354,22 +357,11 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) regulator_put(pu_reg); if (!IS_ERR(soc_reg)) regulator_put(soc_reg); -put_clk: - if (!IS_ERR(arm_clk)) - clk_put(arm_clk); - if (!IS_ERR(pll1_sys_clk)) - clk_put(pll1_sys_clk); - if (!IS_ERR(pll1_sw_clk)) - clk_put(pll1_sw_clk); - if (!IS_ERR(step_clk)) - clk_put(step_clk); - if (!IS_ERR(pll2_pfd2_396m_clk)) - clk_put(pll2_pfd2_396m_clk); - if (!IS_ERR(pll2_bus_clk)) - clk_put(pll2_bus_clk); - if (!IS_ERR(secondary_sel_clk)) - clk_put(secondary_sel_clk); + + clk_bulk_put(num_clks, clks); +put_node: of_node_put(np); + return ret; } @@ -383,13 +375,8 @@ static int imx6q_cpufreq_remove(struct platform_device *pdev) if (!IS_ERR(pu_reg)) regulator_put(pu_reg); regulator_put(soc_reg); - clk_put(arm_clk); - clk_put(pll1_sys_clk); - clk_put(pll1_sw_clk); - clk_put(step_clk); - clk_put(pll2_pfd2_396m_clk); - clk_put(pll2_bus_clk); - clk_put(secondary_sel_clk); + + clk_bulk_put(num_clks, clks); return 0; } -- 2.7.4