ARM: dts: imx6sl: Adding cpu frequency table
Subsystems (10)
PATCH 1/4 ARM: dts: imx6sl: Adding cpu frequency table
Device tree for iMX6SL doesn't have an existing cpu frequency table.
--- arch/arm/boot/dts/imx6sl.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/arm/boot/dts/imx6sl.dtsi +15 -0
@@ -38,6 +38,21 @@ device_type = "cpu"; reg = <0x0>; next-level-cache = <&L2>; + operating-points = < + /* kHz uV */ + 996000 1275000 + 792000 1175000 + 396000 975000 + >; + clock-latency = <61036>; /* two CLK32 periods */ + clocks = <&clks IMX6SL_CLK_ARM>, <&clks IMX6SL_CLK_PLL2_PFD2>, + <&clks IMX6SL_CLK_STEP>, <&clks IMX6SL_CLK_PLL1_SW>, + <&clks IMX6SL_CLK_PLL1_SYS>; + clock-names = "arm", "pll2_pfd2_396m", "step", + "pll1_sw", "pll1_sys"; + arm-supply = <®_arm>; + pu-supply = <®_pu>; + soc-supply = <®_soc>; }; };
Signature · 1 line
1.8.3.2
PATCH 2/4 ARM: imx: Add cpu frequency scaling support
Re-using iMX6Q driver for cpu frequency scaling.
--- arch/arm/mach-imx/mach-imx6sl.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mach-imx6sl.c +12 -1
@@ -8,7 +8,6 @@*/ #include <linux/irqchip.h> -#include <linux/of.h> #include <linux/of_platform.h> #include <linux/mfd/syscon.h> #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
@@ -34,6 +33,17 @@ static void __init imx6sl_fec_init(void) } } +static struct platform_device imx6q_cpufreq_pdev = { + .name ="imx6q-cpufreq" , +}; + +static void __init imx6sl_init_late (void ) +{ +if (IS_ENABLED (CONFIG_ARM_IMX6Q_CPUFREQ )) { +platform_device_register (&imx6q_cpufreq_pdev); + } +} +static void __init imx6sl_init_machine (void ) {struct device *parent;
@@ -70,6 +80,7 @@ DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)") .map_io = debug_ll_io_init, .init_irq = imx6sl_init_irq, .init_machine = imx6sl_init_machine, + .init_late = imx6sl_init_late, .dt_compat = imx6sl_dt_compat, .restart = mxc_restart,MACHINE_END
Signature · 1 line
1.8.3.2
PATCH 3/4 cpufreq: imx6q: add of_init_opp_table
In reply to John TobiasAdd a routine check to see if the the platform supplied the OPP table. Incase there's no OPP table exist, it will try to initialise it.
--- drivers/cpufreq/imx6q-cpufreq.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/cpufreq/imx6q-cpufreq.c +12 -0
@@ -151,6 +151,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) {struct device_node *np;struct dev_pm_opp *opp; +struct device_opp *tmp_dev_opp;unsigned long min_volt, max_volt;int num, ret;
@@ -166,6 +167,17 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)return -ENOENT ; } +/* Get the OPP table, if the platform did not supply it. */ + tmp_dev_opp =find_device_opp (cpu_dev); +if (IS_ERR (tmp_dev_opp)) { + ret =of_init_opp_table (cpu_dev); +if (ret <0 ) { +dev_err (cpu_dev,"failed to init OPP table\n" ); + ret = -ENODEV ; + goto put_node; + } + } + arm_clk =devm_clk_get (cpu_dev,"arm" ); pll1_sys_clk =devm_clk_get (cpu_dev,"pll1_sys" ); pll1_sw_clk =devm_clk_get (cpu_dev,"pll1_sw" );
Signature · 1 line
1.8.3.2
PATCH 4/4 PM / OPP: export symbol find_device_opp
In reply to John Tobiasimx6q-cpufreq.c need to have access to find_device_opp function, in order to verify if the platform supplied an OPP table or not.
As an example here are the imx6q and imx6sl.
imx6q supplied the opp table due to some board specific requirement. While, imx6sl doesn't have an opp table defined.
--- drivers/base/power/opp.c | 3 ++- include/linux/pm_opp.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/base/power/opp.c +2 -1
@@ -116,7 +116,7 @@ static DEFINE_MUTEX(dev_opp_list_lock);* is a RCU protected pointer. This means that device_opp is valid as long * as we are under RCU lock. */ -static struct device_opp *find_device_opp (struct device *dev) +struct device_opp *find_device_opp (struct device *dev) {struct device_opp *tmp_dev_opp, *dev_opp =ERR_PTR (-ENODEV );
@@ -134,6 +134,7 @@ static struct device_opp *find_device_opp(struct device *dev)return dev_opp; } +EXPORT_SYMBOL_GPL (find_device_opp);/** * dev_pm_opp_get_voltage() - Gets the voltage corresponding to an available opp
include/linux/pm_opp.h +7 -0
@@ -27,6 +27,8 @@ enum dev_pm_opp_event {#if defined(CONFIG_PM_OPP ) +struct device_opp *find_device_opp (struct device *dev); +unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp *opp);unsigned long dev_pm_opp_get_freq (struct dev_pm_opp *opp);
@@ -52,6 +54,11 @@ int dev_pm_opp_disable(struct device *dev, unsigned long freq);struct srcu_notifier_head *dev_pm_opp_get_notifier (struct device *dev);#else +static inline struct device_opp *find_device_opp (struct device *dev) +{ +return ERR_PTR (-EINVAL ); +} +static inline unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp *opp) {return 0 ;
Signature · 1 line
1.8.3.2
PATCH 1/4 ARM: dts: imx6sl: Adding cpu frequency table
In reply to John TobiasQuoted 12 lines · John Tobias
Device tree for iMX6SL doesn't have an existing cpu frequency table.
Signed-off-by John Tobias <[email protected]>--- arch/arm/boot/dts/imx6sl.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)arch/arm/boot/dts/imx6sl.dtsi +0
-0
arch/arm/boot/dts/imx6sl.dtsi line 46
Quoted 9 lines
arch/arm/boot/dts/imx6sl.dtsi +6
-0@@ -38,6 +38,21 @@ device_type = "cpu"; reg = <0x0>; next-level-cache = <&L2>; + operating-points = < + /* kHz uV */ + 996000 1275000 + 792000 1175000 + 396000 975000 + >;
Anson is pushing VDDSOC/PU voltage settings upstream. We may want to add the following VDDSOC/PU operating-points as well.
fsl,soc-operating-points = < /* ARM kHz SOC-PU uV */ 996000 1225000 792000 1175000 396000 1175000 >;
Shawn
Quoted 15 lines
arch/arm/boot/dts/imx6sl.dtsi +9
-0+ clock-latency = <61036>; /* two CLK32 periods */ + clocks = <&clks IMX6SL_CLK_ARM>, <&clks IMX6SL_CLK_PLL2_PFD2>, + <&clks IMX6SL_CLK_STEP>, <&clks IMX6SL_CLK_PLL1_SW>, + <&clks IMX6SL_CLK_PLL1_SYS>; + clock-names = "arm", "pll2_pfd2_396m", "step", + "pll1_sw", "pll1_sys"; + arm-supply = <®_arm>; + pu-supply = <®_pu>; + soc-supply = <®_soc>; }; };Signature · 1 line
1.8.3.2
PATCH 2/4 ARM: imx: Add cpu frequency scaling support
In reply to John TobiasQuoted 12 lines · John Tobias
Re-using iMX6Q driver for cpu frequency scaling.
Signed-off-by John Tobias <[email protected]>--- arch/arm/mach-imx/mach-imx6sl.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm/mach-imx/mach-imx6sl.c +0
-0
arch/arm/mach-imx/mach-imx6sl.c line 11
Quoted 4 lines
arch/arm/mach-imx/mach-imx6sl.c +0
-1@@ -8,7 +8,6 @@*/ #include <linux/irqchip.h> -#include <linux/of.h>
This is an unrelated change to the patch.
Quoted 4 lines
arch/arm/mach-imx/mach-imx6sl.c +0
-0#include <linux/of_platform.h> #include <linux/mfd/syscon.h> #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
arch/arm/mach-imx/mach-imx6sl.c static void __init imx6sl_fec_init(void) · line 42
Quoted 10 lines
arch/arm/mach-imx/mach-imx6sl.c +7
-0@@ -34,6 +33,17 @@ static void __init imx6sl_fec_init(void) } } +static struct platform_device imx6q_cpufreq_pdev = { + .name ="imx6q-cpufreq" , +}; + +static void __init imx6sl_init_late (void ) +{ +if (IS_ENABLED (CONFIG_ARM_IMX6Q_CPUFREQ )) {
Unnecessary braces.
arch/arm/mach-imx/mach-imx6sl.c static void __init imx6sl_fec_init(void) · line 43
Quoted 1 line
arch/arm/mach-imx/mach-imx6sl.c +1
-0+platform_device_register (&imx6q_cpufreq_pdev);
Register the device in the following way will save imx6q_cpufreq_pdev.
platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);Shawn
Quoted 17 lines
arch/arm/mach-imx/mach-imx6sl.c +4
-0+ } +} +static void __init imx6sl_init_machine (void ) {struct device *parent;@@ -70,6 +80,7 @@ DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)") .map_io = debug_ll_io_init, .init_irq = imx6sl_init_irq, .init_machine = imx6sl_init_machine, + .init_late = imx6sl_init_late, .dt_compat = imx6sl_dt_compat, .restart = mxc_restart,MACHINE_END Signature · 1 line
1.8.3.2
PATCH 4/4 PM / OPP: export symbol find_device_opp
In reply to John TobiasQuoted 2 lines · John Tobias
imx6q-cpufreq.cneed to have access tofind_device_oppfunction, in order to verify if the platform supplied an OPP table or not.
I think we can figure it out by checking the return of dev_pm_opp_get_opp_count() call, so that we can save this patch completely.
Note, imx6q-cpufreq driver already calls dev_pm_opp_get_opp_count(). You need to change the way how it handles the return.
Shawn
Quoted 60 lines
As an example here are the imx6q and imx6sl.
imx6q supplied the opp table due to some board specific requirement. While, imx6sl doesn't have an opp table defined.Signed-off-by John Tobias <[email protected]>--- drivers/base/power/opp.c | 3 ++- include/linux/pm_opp.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)drivers/base/power/opp.c +2
-1@@ -116,7 +116,7 @@ static DEFINE_MUTEX(dev_opp_list_lock);* is a RCU protected pointer. This means that device_opp is valid as long * as we are under RCU lock. */ -static struct device_opp *find_device_opp (struct device *dev) +struct device_opp *find_device_opp (struct device *dev) {struct device_opp *tmp_dev_opp, *dev_opp =ERR_PTR (-ENODEV );@@ -134,6 +134,7 @@ static struct device_opp *find_device_opp(struct device *dev)return dev_opp; } +EXPORT_SYMBOL_GPL (find_device_opp);/** * dev_pm_opp_get_voltage() - Gets the voltage corresponding to an available opp include/linux/pm_opp.h +7
-0@@ -27,6 +27,8 @@ enum dev_pm_opp_event {#if defined(CONFIG_PM_OPP ) +struct device_opp *find_device_opp (struct device *dev); +unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp *opp);unsigned long dev_pm_opp_get_freq (struct dev_pm_opp *opp);@@ -52,6 +54,11 @@ int dev_pm_opp_disable(struct device *dev, unsigned long freq);struct srcu_notifier_head *dev_pm_opp_get_notifier (struct device *dev);#else +static inline struct device_opp *find_device_opp (struct device *dev) +{ +return ERR_PTR (-EINVAL ); +} +static inline unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp *opp) {return 0 ;Signature · 1 line
1.8.3.2
PATCH 2/4 ARM: imx: Add cpu frequency scaling support
In reply to Shawn GuoThanks for checking again. I should carefully check the unnecessary braces and exercise the tools available in script.
Will re-submit again tomorrow.
Regards,
john
Quoted 63 lines · Shawn Guo
Quoted 12 lines · John Tobias
Re-using iMX6Q driver for cpu frequency scaling.
Signed-off-by John Tobias <[email protected]>--- arch/arm/mach-imx/mach-imx6sl.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm/mach-imx/mach-imx6sl.c +0
-0arch/arm/mach-imx/mach-imx6sl.c line 11
Quoted 4 lines
arch/arm/mach-imx/mach-imx6sl.c +0
-1@@ -8,7 +8,6 @@*/ #include <linux/irqchip.h> -#include <linux/of.h> This is an unrelated change to the patch.
Quoted 4 lines
arch/arm/mach-imx/mach-imx6sl.c +0
-0#include <linux/of_platform.h> #include <linux/mfd/syscon.h> #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> arch/arm/mach-imx/mach-imx6sl.c static void __init imx6sl_fec_init(void) · line 42
Quoted 10 lines
arch/arm/mach-imx/mach-imx6sl.c +7
-0@@ -34,6 +33,17 @@ static void __init imx6sl_fec_init(void) } } +static struct platform_device imx6q_cpufreq_pdev = { + .name ="imx6q-cpufreq" , +}; + +static void __init imx6sl_init_late (void ) +{ +if (IS_ENABLED (CONFIG_ARM_IMX6Q_CPUFREQ )) {Unnecessary braces.
arch/arm/mach-imx/mach-imx6sl.c static void __init imx6sl_fec_init(void) · line 43
Quoted 1 line
arch/arm/mach-imx/mach-imx6sl.c +1
-0+platform_device_register (&imx6q_cpufreq_pdev);Register the device in the following way will save
imx6q_cpufreq_pdev.platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);Shawn
Quoted 17 lines
arch/arm/mach-imx/mach-imx6sl.c +4
-1+ } +} +static void __init imx6sl_init_machine (void ) {struct device *parent;@@ -70,6 +80,7 @@ DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)") .map_io = debug_ll_io_init, .init_irq = imx6sl_init_irq, .init_machine = imx6sl_init_machine, + .init_late = imx6sl_init_late, .dt_compat = imx6sl_dt_compat, .restart = mxc_restart,MACHINE_END --1.8.3.2
PATCH 4/4 PM / OPP: export symbol find_device_opp
In reply to Shawn GuoMy first implementation was to call dev_pm_opp_get_opp_count. But, looking at the opp.c code, find_device_opp
was the most relevant function than dev_pm_opp_get_opp_count. I will re-submit the patch using dev_pm_opp_get_opp_count.
Thanks,
john
Quoted 74 lines · Shawn Guo
Quoted 2 lines · John Tobias
imx6q-cpufreq.cneed to have access tofind_device_oppfunction, in order to verify if the platform supplied an OPP table or not.I think we can figure it out by checking the return of
dev_pm_opp_get_opp_count()call, so that we can save this patch completely.Note, imx6q-cpufreq driver already calls
dev_pm_opp_get_opp_count(). You need to change the way how it handles the return.Shawn
Quoted 60 lines
As an example here are the imx6q and imx6sl.
imx6q supplied the opp table due to some board specific requirement. While, imx6sl doesn't have an opp table defined.Signed-off-by John Tobias <[email protected]>--- drivers/base/power/opp.c | 3 ++- include/linux/pm_opp.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)drivers/base/power/opp.c +2
-1@@ -116,7 +116,7 @@ static DEFINE_MUTEX(dev_opp_list_lock);* is a RCU protected pointer. This means that device_opp is valid as long * as we are under RCU lock. */ -static struct device_opp *find_device_opp (struct device *dev) +struct device_opp *find_device_opp (struct device *dev) {struct device_opp *tmp_dev_opp, *dev_opp =ERR_PTR (-ENODEV );@@ -134,6 +134,7 @@ static struct device_opp *find_device_opp(struct device *dev)return dev_opp; } +EXPORT_SYMBOL_GPL (find_device_opp);/** * dev_pm_opp_get_voltage() - Gets the voltage corresponding to an available opp include/linux/pm_opp.h +7
-1@@ -27,6 +27,8 @@ enum dev_pm_opp_event {#if defined(CONFIG_PM_OPP ) +struct device_opp *find_device_opp (struct device *dev); +unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp *opp);unsigned long dev_pm_opp_get_freq (struct dev_pm_opp *opp);@@ -52,6 +54,11 @@ int dev_pm_opp_disable(struct device *dev, unsigned long freq);struct srcu_notifier_head *dev_pm_opp_get_notifier (struct device *dev);#else +static inline struct device_opp *find_device_opp (struct device *dev) +{ +return ERR_PTR (-EINVAL ); +} +static inline unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp *opp) {return 0 ; --1.8.3.2
PATCH 1/4 ARM: dts: imx6sl: Adding cpu frequency table
In reply to Shawn GuoGreat! I will add it.
John
Quoted 51 lines · Shawn Guo
Quoted 12 lines · John Tobias
Device tree for iMX6SL doesn't have an existing cpu frequency table.
Signed-off-by John Tobias <[email protected]>--- arch/arm/boot/dts/imx6sl.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)arch/arm/boot/dts/imx6sl.dtsi +0
-0arch/arm/boot/dts/imx6sl.dtsi line 46
Quoted 9 lines
arch/arm/boot/dts/imx6sl.dtsi +6
-0@@ -38,6 +38,21 @@ device_type = "cpu"; reg = <0x0>; next-level-cache = <&L2>; + operating-points = < + /* kHz uV */ + 996000 1275000 + 792000 1175000 + 396000 975000 + >;Anson is pushing VDDSOC/PU voltage settings upstream. We may want to add the following VDDSOC/PU operating-points as well.
fsl,soc-operating-points = < /* ARM kHz SOC-PU uV */ 996000 1225000 792000 1175000 396000 1175000 >;Shawn
Quoted 15 lines
arch/arm/boot/dts/imx6sl.dtsi +9
-1+ clock-latency = <61036>; /* two CLK32 periods */ + clocks = <&clks IMX6SL_CLK_ARM>, <&clks IMX6SL_CLK_PLL2_PFD2>, + <&clks IMX6SL_CLK_STEP>, <&clks IMX6SL_CLK_PLL1_SW>, + <&clks IMX6SL_CLK_PLL1_SYS>; + clock-names = "arm", "pll2_pfd2_396m", "step", + "pll1_sw", "pll1_sys"; + arm-supply = <®_arm>; + pu-supply = <®_pu>; + soc-supply = <®_soc>; }; }; --1.8.3.2