From 6e85aaf05d26b475fd760da7df5b195fb01f8cd2 Mon Sep 17 00:00:00 2001 From: Anson Huang Date: Tue, 6 May 2014 14:04:52 +0800 Subject: ENGR00311992-3 ARM: imx: add cpufreq support for i.mx6sx Enable cpufreq support for i.MX6SX, currently three setpoints are supported, the freq/volt table are as below: VDDARM_CAP VDDSOC_CAP 996M: 1.250V 1.175V 792M: 1.175V 1.175V 396M: 1.075V 1.175V All upper voltages are 25mV higher then the minimum value defined in datasheet, this 25mV is to cover board level IR drop. Signed-off-by: Anson Huang --- arch/arm/mach-imx/mach-imx6sx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c index 96c79a0bb4f5..f711895e7019 100644 --- a/arch/arm/mach-imx/mach-imx6sx.c +++ b/arch/arm/mach-imx/mach-imx6sx.c @@ -190,6 +190,27 @@ static void __init imx6sx_init_machine(void) imx6sx_qos_init(); } +static void __init imx6sx_opp_init(struct device *cpu_dev) +{ + struct device_node *np; + + np = of_find_node_by_path("/cpus/cpu@0"); + if (!np) { + pr_warn("failed to find cpu0 node\n"); + return; + } + + cpu_dev->of_node = np; + if (of_init_opp_table(cpu_dev)) + pr_warn("failed to init OPP table\n"); + + of_node_put(np); +} + +static struct platform_device imx6sx_cpufreq_pdev = { + .name = "imx6-cpufreq", +}; + static void __init imx6sx_init_late(void) { struct regmap *gpr; @@ -209,6 +230,11 @@ static void __init imx6sx_init_late(void) if (of_machine_is_compatible("fsl,imx6sx-17x17-arm2") || of_machine_is_compatible("fsl,imx6sx-sdb")) imx6sx_arm2_flexcan_fixup(); + + if (IS_ENABLED(CONFIG_ARM_IMX6_CPUFREQ)) { + imx6sx_opp_init(&imx6sx_cpufreq_pdev.dev); + platform_device_register(&imx6sx_cpufreq_pdev); + } } static void __init imx6sx_map_io(void) -- cgit v1.2.2