Skip to contentSkip to conversation

OMAP: Add opp data

PATCH RESEND New Nishanth Menon 1 participant 4 messages Dec 9, 2010

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

v6 cover OMAP: Add opp data

Hi,
This series introduces OPP data for OMAP3 and 4 with relevant cleanups in OMAP's pm layer. Additional patches for cpufreq interface to OPP library + enablement of SmartReflex, voltage layers depend on the data made available here.

Major changes in V6:
Looping in L-a + added Paul's Ack in patch 3/3
http://marc.info/?l=linux-omap&m=129185174709566&w=2
rebased to 2.6.37-rc5

Major changes in V5:

	rebased to k.org 2.6.37-rc3
	introduced omap_opp_data.h
	couple of whitespace and offline license suggestion cleanups

V4: http://marc.info/?l=linux-omap&m=128993367112637&w=2
V3: http://marc.info/?l=linux-omap&m=128984926812800&w=2
V2: http://marc.info/?t=128753665300003&r=1&w=2

Kevin Hilman (1):
OMAP3: remove OPP interfaces from OMAP PM layer

Nishanth Menon (2):
omap: opp: add OMAP3 OPP table data and common init
omap4: opp: add OPP table data

 Documentation/arm/OMAP/omap_pm            |   25 +++++++
 arch/arm/mach-omap2/Kconfig               |    4 +
 arch/arm/mach-omap2/Makefile              |    6 ++
 arch/arm/mach-omap2/io.c                  |    3 +-
 arch/arm/mach-omap2/omap_opp_data.h       |   72 +++++++++++++++++++
 arch/arm/mach-omap2/opp.c                 |   93 +++++++++++++++++++++++++
 arch/arm/mach-omap2/opp3xxx_data.c        |  107 +++++++++++++++++++++++++++++
 arch/arm/mach-omap2/opp4xxx_data.c        |   57 +++++++++++++++
 arch/arm/mach-omap2/pm.h                  |   14 ++++
 arch/arm/plat-omap/include/plat/omap-pm.h |   31 +++------
 arch/arm/plat-omap/omap-pm-noop.c         |   11 +---
 11 files changed, 390 insertions(+), 33 deletions(-)
 create mode 100644 arch/arm/mach-omap2/omap_opp_data.h
 create mode 100644 arch/arm/mach-omap2/opp.c
 create mode 100644 arch/arm/mach-omap2/opp3xxx_data.c
 create mode 100644 arch/arm/mach-omap2/opp4xxx_data.c

Bloat-o-meter report for omap2plus_defconfig Vs 2.6.37-rc5:
add/remove: 22/3 grow/shrink: 4/3 up/down: 3143/-64 (3079)

function                                     old     new   delta
opp_add                                        -     576    +576
opp_set_availability                           -     524    +524
omap_init_opp_table                            -     332    +332
omap34xx_opp_def_list                          -     208    +208
static.__func__                            13783   13954    +171
opp_find_freq_floor                            -     160    +160
omap36xx_opp_def_list                          -     160    +160
opp_find_freq_ceil                             -     152    +152
opp_find_freq_exact                            -     128    +128
find_device_opp                                -     116    +116
opp_get_opp_count                              -     108    +108
omap44xx_opp_def_list                          -      96     +96
omap3_opp_init                                 -      76     +76
opp_get_voltage                                -      72     +72
opp_get_freq                                   -      72     +72
dev_opp_list_lock                              -      72     +72
omap4_opp_init                                 -      48     +48
vermagic                                      45      60     +15
linux_banner                                 131     146     +15
kernel_config_data                         13718   13727      +9
opp_enable                                     -       8      +8
opp_disable                                    -       8      +8
dev_opp_list                                   -       8      +8
__initcall_omap4_opp_init6                     -       4      +4
__initcall_omap3_opp_init6                     -       4      +4
omap_table_init                                -       1      +1
omap_pm_cpu_set_freq                          28      24      -4
mpu_opps                                       4       -      -4
l3_opps                                        4       -      -4
dsp_opps                                       4       -      -4

omap_pm_if_early_init 20 8 -12
omap2_init_common_hw 464 428 -36

Regards,
Nishanth Menon

#1 lore raw

PATCH v5 1/3 omap: opp: add OMAP3 OPP table data and common init

Add OPP data for OMAP34xx and OMAP36xx and initialization functions to populate OPP tables based on current SoC.
introduce an OMAP generic opp initialization routine which OMAP3 and OMAP4+ SoCs can use to register their OPP definitions.

---
v5: introduced new header for data structures to be used by data files
bit of licensing + whitespace cleanups
introduced ARCH_HAS_OPP after rebasing to rc3

v4: http://marc.info/?t=128993379200008&r=1&w=2
Comments from Thomas addressed:
* Data switched to .c file and included in opp.c
* init_table will fail with -EEXIST if already called
* minor comment improvements
Not addressed:
* request for board files to explicitly call init table as discussed http://marc.info/?l=linux-omap&m=128992417530385&w=2

v3: http://marc.info/?t=128984939100006&r=1&w=2
* added documentation for custom opp modification by board files
* switched to using device_initcall to autoinitialize the opp tables
v2: https://patchwork.kernel.org/patch/266911/

 Documentation/arm/OMAP/omap_pm      |   25 ++++++++
 arch/arm/mach-omap2/Kconfig         |    2 +
 arch/arm/mach-omap2/Makefile        |    6 ++
 arch/arm/mach-omap2/omap_opp_data.h |   72 +++++++++++++++++++++++
 arch/arm/mach-omap2/opp.c           |   93 ++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/opp3xxx_data.c  |  107 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/pm.h            |    9 +++
 7 files changed, 314 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/omap_opp_data.h
 create mode 100644 arch/arm/mach-omap2/opp.c
 create mode 100644 arch/arm/mach-omap2/opp3xxx_data.c
Documentation/arm/OMAP/omap_pm +25 -0
index 5389440..9012bb0 100644
@@ -127,3 +127,28 @@ implementation needs:
 10. (*pdata->cpu_set_freq)(unsigned long f)
 
 11. (*pdata->cpu_get_freq)(void)
+
+Customizing OPP for platform
+============================
+Defining CONFIG_PM should enable OPP layer for the silicon
+and the registration of OPP table should take place automatically.
+However, in special cases, the default OPP table may need to be
+tweaked, for e.g.:
+ * enable default OPPs which are disabled by default, but which
+   could be enabled on a platform
+ * Disable an unsupported OPP on the platform
+ * Define and add a custom opp table entry
+in these cases, the board file needs to do additional steps as follows:
+arch/arm/mach-omapx/board-xyz.c
+	#include "pm.h"
+	....
+	static void __init omap_xyz_init_irq(void)
+	{
+		....
+		/* Initialize the default table */
+		omapx_opp_init();
+		/* Do customization to the defaults */
+		....
+	}
+NOTE: omapx_opp_init will be omap3_opp_init or as required
+based on the omap family.
arch/arm/mach-omap2/Kconfig +2 -0
index ab784bf..102a7df 100644
@@ -35,6 +35,8 @@ config ARCH_OMAP3
 	select CPU_V7
 	select USB_ARCH_HAS_EHCI
 	select ARM_L1_CACHE_SHIFT_6 if !ARCH_OMAP4
+	select ARCH_HAS_OPP
+	select PM_OPP if PM
 
 config ARCH_OMAP4
 	bool "TI OMAP4"
arch/arm/mach-omap2/Makefile +6 -0
index 60e51bc..fbbb6b3 100644
@@ -47,6 +47,12 @@ obj-$(CONFIG_ARCH_OMAP3)		+= mux34xx.o
 obj-$(CONFIG_ARCH_OMAP2)		+= sdrc2xxx.o
 # obj-$(CONFIG_ARCH_OMAP3)		+= sdrc3xxx.o
 
+# OPP table initialization
+ifeq ($(CONFIG_PM_OPP),y)
+obj-y					+= opp.o
+obj-$(CONFIG_ARCH_OMAP3)		+= opp3xxx_data.o
+endif
+
 # Power Management
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
arch/arm/mach-omap2/omap_opp_data.h new file +72 -0

72 lines not on this page · raw message

arch/arm/mach-omap2/opp.c new file +93 -0

93 lines not on this page · raw message

arch/arm/mach-omap2/opp3xxx_data.c new file +107 -0

107 lines not on this page · raw message

arch/arm/mach-omap2/pm.h +9 -0
index 0d75bfd..2031f15 100644
@@ -20,6 +20,15 @@ extern int omap3_can_sleep(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
 
+#if defined(CONFIG_PM_OPP)
+extern int omap3_opp_init(void);
+#else
+static inline int omap3_opp_init(void)
+{
+	return -EINVAL;
+}
+#endif
+
 struct cpuidle_params {
 	u8  valid;
 	u32 sleep_latency;
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH v5 2/3 omap4: opp: add OPP table data

In reply to Nishanth Menon

This patch adds OPP tables for OMAP4. New file has been added to keep the OMAP4 opp tables and the registration of these tables with the generic opp framework by OMAP SoC OPP interface.

Based on:
http://dev.omapzoom.org/?p=santosh/kernel-omap4-base.git;a=blob;f=arch/arm/mach-omap2/opp44xx_data.c;h=252e3d0cb6050a64f390b9311c1c4977d74f762a;hb=refs/heads/omap4_next

---
v5:
added ARCH_HAS_OPP after rebase to rc3
V4: http://marc.info/?t=128993379200006&r=1&w=2
switched data to .c file
v3: http://marc.info/?l=linux-omap&m=128984926712794&w=2
* switched to using device_initcall to autoinitialize the opp tables
v2: https://patchwork.kernel.org/patch/266921/

 arch/arm/mach-omap2/Kconfig        |    2 +
 arch/arm/mach-omap2/Makefile       |    1 +
 arch/arm/mach-omap2/opp4xxx_data.c |   57 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/pm.h           |    5 +++
 4 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/opp4xxx_data.c
arch/arm/mach-omap2/Kconfig +2 -0
index 102a7df..f85188d 100644
@@ -46,6 +46,8 @@ config ARCH_OMAP4
 	select ARM_GIC
 	select PL310_ERRATA_588369
 	select ARM_ERRATA_720789
+	select ARCH_HAS_OPP
+	select PM_OPP if PM
 
 comment "OMAP Core Type"
 	depends on ARCH_OMAP2
arch/arm/mach-omap2/Makefile +1 -0
index fbbb6b3..ea217f5 100644
@@ -51,6 +51,7 @@ obj-$(CONFIG_ARCH_OMAP2)		+= sdrc2xxx.o
 ifeq ($(CONFIG_PM_OPP),y)
 obj-y					+= opp.o
 obj-$(CONFIG_ARCH_OMAP3)		+= opp3xxx_data.o
+obj-$(CONFIG_ARCH_OMAP4)		+= opp4xxx_data.o
 endif
 
 # Power Management
arch/arm/mach-omap2/opp4xxx_data.c new file +57 -0

57 lines not on this page · raw message

arch/arm/mach-omap2/pm.h +5 -0
index 2031f15..a43e069 100644
@@ -22,11 +22,16 @@ extern int omap3_idle_init(void);
 
 #if defined(CONFIG_PM_OPP)
 extern int omap3_opp_init(void);
+extern int omap4_opp_init(void);
 #else
 static inline int omap3_opp_init(void)
 {
 	return -EINVAL;
 }
+static inline int omap4_opp_init(void)
+{
+	return -EINVAL;
+}
 #endif
 
 struct cpuidle_params {
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH v4 3/3 OMAP3: remove OPP interfaces from OMAP PM layer

In reply to Nishanth Menon

From: Kevin Hilman <[email protected]>

With new OPP layer, OPP users will access OPP API directly instead of using OMAP PM layer, so remove all notions of OPPs from the OMAP PM layer.

---

v4: identical to v3 with Acked-by added
posted for completeness sake - no change involved
v3: no longer explicitly calling the init_table, instead
depending on the device_initcall to initialize as needed

v2: https://patchwork.kernel.org/patch/266931/

 arch/arm/mach-omap2/io.c                  |    3 +-
 arch/arm/plat-omap/include/plat/omap-pm.h |   31 +++++++++-------------------
 arch/arm/plat-omap/omap-pm-noop.c         |   11 +---------
 3 files changed, 12 insertions(+), 33 deletions(-)
arch/arm/mach-omap2/io.c +1 -2
index 40562dd..2fe4e02 100644
@@ -327,8 +327,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
 	else if (cpu_is_omap44xx())
 		omap44xx_hwmod_init();
 
-	/* The OPP tables have to be registered before a clk init */
-	omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
+	omap_pm_if_early_init();
 
 	if (cpu_is_omap2420())
 		omap2420_clk_init();
arch/arm/plat-omap/include/plat/omap-pm.h +10 -21
index 728fbb9..62c3fe9 100644
@@ -17,27 +17,10 @@
 #include <linux/device.h>
 #include <linux/cpufreq.h>
 #include <linux/clk.h>
+#include <linux/opp.h>
 
 #include "powerdomain.h"
 
-/**
- * struct omap_opp - clock frequency-to-OPP ID table for DSP, MPU
- * @rate: target clock rate
- * @opp_id: OPP ID
- * @min_vdd: minimum VDD1 voltage (in millivolts) for this OPP
- *
- * Operating performance point data.  Can vary by OMAP chip and board.
- */
-struct omap_opp {
-	unsigned long rate;
-	u8 opp_id;
-	u16 min_vdd;
-};
-
-extern struct omap_opp *mpu_opps;
-extern struct omap_opp *dsp_opps;
-extern struct omap_opp *l3_opps;
-
 /*
  * agent_id values for use with omap_pm_set_min_bus_tput():
  *
@@ -59,9 +42,11 @@ extern struct omap_opp *l3_opps;
  * framework starts.  The "_if_" is to avoid name collisions with the
  * PM idle-loop code.
  */
-int __init omap_pm_if_early_init(struct omap_opp *mpu_opp_table,
-				 struct omap_opp *dsp_opp_table,
-				 struct omap_opp *l3_opp_table);
+#ifdef CONFIG_OMAP_PM_NONE
+#define omap_pm_if_early_init() 0
+#else
+int __init omap_pm_if_early_init(void);
+#endif
 
 /**
  * omap_pm_if_init - OMAP PM init code called after clock fw init
@@ -69,7 +54,11 @@ int __init omap_pm_if_early_init(struct omap_opp *mpu_opp_table,
  * The main initialization code.  OPP tables are passed in here.  The
  * "_if_" is to avoid name collisions with the PM idle-loop code.
  */
+#ifdef CONFIG_OMAP_PM_NONE
+#define omap_pm_if_init() 0
+#else
 int __init omap_pm_if_init(void);
+#endif
 
 /**
  * omap_pm_if_exit - OMAP PM exit code
arch/arm/plat-omap/omap-pm-noop.c +1 -10
index e129ce8..ca75abb 100644
@@ -26,10 +26,6 @@
 
 #include <plat/powerdomain.h>
 
-struct omap_opp *dsp_opps;
-struct omap_opp *mpu_opps;
-struct omap_opp *l3_opps;
-
 /*
  * Device-driver-originated constraints (via board-*.c files)
  */
@@ -308,13 +304,8 @@ int omap_pm_get_dev_context_loss_count(struct device *dev)
 
 
 /* Should be called before clk framework init */
-int __init omap_pm_if_early_init(struct omap_opp *mpu_opp_table,
-				 struct omap_opp *dsp_opp_table,
-				 struct omap_opp *l3_opp_table)
+int __init omap_pm_if_early_init(void)
 {
-	mpu_opps = mpu_opp_table;
-	dsp_opps = dsp_opp_table;
-	l3_opps = l3_opp_table;
 	return 0;
 }
 
Signature · 1 line
1.6.3.3