Skip to contentSkip to conversation

ARM: OMAP3+: support cpufreq-cpu0 for device tree boot

PATCH In review Nishanth Menon 4 participants 12 messages Oct 16, 2013 – Dec 23, 2013

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

v7 cover ARM: OMAP3+: support cpufreq-cpu0 for device tree boot

Hi,

This series enables the use of cpufreq-cpu0 generic driver for all OMAP and related derivatives. Only patch#8 in the series, which introduces CPU clock nodes, depends on Tero's V8 patch series for clock nodes[1]

I will stop copy pasting the series complete history and point at [2].

Main changes since V6[3]:
- squashed patches for a minimal set
- i have organized the series such that 1 to 7 can immediately be merged if desired:
- patches 1,2,3 can go to Tony's omap-for-v3.13/quirk [4]
- patches 4-7 can go to Benoit's for_3.13/dts [5]
- patch 8 needs to depend on [1] and should eventually go to [5]

NOTES: obviously without clock nodes cpufreq will not function.

Test Script: http://pastebin.com/VvJPjsne

Test-log:
BeagleBoard-XM (OMAP36xx): http://pastebin.com/XZDNaHPf
PandaBoard-ES (OMAP4460): http://pastebin.com/qQCmA2ng
BeagleBone-Black(AM335x): http://pastebin.com/98FX4uYW
OMAP5uEVM (OMAP5432): http://pastebin.com/NXj3L636
DRA7-EVM (DRA7xx): http://pastebin.com/0kKT3TXy

J Keerthy (3):
ARM: dts: dra7-evm: add smps123 supply for CPU
ARM: dts: OMAP5: Add CPU OPP table
ARM: dts: DRA7: Add CPU OPP table

Nishanth Menon (5):
ARM: OMAP3+: do not register non-dt OPP tables for device tree boot
ARM: OMAP2+: add missing lateinit hook for calling pm late init
ARM: OMAP3+: use cpu0-cpufreq driver in device tree supported boot
ARM: dts: omap5-uevm: add smps123 supply for CPU
ARM: dts: OMAP3: add clock nodes for CPU

[1] http://marc.info/?t=138133284200006&r=1&w=2
[2] http://marc.info/?l=linux-arm-kernel&m=136804009618594&w=2
[3] http://marc.info/?l=devicetree&m=138135419203492&w=2
[4] https://git.kernel.org/cgit/linux/kernel/git/tmlind/linux-omap.git/log/?h=omap-for-v3.13/quirk

 arch/arm/boot/dts/am33xx.dtsi       |    4 ++++
 arch/arm/boot/dts/dra7-evm.dts      |    4 ++++
 arch/arm/boot/dts/dra7.dtsi         |   13 ++++++++++++-
 arch/arm/boot/dts/omap3.dtsi        |    5 +++++
 arch/arm/boot/dts/omap4.dtsi        |    5 +++++
 arch/arm/boot/dts/omap5-uevm.dts    |    4 ++++
 arch/arm/boot/dts/omap5.dtsi        |   15 ++++++++++++++-
 arch/arm/mach-omap2/board-generic.c |    4 ++++
 arch/arm/mach-omap2/common.h        |    4 ++++
 arch/arm/mach-omap2/io.c            |   20 ++++++++++++++++++++
 arch/arm/mach-omap2/opp.c           |    4 ++++
 arch/arm/mach-omap2/pm.c            |   12 +++++++++---
 12 files changed, 89 insertions(+), 5 deletions(-)

Regards,
Nishanth Menon

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v7 1/8 ARM: OMAP3+: do not register non-dt OPP tables for device tree boot

OMAP3+ supports both device tree and non-device tree boot. Device tree bindings for OMAP3+ is supposed to be added via dts following:
Documentation/devicetree/bindings/power/opp.txt

Since we now have device tree entries for OMAP3+ cpu OPPs, The current code wrongly adds duplicate OPPs. So, dont register OPPs when booting using device tree.

---
 arch/arm/mach-omap2/opp.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/mach-omap2/opp.c +4 -0
index bd41d59..82fd8c7 100644
@@ -17,6 +17,7 @@
  * GNU General Public License for more details.
  */
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/opp.h>
 #include <linux/cpu.h>
 
@@ -40,6 +41,9 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
 {
 	int i, r;
 
+	if (of_have_populated_dt())
+		return -EINVAL;
+
 	if (!opp_def || !opp_def_size) {
 		pr_err("%s: invalid params!\n", __func__);
 		return -EINVAL;
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v7 2/8 ARM: OMAP2+: add missing lateinit hook for calling pm late init

In reply to Nishanth Menon

AM335x, AM43xx, OMAP5 and DRA7 have missing late init hook. Introduce SoC specific hook with a call to OMAP2+ generic lateinit hook. This allows the generic late initializations such as cpufreq hooks to be active.

Based on out-of-tree patches that need to be introduced in mainline, this introduction allows us to provide the foundation for further SoC specific features as they are developed.

Cc Benoit Cousson <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Tony Lindgren <[email protected]>
---
 arch/arm/mach-omap2/board-generic.c |    4 ++++
 arch/arm/mach-omap2/common.h        |    4 ++++
 arch/arm/mach-omap2/io.c            |   20 ++++++++++++++++++++
 3 files changed, 28 insertions(+)
arch/arm/mach-omap2/board-generic.c +4 -0
index 3017a9d..e366064 100644
@@ -128,6 +128,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
 	.init_irq	= omap_intc_of_init,
 	.handle_irq	= omap3_intc_handle_irq,
 	.init_machine	= omap_generic_init,
+	.init_late	= am33xx_init_late,
 	.init_time	= omap3_gptimer_timer_init,
 	.dt_compat	= am33xx_boards_compat,
 	.restart	= am33xx_restart,
@@ -167,6 +168,7 @@ DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
 	.init_early	= omap5_init_early,
 	.init_irq	= omap_gic_of_init,
 	.init_machine	= omap_generic_init,
+	.init_late	= omap5_init_late,
 	.init_time	= omap5_realtime_timer_init,
 	.dt_compat	= omap5_boards_compat,
 	.restart	= omap44xx_restart,
@@ -182,6 +184,7 @@ static const char *am43_boards_compat[] __initdata = {
 DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
 	.map_io		= am33xx_map_io,
 	.init_early	= am43xx_init_early,
+	.init_late	= am43xx_init_late,
 	.init_irq	= omap_gic_of_init,
 	.init_machine	= omap_generic_init,
 	.init_time	= omap3_sync32k_timer_init,
@@ -200,6 +203,7 @@ DT_MACHINE_START(DRA7XX_DT, "Generic DRA7XX (Flattened Device Tree)")
 	.smp		= smp_ops(omap4_smp_ops),
 	.map_io		= omap5_map_io,
 	.init_early	= dra7xx_init_early,
+	.init_late	= dra7xx_init_late,
 	.init_irq	= omap_gic_of_init,
 	.init_machine	= omap_generic_init,
 	.init_time	= omap5_realtime_timer_init,
arch/arm/mach-omap2/common.h +4 -0
index c6aebf0..f7644fe 100644
@@ -98,6 +98,7 @@ void am35xx_init_early(void);
 void ti81xx_init_early(void);
 void am33xx_init_early(void);
 void am43xx_init_early(void);
+void am43xx_init_late(void);
 void omap4430_init_early(void);
 void omap5_init_early(void);
 void omap3_init_late(void);	/* Do not use this one */
@@ -109,8 +110,11 @@ void omap35xx_init_late(void);
 void omap3630_init_late(void);
 void am35xx_init_late(void);
 void ti81xx_init_late(void);
+void am33xx_init_late(void);
+void omap5_init_late(void);
 int omap2_common_pm_late_init(void);
 void dra7xx_init_early(void);
+void dra7xx_init_late(void);
 
 #ifdef CONFIG_SOC_BUS
 void omap_soc_device_init(void);
arch/arm/mach-omap2/io.c +20 -0
index ff2113c..a2cbb44 100644
@@ -583,6 +583,11 @@ void __init am33xx_init_early(void)
 	omap_hwmod_init_postsetup();
 	omap_clk_init = am33xx_clk_init;
 }
+
+void __init am33xx_init_late(void)
+{
+	omap_common_late_init();
+}
 #endif
 
 #ifdef CONFIG_SOC_AM43XX
@@ -596,6 +601,11 @@ void __init am43xx_init_early(void)
 	omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
 	omap3xxx_check_revision();
 }
+
+void __init am43xx_init_late(void)
+{
+	omap_common_late_init();
+}
 #endif
 
 #ifdef CONFIG_ARCH_OMAP4
@@ -651,6 +661,11 @@ void __init omap5_init_early(void)
 	omap54xx_hwmod_init();
 	omap_hwmod_init_postsetup();
 }
+
+void __init omap5_init_late(void)
+{
+	omap_common_late_init();
+}
 #endif
 
 #ifdef CONFIG_SOC_DRA7XX
@@ -671,6 +686,11 @@ void __init dra7xx_init_early(void)
 	dra7xx_hwmod_init();
 	omap_hwmod_init_postsetup();
 }
+
+void __init dra7xx_init_late(void)
+{
+	omap_common_late_init();
+}
 #endif
 
 
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v7 3/8 ARM: OMAP3+: use cpu0-cpufreq driver in device tree supported boot

In reply to Nishanth Menon

With OMAP3+ and AM33xx supported SoC having defined CPU device tree entries with operating-points and clock nodes defined, we can now use the SoC generic cpufreq-cpu0 driver by registering appropriate device.

Cc Benoit Cousson <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Tony Lindgren <[email protected]>
---
 arch/arm/mach-omap2/pm.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/pm.c +9 -3
index e742118..360b2da 100644
@@ -266,7 +266,12 @@ static void __init omap4_init_voltages(void)
 
 static inline void omap_init_cpufreq(void)
 {
-	struct platform_device_info devinfo = { .name = "omap-cpufreq", };
+	struct platform_device_info devinfo = { };
+
+	if (!of_have_populated_dt())
+		devinfo.name = "omap-cpufreq";
+	else
+		devinfo.name = "cpufreq-cpu0";
 	platform_device_register_full(&devinfo);
 }
 
@@ -300,10 +305,11 @@ int __init omap2_common_pm_late_init(void)
 		/* Smartreflex device init */
 		omap_devinit_smartreflex();
 
-		/* cpufreq dummy device instantiation */
-		omap_init_cpufreq();
 	}
 
+	/* cpufreq dummy device instantiation */
+	omap_init_cpufreq();
+
 #ifdef CONFIG_SUSPEND
 	suspend_set_ops(&omap_pm_ops);
 #endif
Signature · 1 line
1.7.9.5
maintainer
#4 lore raw

Re: [PATCH V7 3/8] ARM: OMAP3+: use cpu0-cpufreq driver in device tree supported boot

Quoted 3 lines · Nishanth Menon

With OMAP3+ and AM33xx supported SoC having defined CPU device tree entries with operating-points and clock nodes defined, we can now use the SoC generic cpufreq-cpu0 driver by registering appropriate device.

Thanks I'm taking patches 1 - 3 from this series into omap-for-v3.13/board-removal-take2 because of the dependencies.

Tony

#5 lore raw

PATCH v7 4/8 ARM: dts: omap5-uevm: add smps123 supply for CPU

In reply to Nishanth Menon

regulator smps123 supply from Palmas PMIC powers CPU0 on OMAP5uEVM.

Based on a patch by J Keerthy <[email protected]>

---
 arch/arm/boot/dts/omap5-uevm.dts |    4 ++++
 arch/arm/boot/dts/omap5.dtsi     |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap5-uevm.dts +4 -0
index d784b3a..3188511 100644
@@ -503,3 +503,7 @@
         pinctrl-names = "default";
         pinctrl-0 = <&uart5_pins>;
 };
+
+&cpu0 {
+	cpu0-supply = <&smps123_reg>;
+};
arch/arm/boot/dts/omap5.dtsi +1 -1
index 0098a17..40aac32 100644
@@ -33,7 +33,7 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		cpu at 0 {
+		cpu0: cpu at 0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a15";
 			reg = <0x0>;
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH v7 5/8 ARM: dts: dra7-evm: add smps123 supply for CPU

In reply to Nishanth Menon

From: J Keerthy <[email protected]>

regulator smps123 supply from Palmas PMIC powers CPU0 on DRA7 EVM.

[nm at ti.com: rebase to latest]
---
 arch/arm/boot/dts/dra7-evm.dts |    4 ++++
 arch/arm/boot/dts/dra7.dtsi    |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
arch/arm/boot/dts/dra7-evm.dts +4 -0
index 3abf5f4..5babba0 100644
@@ -269,3 +269,7 @@
 	vmmc-supply = <&mmc2_3v3>;
 	bus-width = <8>;
 };
+
+&cpu0 {
+	cpu0-supply = <&smps123_reg>;
+};
arch/arm/boot/dts/dra7.dtsi +1 -1
index c98997b..02e430b 100644
@@ -32,7 +32,7 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		cpu at 0 {
+		cpu0: cpu at 0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a15";
 			reg = <0>;
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH v7 6/8 ARM: dts: OMAP5: Add CPU OPP table

In reply to Nishanth Menon

From: J Keerthy <[email protected]>

Add DT OPP table for OMAP54xx family of devices. This data is decoded by OF with of_init_opp_table() helper function.

The data is based on OMAP543x ES2.0 DM Operating Condition Addendum Version 0.6(April 2013)

NOTE: The voltage and frequency values work well only on NOM samples and are supposed to work properly only with ABB/AVS for ALL OPPs.

TODO: Add SPEED BIN OPP after ABB and AVS support so the cpufreq works on all samples seamlessly. Clock node is pending alignment for clock dts conversion

[nm at ti.com: sync to latest and fixes]
---
 arch/arm/boot/dts/omap5.dtsi |    7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/omap5.dtsi +7 -0
index 40aac32..69874de 100644
@@ -37,6 +37,13 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a15";
 			reg = <0x0>;
+
+			operating-points = <
+				/* kHz    uV */
+				500000  880000
+				1000000 1060000
+				1500000 1250000
+			>;
 		};
 		cpu at 1 {
 			device_type = "cpu";
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH v7 7/8 ARM: dts: DRA7: Add CPU OPP table

In reply to Nishanth Menon

From: J Keerthy <[email protected]>

Add DT OPP table for DRA7xx family of devices. This data is decoded by OF with of_init_opp_table() helper function.

The data is based on DRA75x, DRA74x Data Manual revision F (Sept 2013).

TODO: add OPP_HIGH after AVS-Class0 is functional
NOTE: The voltage and frequency values work well only on NOM samples and it is mandatory to use ABB/AVS Class 0 support for all OPPs.

Clock nodes are pending clock node alignment.

[nm at ti.com: cleanups and rebase to latest]
---
 arch/arm/boot/dts/dra7.dtsi |    6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/dra7.dtsi +6 -0
index 02e430b..92cbe3b 100644
@@ -36,6 +36,12 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a15";
 			reg = <0>;
+
+			operating-points = <
+				/* kHz    uV */
+				1000000	1060000
+				1176000	1160000
+				>;
 		};
 		cpu at 1 {
 			device_type = "cpu";
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH v7 8/8 ARM: dts: OMAP3: add clock nodes for CPU

In reply to Nishanth Menon

OMAP34xx and OMAP36xx platforms use dpll1 clock. Add same to common definition.

AM33XX, OMAP443x, OMAP446x and OMAP447x platforms use dpll_mpu clock Add same to common definition.

OMAP5, DRA7 platforms use dpll_mpu_ck clock for CPU. Add same to common definition.

Cc Benoit Cousson <[email protected]>
[nm at ti.com: keep in sync with clock node changes]
[j-keerthy at ti.com: OMAP5 and DRA7 nodes]
---
 arch/arm/boot/dts/am33xx.dtsi |    4 ++++
 arch/arm/boot/dts/dra7.dtsi   |    5 +++++
 arch/arm/boot/dts/omap3.dtsi  |    5 +++++
 arch/arm/boot/dts/omap4.dtsi  |    5 +++++
 arch/arm/boot/dts/omap5.dtsi  |    6 ++++++
 5 files changed, 25 insertions(+)
arch/arm/boot/dts/am33xx.dtsi +4 -0
index 2a994d6..09f16a0 100644
@@ -55,6 +55,10 @@
 				275000  1125000
 			>;
 			voltage-tolerance = <2>; /* 2 percentage */
+
+			clocks = <&dpll_mpu_ck>;
+			clock-names = "cpu";
+
 			clock-latency = <300000>; /* From omap-cpufreq driver */
 		};
 	};
arch/arm/boot/dts/dra7.dtsi +5 -0
index 92cbe3b..e723b52 100644
@@ -42,6 +42,11 @@
 				1000000	1060000
 				1176000	1160000
 				>;
+
+			clocks = <&dpll_mpu_ck>;
+			clock-names = "cpu";
+
+			clock-latency = <300000>; /* From omap-cpufreq driver */
 		};
 		cpu at 1 {
 			device_type = "cpu";
arch/arm/boot/dts/omap3.dtsi +5 -0
index 7f5d8a8..4f3778a 100644
@@ -32,6 +32,11 @@
 			compatible = "arm,cortex-a8";
 			device_type = "cpu";
 			reg = <0x0>;
+
+			clocks = <&dpll1_ck>;
+			clock-names = "cpu";
+
+			clock-latency = <300000>; /* From omap-cpufreq driver */
 		};
 	};
 
arch/arm/boot/dts/omap4.dtsi +5 -0
index 17a3618..decff2a 100644
@@ -32,6 +32,11 @@
 			device_type = "cpu";
 			next-level-cache = <&L2>;
 			reg = <0x0>;
+
+			clocks = <&dpll_mpu_ck>;
+			clock-names = "cpu";
+
+			clock-latency = <300000>; /* From omap-cpufreq driver */
 		};
 		cpu at 1 {
 			compatible = "arm,cortex-a9";
arch/arm/boot/dts/omap5.dtsi +6 -0
index 69874de..e18ee7e 100644
@@ -44,6 +44,12 @@
 				1000000 1060000
 				1500000 1250000
 			>;
+
+			clocks = <&dpll_mpu_ck>;
+			clock-names = "cpu";
+
+			clock-latency = <300000>; /* From omap-cpufreq driver */
+
 		};
 		cpu at 1 {
 			device_type = "cpu";
Signature · 1 line
1.7.9.5
#10 lore raw
In reply to Nishanth Menon

Hi Nishanth,

Quoted 7 lines · Nishanth Menon

Hi,

This series enables the use of cpufreq-cpu0 generic driver for all OMAP and related derivatives. Only patch#8 in the series, which introduces CPU clock nodes, depends on Tero's V8 patch series for clock nodes[1]

Quoted 8 lines

I will stop copy pasting the series complete history and point at [2].

Main changes since V6[3]:
- squashed patches for a minimal set
- i have organized the series such that 1 to 7 can immediately be merged if desired:
- patches 1,2,3 can go to Tony's omap-for-v3.13/quirk [4]
- patches 4-7 can go to Benoit's for_3.13/dts [5]

I've just applied them in my DTS tree.

Thanks,
Benoit

Quoted 47 lines

- patch 8 needs to depend on [1] and should eventually go to [5]

NOTES: obviously without clock nodes cpufreq will not function.

Test Script: http://pastebin.com/VvJPjsne

Test-log:
BeagleBoard-XM (OMAP36xx): http://pastebin.com/XZDNaHPf
PandaBoard-ES (OMAP4460): http://pastebin.com/qQCmA2ng
BeagleBone-Black(AM335x): http://pastebin.com/98FX4uYW
OMAP5uEVM (OMAP5432): http://pastebin.com/NXj3L636
DRA7-EVM (DRA7xx): http://pastebin.com/0kKT3TXy

J Keerthy (3):
ARM: dts: dra7-evm: add smps123 supply for CPU
ARM: dts: OMAP5: Add CPU OPP table
ARM: dts: DRA7: Add CPU OPP table

Nishanth Menon (5):
ARM: OMAP3+: do not register non-dt OPP tables for device tree boot
ARM: OMAP2+: add missing lateinit hook for calling pm late init
ARM: OMAP3+: use cpu0-cpufreq driver in device tree supported boot
ARM: dts: omap5-uevm: add smps123 supply for CPU
ARM: dts: OMAP3: add clock nodes for CPU

[1] http://marc.info/?t=138133284200006&r=1&w=2
[2] http://marc.info/?l=linux-arm-kernel&m=136804009618594&w=2
[3] http://marc.info/?l=devicetree&m=138135419203492&w=2
[4] https://git.kernel.org/cgit/linux/kernel/git/tmlind/linux-omap.git/log/?h=omap-for-v3.13/quirk

  arch/arm/boot/dts/am33xx.dtsi       |    4 ++++
  arch/arm/boot/dts/dra7-evm.dts      |    4 ++++
  arch/arm/boot/dts/dra7.dtsi         |   13 ++++++++++++-
  arch/arm/boot/dts/omap3.dtsi        |    5 +++++
  arch/arm/boot/dts/omap4.dtsi        |    5 +++++
  arch/arm/boot/dts/omap5-uevm.dts    |    4 ++++
  arch/arm/boot/dts/omap5.dtsi        |   15 ++++++++++++++-
  arch/arm/mach-omap2/board-generic.c |    4 ++++
  arch/arm/mach-omap2/common.h        |    4 ++++
  arch/arm/mach-omap2/io.c            |   20 ++++++++++++++++++++
  arch/arm/mach-omap2/opp.c           |    4 ++++
  arch/arm/mach-omap2/pm.c            |   12 +++++++++---
  12 files changed, 89 insertions(+), 5 deletions(-)

Regards,
Nishanth Menon

Signature · 4 lines
Beno?t Cousson
BayLibre
Embedded Linux Technology Lab
www.baylibre.com
#11 lore raw
In reply to Nishanth Menon
Quoted 1 line · Nishanth Menon

PandaBoard-ES (OMAP4460): http://pastebin.com/qQCmA2ng

Hi Nishanth,

A colleague of mine (Sanjay), was trying mainline on panda board. And wasn't able to get cpufreq-cpu0 working with it. Even your log also reports its broken as it can't get any regulator information..

He is getting this:

cpufreq_cpu0: failed to get cpu0 regulator: -19
cpufreq_cpu0: failed to get cpu0 clock: -2
cpufreq-cpu0: probe of cpufreq-cpu0.0 failed with error -2

Can you please help him out?

--
viresh