Skip to contentSkip to conversation

ARM: dts: imx6sl: Adding cpu frequency and VDDSOC/PU table.

PATCH New John Tobias 2 participants 8 messages Dec 19, 2013 – Dec 20, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 ARM: dts: imx6sl: Adding cpu frequency and VDDSOC/PU table.

Device tree for iMX6SL doesn't have an existing cpu frequency table as well as the VDDSOC/PU.

---
 arch/arm/boot/dts/imx6sl.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm/boot/dts/imx6sl.dtsi +21 -0
index 28558f1..d097f76 100644
@@ -38,6 +38,27 @@
 			device_type = "cpu";
 			reg = <0x0>;
 			next-level-cache = <&L2>;
+			operating-points = <
+				/* kHz    uV */
+				996000  1275000
+				792000  1175000
+				396000  975000
+			>;
+			fsl,soc-operating-points = <
+				/* ARM kHz      SOC-PU uV */
+				996000          1225000
+				792000          1175000
+				396000          1175000
+			>;
+			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 = <&reg_arm>;
+			pu-supply = <&reg_pu>;
+			soc-supply = <&reg_soc>;
 		};
 	};
 
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v2 2/3 ARM: imx: Add cpu frequency scaling support

Re-using iMX6Q driver for cpu frequency scaling.

---
 arch/arm/mach-imx/mach-imx6sl.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-imx/mach-imx6sl.c +7 -0
index 2f952e3..2ba3a7a 100644
@@ -34,6 +34,12 @@ static void __init imx6sl_fec_init(void)
 	}
 }
 
+static void __init imx6sl_init_late(void)
+{
+	if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
+		platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
+}
+
 static void __init imx6sl_init_machine(void)
 {
 	struct device *parent;
@@ -70,6 +76,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
#2 lore raw

PATCH v2 2/3 ARM: imx: Add cpu frequency scaling support

Quoted 12 lines · John Tobias

Re-using iMX6Q driver for cpu frequency scaling.

---
 arch/arm/mach-imx/mach-imx6sl.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-imx/mach-imx6sl.c +0 -0
index 2f952e3..2ba3a7a 100644

arch/arm/mach-imx/mach-imx6sl.c static void __init imx6sl_fec_init(void) · line 38

Quoted 5 lines
arch/arm/mach-imx/mach-imx6sl.c +2 -0
@@ -34,6 +34,12 @@ static void __init imx6sl_fec_init(void)
 	}
 }
 
+static void __init imx6sl_init_late(void)
+{

I added a comment below and changed patch subject prefix to be 'ARM:
imx6sl: ', and then applied the patch.

	/* imx6sl reuses imx6q cpufreq driver */

Shawn

Quoted 18 lines
arch/arm/mach-imx/mach-imx6sl.c +5 -0
+	if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
+		platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
+}
+
 static void __init imx6sl_init_machine(void)
 {
 	struct device *parent;
@@ -70,6 +76,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
#3 lore raw

PATCH v2 3/3 cpufreq: imx6q: add of_init_opp_table

In reply to John Tobias

Add a routine check to see if the platform supplied the OPP table. Incase there's no OPP table exist, it will try to initialise it.

It's been tested on iMX6SL board where the platform doesn't have an OPP table.

---
 drivers/cpufreq/imx6q-cpufreq.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/cpufreq/imx6q-cpufreq.c +11 -0
index 4b3f18e..8c56898 100644
@@ -166,6 +166,17 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
+	/* Get the OPP table, if the platform did not supply it. */
+	num = dev_pm_opp_get_opp_count(cpu_dev);
+	if (num < 0) {
+		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
#4 lore raw

PATCH v2 3/3 cpufreq: imx6q: add of_init_opp_table

Quoted 20 lines · John Tobias

Add a routine check to see if the platform supplied the OPP table. Incase there's no OPP table exist, it will try to initialise it.

It's been tested on iMX6SL board where the platform doesn't have an OPP table.

---
 drivers/cpufreq/imx6q-cpufreq.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/cpufreq/imx6q-cpufreq.c +1 -0
index 4b3f18e..8c56898 100644
@@ -166,6 +166,17 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
+	/* Get the OPP table, if the platform did not supply it. */

drivers/cpufreq/imx6q-cpufreq.c static int imx6q_cpufreq_probe(struct platform_device *pdev) · line 179

Quoted 10 lines
drivers/cpufreq/imx6q-cpufreq.c +10 -0
+	num = dev_pm_opp_get_opp_count(cpu_dev);
+	if (num < 0) {
+		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;
+		}
+	}
+

Oh, no. dev_pm_opp_get_opp_count() is already being called in imx6q_cpufreq_probe(). Why don't you just plug your code into there?

Shawn

Quoted 6 lines
drivers/cpufreq/imx6q-cpufreq.c +0 -0
 	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
#5 lore raw

PATCH v2 3/3 cpufreq: imx6q: add of_init_opp_table

That's correct. I tested it. I will send another patch.

Quoted 44 lines · Shawn Guo
Quoted 20 lines · John Tobias

Add a routine check to see if the platform supplied the OPP table. Incase there's no OPP table exist, it will try to initialise it.

It's been tested on iMX6SL board where the platform doesn't have an OPP table.

---
 drivers/cpufreq/imx6q-cpufreq.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/cpufreq/imx6q-cpufreq.c +1 -0
index 4b3f18e..8c56898 100644
@@ -166,6 +166,17 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
              return -ENOENT;
      }
 
+     /* Get the OPP table, if the platform did not supply it. */

drivers/cpufreq/imx6q-cpufreq.c static int imx6q_cpufreq_probe(struct platform_device *pdev) · line 179

Quoted 10 lines
drivers/cpufreq/imx6q-cpufreq.c +10 -0
+     num = dev_pm_opp_get_opp_count(cpu_dev);
+     if (num < 0) {
+             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;
+             }
+     }
+

Oh, no. dev_pm_opp_get_opp_count() is already being called in imx6q_cpufreq_probe(). Why don't you just plug your code into there?

Shawn

Quoted 6 lines
drivers/cpufreq/imx6q-cpufreq.c +0 -1
      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");
--

1.8.3.2

#6 lore raw

PATCH v2 3/3 cpufreq: imx6q: add of_init_opp_table

In reply to John Tobias
Quoted 9 lines · John Tobias

Add a routine check to see if the platform supplied the OPP table. Incase there's no OPP table exist, it will try to initialise it.

It's been tested on iMX6SL board where the platform doesn't have an OPP table.

---
 drivers/cpufreq/imx6q-cpufreq.c | 11 +++++++++++

Running get_maintainer.pl on the patch, you will see you should copy the following person and lists on the patch.

"Rafael J. Wysocki" <[email protected]>
Viresh Kumar <[email protected]>
cpufreq at vger.kernel.org
linux-pm at vger.kernel.org

This can also be found in file MAINTAINERS.

CPU FREQUENCY DRIVERS

M:      Rafael J. Wysocki <[email protected]>
M:      Viresh Kumar <[email protected]>
L:      cpufreq at vger.kernel.org
L:      linux-pm at vger.kernel.org
S:      Maintained
T:      git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
T:      git git://git.linaro.org/people/vireshk/linux.git (For ARM Updates)
F:      drivers/cpufreq/
F:      include/linux/cpufreq.h

Shawn

Quoted 27 lines
 1 file changed, 11 insertions(+)
drivers/cpufreq/imx6q-cpufreq.c +11 -0
index 4b3f18e..8c56898 100644
@@ -166,6 +166,17 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
+	/* Get the OPP table, if the platform did not supply it. */
+	num = dev_pm_opp_get_opp_count(cpu_dev);
+	if (num < 0) {
+		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