summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorSébastien Szymanski <sebastien.szymanski@armadeus.com>2018-05-22 02:28:51 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-06-11 04:13:27 -0400
commit0aa9abd4c212fc1cd111cc0a9fc571f0d86e63cf (patch)
treef5beda74ff69ec7ba4d8b29d4ee520dab21dda4b /drivers/cpufreq
parent7592019634f8473f0b0973ce79297183077bdbc2 (diff)
cpufreq: imx6q: check speed grades for i.MX6ULL
Check the max speed supported from the fuses for i.MX6ULL and update the operating points table accordingly. Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Tested-by: Stefan Agner <stefan@agner.ch> Reviewed-by: Stefan Agner <stefan@agner.ch> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Acked-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/imx6q-cpufreq.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index 83cf631fc9bc..f094687cae52 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -266,6 +266,8 @@ put_node:
266} 266}
267 267
268#define OCOTP_CFG3_6UL_SPEED_696MHZ 0x2 268#define OCOTP_CFG3_6UL_SPEED_696MHZ 0x2
269#define OCOTP_CFG3_6ULL_SPEED_792MHZ 0x2
270#define OCOTP_CFG3_6ULL_SPEED_900MHZ 0x3
269 271
270static void imx6ul_opp_check_speed_grading(struct device *dev) 272static void imx6ul_opp_check_speed_grading(struct device *dev)
271{ 273{
@@ -287,16 +289,30 @@ static void imx6ul_opp_check_speed_grading(struct device *dev)
287 * Speed GRADING[1:0] defines the max speed of ARM: 289 * Speed GRADING[1:0] defines the max speed of ARM:
288 * 2b'00: Reserved; 290 * 2b'00: Reserved;
289 * 2b'01: 528000000Hz; 291 * 2b'01: 528000000Hz;
290 * 2b'10: 696000000Hz; 292 * 2b'10: 696000000Hz on i.MX6UL, 792000000Hz on i.MX6ULL;
291 * 2b'11: Reserved; 293 * 2b'11: 900000000Hz on i.MX6ULL only;
292 * We need to set the max speed of ARM according to fuse map. 294 * We need to set the max speed of ARM according to fuse map.
293 */ 295 */
294 val = readl_relaxed(base + OCOTP_CFG3); 296 val = readl_relaxed(base + OCOTP_CFG3);
295 val >>= OCOTP_CFG3_SPEED_SHIFT; 297 val >>= OCOTP_CFG3_SPEED_SHIFT;
296 val &= 0x3; 298 val &= 0x3;
297 if (val != OCOTP_CFG3_6UL_SPEED_696MHZ) 299
298 if (dev_pm_opp_disable(dev, 696000000)) 300 if (of_machine_is_compatible("fsl,imx6ul")) {
299 dev_warn(dev, "failed to disable 696MHz OPP\n"); 301 if (val != OCOTP_CFG3_6UL_SPEED_696MHZ)
302 if (dev_pm_opp_disable(dev, 696000000))
303 dev_warn(dev, "failed to disable 696MHz OPP\n");
304 }
305
306 if (of_machine_is_compatible("fsl,imx6ull")) {
307 if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ)
308 if (dev_pm_opp_disable(dev, 792000000))
309 dev_warn(dev, "failed to disable 792MHz OPP\n");
310
311 if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ)
312 if (dev_pm_opp_disable(dev, 900000000))
313 dev_warn(dev, "failed to disable 900MHz OPP\n");
314 }
315
300 iounmap(base); 316 iounmap(base);
301put_node: 317put_node:
302 of_node_put(np); 318 of_node_put(np);
@@ -356,7 +372,8 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
356 goto put_reg; 372 goto put_reg;
357 } 373 }
358 374
359 if (of_machine_is_compatible("fsl,imx6ul")) 375 if (of_machine_is_compatible("fsl,imx6ul") ||
376 of_machine_is_compatible("fsl,imx6ull"))
360 imx6ul_opp_check_speed_grading(cpu_dev); 377 imx6ul_opp_check_speed_grading(cpu_dev);
361 else 378 else
362 imx6q_opp_check_speed_grading(cpu_dev); 379 imx6q_opp_check_speed_grading(cpu_dev);