Skip to contentSkip to conversation

OMAP3: PM: Fix the way OPP rate tables are initialized

PATCH In review Rajendra Nayak 2 participants 6 messages Oct 12, 2009 – Oct 14, 2009

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

PATCH 1/3 OMAP3: PM: Fix the way OPP rate tables are initialized

Remove rate tables being passed to omap2_init_common_hw, instead pass them as arguments to omap3_pm_early_init and
call this function from board files.

---
 arch/arm/mach-omap2/board-3430sdp.c     |    5 +++--
 arch/arm/mach-omap2/board-apollon.c     |    3 ++-
 arch/arm/mach-omap2/board-generic.c     |    3 ++-
 arch/arm/mach-omap2/board-h4.c          |    3 ++-
 arch/arm/mach-omap2/board-ldp.c         |    3 ++-
 arch/arm/mach-omap2/board-omap3beagle.c |    5 +++--
 arch/arm/mach-omap2/board-omap3evm.c    |    5 +++--
 arch/arm/mach-omap2/board-overo.c       |    4 +++-
 arch/arm/mach-omap2/board-rx51.c        |    6 ++++--
 arch/arm/mach-omap2/board-zoom2.c       |    6 ++++--
 arch/arm/mach-omap2/io.c                |    6 +-----
 arch/arm/mach-omap2/pm.h                |    4 +++-
 arch/arm/mach-omap2/pm34xx.c            |   16 +++++++++++-----
 arch/arm/plat-omap/include/mach/io.h    |    5 +----
 14 files changed, 44 insertions(+), 30 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +3 -2
index 97b61cd..425f5ac 100644
@@ -185,8 +185,9 @@ static void __init omap_3430sdp_init_irq(void)
 {
 	omap_board_config = sdp3430_config;
 	omap_board_config_size = ARRAY_SIZE(sdp3430_config);
-	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
+				 omap3_l3_rate_table);
+	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/board-apollon.c +2 -1
index 9cc984f..6a5c338 100644
@@ -267,7 +267,8 @@ static void __init omap_apollon_init_irq(void)
 {
 	omap_board_config = apollon_config;
 	omap_board_config_size = ARRAY_SIZE(apollon_config);
-	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	apollon_init_smc91x();
arch/arm/mach-omap2/board-generic.c +2 -1
index 5a834c1..55e1f11 100644
@@ -38,7 +38,8 @@ static void __init omap_generic_init_irq(void)
 {
 	omap_board_config = generic_config;
 	omap_board_config_size = ARRAY_SIZE(generic_config);
-	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 }
 
arch/arm/mach-omap2/board-h4.c +2 -1
index 500aebb..e8b5f6a 100644
@@ -313,7 +313,8 @@ static void __init omap_h4_init_irq(void)
 {
 	omap_board_config = h4_config;
 	omap_board_config_size = ARRAY_SIZE(h4_config);
-	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL)
+	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	h4_init_flash();
arch/arm/mach-omap2/board-ldp.c +2 -1
index 335185f..009fe39 100644
@@ -289,7 +289,8 @@ static void __init omap_ldp_init_irq(void)
 {
 	omap_board_config = ldp_config;
 	omap_board_config_size = ARRAY_SIZE(ldp_config);
-	omap2_init_common_hw(NULL, NULL, NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL);
+	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	ldp_init_smsc911x();
arch/arm/mach-omap2/board-omap3beagle.c +3 -2
index 9ba2514..097810b 100644
@@ -351,9 +351,10 @@ static void __init omap3_beagle_init_irq(void)
 {
 	omap_board_config = omap3_beagle_config;
 	omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
+	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
+				omap3_l3_rate_table);
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
-			     mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+			     mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
 #ifdef CONFIG_OMAP_32K_TIMER
 	omap2_gp_clockevent_set_gptimer(12);
arch/arm/mach-omap2/board-omap3evm.c +3 -2
index 3900151..3d05923 100644
@@ -290,8 +290,9 @@ static void __init omap3_evm_init_irq(void)
 {
 	omap_board_config = omap3_evm_config;
 	omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL, omap3_mpu_rate_table,
-	                     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
+				omap3_l3_rate_table);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 	omap3evm_init_smc911x();
arch/arm/mach-omap2/board-overo.c +3 -1
index 2cdced7..d487942 100644
@@ -49,6 +49,7 @@
 
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "mmc-twl4030.h"
+#include "pm.h"
 
 #define OVERO_GPIO_BT_XGATE	15
 #define OVERO_GPIO_W2W_NRESET	16
@@ -374,8 +375,9 @@ static void __init overo_init_irq(void)
 {
 	omap_board_config = overo_config;
 	omap_board_config_size = ARRAY_SIZE(overo_config);
+	omap3_pm_early_init(NULL, NULL, NULL);
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
-			     mt46h32m32lf6_sdrc_params, NULL, NULL, NULL);
+			     mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/board-rx51.c +4 -2
index 7ae3ab8..26313ee 100644
@@ -33,6 +33,7 @@
 #include <mach/usb.h>
 
 #include "omap3-opp.h"
+#include "pm.h"
 
 #define RX51_GPIO_SLEEP_IND 162
 
@@ -85,9 +86,10 @@ static void __init rx51_init_irq(void)
 {
 	omap_board_config = rx51_config;
 	omap_board_config_size = ARRAY_SIZE(rx51_config);
+	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
+				omap3_l3_rate_table);
 	omap2_init_common_hw(rx51_get_sdram_timings(),
-			     rx51_get_sdram_timings(), omap3_mpu_rate_table,
-			     omap3_dsp_rate_table, omap3_l3_rate_table);
+			     rx51_get_sdram_timings());
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/board-zoom2.c +4 -2
index 97df2e4..607f144 100644
@@ -26,6 +26,7 @@
 
 #include "mmc-twl4030.h"
 #include "omap3-opp.h"
+#include "pm.h"
 
 /* Zoom2 has Qwerty keyboard*/
 static int board_keymap[] = {
@@ -214,8 +215,9 @@ static void __init omap_zoom2_init_irq(void)
 {
 	omap_board_config = zoom2_config;
 	omap_board_config_size = ARRAY_SIZE(zoom2_config);
-	omap2_init_common_hw(NULL, NULL, omap3_mpu_rate_table,
-	                     omap3_dsp_rate_table, omap3_l3_rate_table);
+	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
+				omap3_l3_rate_table);
+	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
 }
arch/arm/mach-omap2/io.c +1 -5
index 8e0d005..3567bbe 100644
@@ -283,10 +283,7 @@ static int __init _omap2_init_reprogram_sdrc(void)
 }
 
 void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
-				 struct omap_sdrc_params *sdrc_cs1,
-				 struct omap_opp *mpu_opps,
-				 struct omap_opp *dsp_opps,
-				 struct omap_opp *l3_opps)
+				 struct omap_sdrc_params *sdrc_cs1)
 {
 	struct omap_hwmod **hwmods = NULL;
 
@@ -301,7 +298,6 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
 	/* The OPP tables have to be registered before a clk init */
 	omap_hwmod_init(hwmods);
 	omap2_mux_init();
-	omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
 	pwrdm_init(powerdomains_omap);
 	clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
 	omap2_clk_init();
arch/arm/mach-omap2/pm.h +3 -1
index f8d11a2..f535a14 100644
@@ -84,5 +84,7 @@ extern unsigned int omap34xx_suspend_sz;
 extern unsigned int save_secure_ram_context_sz;
 extern unsigned int omap24xx_cpu_suspend_sz;
 extern unsigned int omap34xx_cpu_suspend_sz;
-
+void omap3_pm_early_init(struct omap_opp *mpu_opps,
+			 struct omap_opp *dsp_opps,
+			 struct omap_opp *l3_opps);
 #endif
arch/arm/mach-omap2/pm34xx.c +11 -5
index cea3bca..2242d23 100644
@@ -39,6 +39,7 @@
 #include <mach/gpmc.h>
 #include <mach/dma.h>
 #include <mach/dmtimer.h>
+#include <mach/omap-pm.h>
 
 #include <asm/tlbflush.h>
 
@@ -1229,6 +1230,11 @@ err2:
 		list_del(&pwrst->node);
 		kfree(pwrst);
 	}
+
+	/* Do this late in the pm init */
+	pm_dbg_regset_init(1);
+	pm_dbg_regset_init(2);
+
 	return ret;
 }
 
@@ -1275,20 +1281,20 @@ static void __init configure_vc(void)
 	prm_write_mod_reg(prm_setup.voltsetup2, OMAP3430_GR_MOD,
 			OMAP3_PRM_VOLTSETUP2_OFFSET);
 
-	pm_dbg_regset_init(1);
-	pm_dbg_regset_init(2);
 }
 
-static int __init omap3_pm_early_init(void)
+void omap3_pm_early_init(struct omap_opp *mpu_opps,
+			 struct omap_opp *dsp_opps,
+			 struct omap_opp *l3_opps)
 {
 	prm_clear_mod_reg_bits(OMAP3430_OFFMODE_POL, OMAP3430_GR_MOD,
 				OMAP3_PRM_POLCTRL_OFFSET);
 
 	configure_vc();
+	omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
 
-	return 0;
+	return;
 }
 
-arch_initcall(omap3_pm_early_init);
 late_initcall(omap3_pm_init);
 
arch/arm/plat-omap/include/mach/io.h +1 -4
index 9699030..fce5f7f 100644
@@ -229,10 +229,7 @@ extern void omap1_init_common_hw(void);
 
 extern void omap2_map_common_io(void);
 extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
-				 struct omap_sdrc_params *sdrc_cs1,
-				 struct omap_opp *mpu_opps,
-				 struct omap_opp *dsp_opps,
-				 struct omap_opp *l3_opps);
+				 struct omap_sdrc_params *sdrc_cs1);
 
 #define __arch_ioremap(p,s,t)	omap_ioremap(p,s,t)
 #define __arch_iounmap(v)	omap_iounmap(v)
Signature · 1 line
1.5.4.7
#1 lore raw

PATCH 2/3 OMAP3: PM: Configure PRM setup times from board files

The setup times to be programmed in the PRM module on OMAP (for clksetup, voltsetup etc) are board specific.
They depend heavily on the PMIC used and even on different boards with the same PMIC, they vary based on the sleep/wake sequence used, system clock speed et al.

This patch makes it possible for these setup values to be configured from different board files.

---
 arch/arm/mach-omap2/board-3430sdp.c     |   19 ++++++++++++++++++-
 arch/arm/mach-omap2/board-apollon.c     |    2 +-
 arch/arm/mach-omap2/board-generic.c     |    2 +-
 arch/arm/mach-omap2/board-h4.c          |    2 +-
 arch/arm/mach-omap2/board-ldp.c         |    2 +-
 arch/arm/mach-omap2/board-omap3beagle.c |    2 +-
 arch/arm/mach-omap2/board-omap3evm.c    |    2 +-
 arch/arm/mach-omap2/board-overo.c       |    2 +-
 arch/arm/mach-omap2/board-rx51.c        |    2 +-
 arch/arm/mach-omap2/board-zoom2.c       |    2 +-
 arch/arm/mach-omap2/pm.h                |    3 ++-
 arch/arm/mach-omap2/pm34xx.c            |    7 ++++++-
 12 files changed, 35 insertions(+), 12 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +18 -1
index 425f5ac..0f4ffb2 100644
@@ -56,6 +56,23 @@
 
 #define TWL4030_MSECURE_GPIO 22
 
+/* FIXME: These are not the optimal setup values to be used on 3430sdp*/
+static struct prm_setup_vc omap3_setuptime_table = {
+	.clksetup = 0xff,
+	.voltsetup_time1 = 0xfff,
+	.voltsetup_time2 = 0xfff,
+	.voltoffset = 0xff,
+	.voltsetup2 = 0xff,
+	.vdd0_on = 0x30,
+	.vdd0_onlp = 0x20,
+	.vdd0_ret = 0x1e,
+	.vdd0_off = 0x00,
+	.vdd1_on = 0x2c,
+	.vdd1_onlp = 0x20,
+	.vdd1_ret = 0x1e,
+	.vdd1_off = 0x00,
+};
+
 static int board_keymap[] = {
 	KEY(0, 0, KEY_LEFT),
 	KEY(0, 1, KEY_RIGHT),
@@ -186,7 +203,7 @@ static void __init omap_3430sdp_init_irq(void)
 	omap_board_config = sdp3430_config;
 	omap_board_config_size = ARRAY_SIZE(sdp3430_config);
 	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
-				 omap3_l3_rate_table);
+				 omap3_l3_rate_table, &omap3_setuptime_table);
 	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-apollon.c +1 -1
index 6a5c338..c6014d7 100644
@@ -267,7 +267,7 @@ static void __init omap_apollon_init_irq(void)
 {
 	omap_board_config = apollon_config;
 	omap_board_config_size = ARRAY_SIZE(apollon_config);
-	omap3_pm_early_init(NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL, NULL);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-generic.c +1 -1
index 55e1f11..20f6dfe 100644
@@ -38,7 +38,7 @@ static void __init omap_generic_init_irq(void)
 {
 	omap_board_config = generic_config;
 	omap_board_config_size = ARRAY_SIZE(generic_config);
-	omap3_pm_early_init(NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL, NULL);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 }
arch/arm/mach-omap2/board-h4.c +1 -1
index e8b5f6a..2757b16 100644
@@ -313,7 +313,7 @@ static void __init omap_h4_init_irq(void)
 {
 	omap_board_config = h4_config;
 	omap_board_config_size = ARRAY_SIZE(h4_config);
-	omap3_pm_early_init(NULL, NULL, NULL)
+	omap3_pm_early_init(NULL, NULL, NULL, NULL)
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-ldp.c +1 -1
index 009fe39..21fae1a 100644
@@ -289,7 +289,7 @@ static void __init omap_ldp_init_irq(void)
 {
 	omap_board_config = ldp_config;
 	omap_board_config_size = ARRAY_SIZE(ldp_config);
-	omap3_pm_early_init(NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL, NULL);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-omap3beagle.c +1 -1
index 097810b..056c086 100644
@@ -352,7 +352,7 @@ static void __init omap3_beagle_init_irq(void)
 	omap_board_config = omap3_beagle_config;
 	omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
 	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
-				omap3_l3_rate_table);
+				omap3_l3_rate_table, NULL);
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
 			     mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
arch/arm/mach-omap2/board-omap3evm.c +1 -1
index 3d05923..d1328dd 100644
@@ -291,7 +291,7 @@ static void __init omap3_evm_init_irq(void)
 	omap_board_config = omap3_evm_config;
 	omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
 	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
-				omap3_l3_rate_table);
+				omap3_l3_rate_table, NULL);
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-overo.c +1 -1
index d487942..68bb994 100644
@@ -375,7 +375,7 @@ static void __init overo_init_irq(void)
 {
 	omap_board_config = overo_config;
 	omap_board_config_size = ARRAY_SIZE(overo_config);
-	omap3_pm_early_init(NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL, NULL);
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
 			     mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
arch/arm/mach-omap2/board-rx51.c +1 -1
index 26313ee..ea51c21 100644
@@ -87,7 +87,7 @@ static void __init rx51_init_irq(void)
 	omap_board_config = rx51_config;
 	omap_board_config_size = ARRAY_SIZE(rx51_config);
 	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
-				omap3_l3_rate_table);
+				omap3_l3_rate_table, NULL);
 	omap2_init_common_hw(rx51_get_sdram_timings(),
 			     rx51_get_sdram_timings());
 	omap_init_irq();
arch/arm/mach-omap2/board-zoom2.c +1 -1
index 607f144..270f788 100644
@@ -216,7 +216,7 @@ static void __init omap_zoom2_init_irq(void)
 	omap_board_config = zoom2_config;
 	omap_board_config_size = ARRAY_SIZE(zoom2_config);
 	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
-				omap3_l3_rate_table);
+				omap3_l3_rate_table, NULL);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/pm.h +2 -1
index f535a14..3330d7b 100644
@@ -86,5 +86,6 @@ extern unsigned int omap24xx_cpu_suspend_sz;
 extern unsigned int omap34xx_cpu_suspend_sz;
 void omap3_pm_early_init(struct omap_opp *mpu_opps,
 			 struct omap_opp *dsp_opps,
-			 struct omap_opp *l3_opps);
+			 struct omap_opp *l3_opps,
+			 struct prm_setup_vc *setup_times);
 #endif
arch/arm/mach-omap2/pm34xx.c +6 -1
index 2242d23..6f2fb51 100644
@@ -1084,6 +1084,9 @@ int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state)
 
 void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc)
 {
+	if (!setup_vc)
+		return;
+
 	prm_setup.clksetup = setup_vc->clksetup;
 	prm_setup.voltsetup_time1 = setup_vc->voltsetup_time1;
 	prm_setup.voltsetup_time2 = setup_vc->voltsetup_time2;
@@ -1285,13 +1288,15 @@ static void __init configure_vc(void)
 
 void omap3_pm_early_init(struct omap_opp *mpu_opps,
 			 struct omap_opp *dsp_opps,
-			 struct omap_opp *l3_opps)
+			 struct omap_opp *l3_opps,
+			 struct prm_setup_vc *setup_times)
 {
 	prm_clear_mod_reg_bits(OMAP3430_OFFMODE_POL, OMAP3430_GR_MOD,
 				OMAP3_PRM_POLCTRL_OFFSET);
 
 	configure_vc();
 	omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
+	omap3_set_prm_setup_vc(setup_times);
 
 	return;
 }
Signature · 1 line
1.5.4.7
#2 lore raw

PATCH 3/3 OMAP3: PM: Configure CPUidle latencies/thresholds from board files

The CPUidle C state latencies and thresholds are dependent on various board specific details.
Hence this patch makes it possible to configure these values from the respective board files.

---
 arch/arm/mach-omap2/board-3430sdp.c     |   21 ++++++-
 arch/arm/mach-omap2/board-apollon.c     |    2 +-
 arch/arm/mach-omap2/board-generic.c     |    2 +-
 arch/arm/mach-omap2/board-h4.c          |    2 +-
 arch/arm/mach-omap2/board-ldp.c         |    2 +-
 arch/arm/mach-omap2/board-omap3beagle.c |    2 +-
 arch/arm/mach-omap2/board-omap3evm.c    |    2 +-
 arch/arm/mach-omap2/board-overo.c       |    2 +-
 arch/arm/mach-omap2/board-rx51.c        |    2 +-
 arch/arm/mach-omap2/board-zoom2.c       |    2 +-
 arch/arm/mach-omap2/cpuidle34xx.c       |  105 ++++++++++++++++++++++++------
 arch/arm/mach-omap2/pm.h                |   12 +++-
 arch/arm/mach-omap2/pm34xx.c            |    4 +-
 13 files changed, 126 insertions(+), 34 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +20 -1
index 0f4ffb2..fb0cd4c 100644
@@ -73,6 +73,24 @@ static struct prm_setup_vc omap3_setuptime_table = {
 	.vdd1_off = 0x00,
 };
 
+/* FIXME: These values need to be updated based on more profiling on 3430sdp*/
+static struct cpuidle_params omap3_cpuidle_params_table[] = {
+	/* C1 */
+	{2, 2, 5},
+	/* C2 */
+	{10, 10, 30},
+	/* C3 */
+	{50, 50, 300},
+	/* C4 */
+	{1500, 1800, 4000},
+	/* C5 */
+	{2500, 7500, 12000},
+	/* C6 */
+	{3000, 8500, 15000},
+	/* C7 */
+	{10000, 30000, 300000},
+};
+
 static int board_keymap[] = {
 	KEY(0, 0, KEY_LEFT),
 	KEY(0, 1, KEY_RIGHT),
@@ -203,7 +221,8 @@ static void __init omap_3430sdp_init_irq(void)
 	omap_board_config = sdp3430_config;
 	omap_board_config_size = ARRAY_SIZE(sdp3430_config);
 	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
-				 omap3_l3_rate_table, &omap3_setuptime_table);
+			    omap3_l3_rate_table, &omap3_setuptime_table,
+			    omap3_cpuidle_params_table);
 	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-apollon.c +1 -1
index c6014d7..c847718 100644
@@ -267,7 +267,7 @@ static void __init omap_apollon_init_irq(void)
 {
 	omap_board_config = apollon_config;
 	omap_board_config_size = ARRAY_SIZE(apollon_config);
-	omap3_pm_early_init(NULL, NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL, NULL, NULL);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-generic.c +1 -1
index 20f6dfe..3053768 100644
@@ -38,7 +38,7 @@ static void __init omap_generic_init_irq(void)
 {
 	omap_board_config = generic_config;
 	omap_board_config_size = ARRAY_SIZE(generic_config);
-	omap3_pm_early_init(NULL, NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL, NULL, NULL);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 }
arch/arm/mach-omap2/board-h4.c +1 -1
index 2757b16..d6fc5f0 100644
@@ -313,7 +313,7 @@ static void __init omap_h4_init_irq(void)
 {
 	omap_board_config = h4_config;
 	omap_board_config_size = ARRAY_SIZE(h4_config);
-	omap3_pm_early_init(NULL, NULL, NULL, NULL)
+	omap3_pm_early_init(NULL, NULL, NULL, NULL, NULL)
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-ldp.c +1 -1
index 21fae1a..dc5ce14 100644
@@ -289,7 +289,7 @@ static void __init omap_ldp_init_irq(void)
 {
 	omap_board_config = ldp_config;
 	omap_board_config_size = ARRAY_SIZE(ldp_config);
-	omap3_pm_early_init(NULL, NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL, NULL, NULL);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-omap3beagle.c +1 -1
index 056c086..4856028 100644
@@ -352,7 +352,7 @@ static void __init omap3_beagle_init_irq(void)
 	omap_board_config = omap3_beagle_config;
 	omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
 	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
-				omap3_l3_rate_table, NULL);
+			    omap3_l3_rate_table, NULL, NULL);
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
 			     mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
arch/arm/mach-omap2/board-omap3evm.c +1 -1
index d1328dd..bb98748 100644
@@ -291,7 +291,7 @@ static void __init omap3_evm_init_irq(void)
 	omap_board_config = omap3_evm_config;
 	omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
 	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
-				omap3_l3_rate_table, NULL);
+			    omap3_l3_rate_table, NULL, NULL);
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/board-overo.c +1 -1
index 68bb994..a560a56 100644
@@ -375,7 +375,7 @@ static void __init overo_init_irq(void)
 {
 	omap_board_config = overo_config;
 	omap_board_config_size = ARRAY_SIZE(overo_config);
-	omap3_pm_early_init(NULL, NULL, NULL, NULL);
+	omap3_pm_early_init(NULL, NULL, NULL, NULL, NULL);
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
 			     mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
arch/arm/mach-omap2/board-rx51.c +1 -1
index ea51c21..23553b7 100644
@@ -87,7 +87,7 @@ static void __init rx51_init_irq(void)
 	omap_board_config = rx51_config;
 	omap_board_config_size = ARRAY_SIZE(rx51_config);
 	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
-				omap3_l3_rate_table, NULL);
+			    omap3_l3_rate_table, NULL, NULL);
 	omap2_init_common_hw(rx51_get_sdram_timings(),
 			     rx51_get_sdram_timings());
 	omap_init_irq();
arch/arm/mach-omap2/board-zoom2.c +1 -1
index 270f788..6d14406 100644
@@ -216,7 +216,7 @@ static void __init omap_zoom2_init_irq(void)
 	omap_board_config = zoom2_config;
 	omap_board_config_size = ARRAY_SIZE(zoom2_config);
 	omap3_pm_early_init(omap3_mpu_rate_table, omap3_dsp_rate_table,
-				omap3_l3_rate_table, NULL);
+			    omap3_l3_rate_table, NULL, NULL);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
 	omap_gpio_init();
arch/arm/mach-omap2/cpuidle34xx.c +84 -21

159 lines not on this page · raw message

arch/arm/mach-omap2/pm.h +10 -2
index 3330d7b..83dd31a 100644
@@ -41,8 +41,15 @@ struct prm_setup_vc {
 	u16 vdd1_ret;
 	u16 vdd1_off;
 };
-extern void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc);
 
+struct cpuidle_params {
+	u32 sleep_latency;
+	u32 wake_latency;
+	u32 threshold;
+};
+
+extern void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc);
+extern void omap3_set_idle_params(struct cpuidle_params *cpuidle_board_params);
 extern int resource_set_opp_level(int res, u32 target_level, int flags);
 extern int resource_access_opp_lock(int res, int delta);
 #define resource_lock_opp(res) resource_access_opp_lock(res, 1)
@@ -87,5 +94,6 @@ extern unsigned int omap34xx_cpu_suspend_sz;
 void omap3_pm_early_init(struct omap_opp *mpu_opps,
 			 struct omap_opp *dsp_opps,
 			 struct omap_opp *l3_opps,
-			 struct prm_setup_vc *setup_times);
+			 struct prm_setup_vc *setup_times,
+			 struct cpuidle_params *idle_params);
 #endif
arch/arm/mach-omap2/pm34xx.c +3 -1
index 6f2fb51..5b8d948 100644
@@ -1289,7 +1289,8 @@ static void __init configure_vc(void)
 void omap3_pm_early_init(struct omap_opp *mpu_opps,
 			 struct omap_opp *dsp_opps,
 			 struct omap_opp *l3_opps,
-			 struct prm_setup_vc *setup_times)
+			 struct prm_setup_vc *setup_times,
+			 struct cpuidle_params *idle_params)
 {
 	prm_clear_mod_reg_bits(OMAP3430_OFFMODE_POL, OMAP3430_GR_MOD,
 				OMAP3_PRM_POLCTRL_OFFSET);
@@ -1297,6 +1298,7 @@ void omap3_pm_early_init(struct omap_opp *mpu_opps,
 	configure_vc();
 	omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
 	omap3_set_prm_setup_vc(setup_times);
+	omap3_set_idle_params(idle_params);
 
 	return;
 }
Signature · 1 line
1.5.4.7
#3 lore raw

Re: [PATCH 2/3] OMAP3: PM: Configure PRM setup times from board files

In reply to Rajendra Nayak
Quoted 10 lines · Rajendra Nayak

The setup times to be programmed in the PRM module on OMAP (for clksetup, voltsetup etc) are board specific.
They depend heavily on the PMIC used and even on different boards with the same PMIC, they vary based on the sleep/wake sequence used, system clock speed et al.

This patch makes it possible for these setup values to be configured from different board files.

[...]

Quoted 18 lines
arch/arm/mach-omap2/pm34xx.c +3 -0
index 2242d23..6f2fb51 100644
@@ -1084,6 +1084,9 @@ int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state)
 
 void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc)
 {
+	if (!setup_vc)
+		return;
+
 	prm_setup.clksetup = setup_vc->clksetup;
 	prm_setup.voltsetup_time1 = setup_vc->voltsetup_time1;
 	prm_setup.voltsetup_time2 = setup_vc->voltsetup_time2;
@@ -1285,13 +1288,15 @@ static void __init configure_vc(void)
 
 void omap3_pm_early_init(struct omap_opp *mpu_opps,
 			 struct omap_opp *dsp_opps,

arch/arm/mach-omap2/pm34xx.c static void __init configure_vc(void) · line 1299

Quoted 10 lines
arch/arm/mach-omap2/pm34xx.c +3 -1
-			 struct omap_opp *l3_opps)
+			 struct omap_opp *l3_opps,
+			 struct prm_setup_vc *setup_times)
 {
 	prm_clear_mod_reg_bits(OMAP3430_OFFMODE_POL, OMAP3430_GR_MOD,
 				OMAP3_PRM_POLCTRL_OFFSET);
 
 	configure_vc();
 	omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
+	omap3_set_prm_setup_vc(setup_times);

I think there's an ordering problem here since the configure_vc() which uses the values is called before the setup_vc().

Also, if setup_times is passed as NULL, configure_vc() will be writing wrong values with undefined results to the VC.

Also, if my proposed omap3_pm_init_vc() approach is taken and it is optional, some sort of defaults should probably be set.

Kevin

#4 lore raw

RE: [PATCH 2/3] OMAP3: PM: Configure PRM setup times from board files

Quoted 52 lines

-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Wednesday, October 14, 2009 1:05 AM
To: Nayak, Rajendra
Cc: [email protected]
Subject: Re: [PATCH 2/3] OMAP3: PM: Configure PRM setup times from board files

Quoted 10 lines · Rajendra Nayak

The setup times to be programmed in the PRM module on OMAP (for clksetup, voltsetup etc) are board specific.
They depend heavily on the PMIC used and even on different boards with the same PMIC, they vary based on the sleep/wake sequence used, system clock speed et al.

This patch makes it possible for these setup values to be configured from different board files.

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/mach-omap2/pm34xx.c

arch/arm/mach-omap2/pm34xx.c int omap3_pm_set_suspend_state(struct

Quoted 4 lines

index 2242d23..6f2fb51 100644

arch/arm/mach-omap2/pm34xx.c +0 -0
@@ -1084,6 +1084,9 @@ int omap3_pm_set_suspend_state(struct 

powerdomain *pwrdm, int state)

Quoted 20 lines
arch/arm/mach-omap2/pm34xx.c +5 -1
 void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc)
 {
+	if (!setup_vc)
+		return;
+
 	prm_setup.clksetup = setup_vc->clksetup;
 	prm_setup.voltsetup_time1 = setup_vc->voltsetup_time1;
 	prm_setup.voltsetup_time2 = setup_vc->voltsetup_time2;
@@ -1285,13 +1288,15 @@ static void __init configure_vc(void)
 
 void omap3_pm_early_init(struct omap_opp *mpu_opps,
 			 struct omap_opp *dsp_opps,
-			 struct omap_opp *l3_opps)
+			 struct omap_opp *l3_opps,
+			 struct prm_setup_vc *setup_times)
 {
 	prm_clear_mod_reg_bits(OMAP3430_OFFMODE_POL, OMAP3430_GR_MOD,
 				OMAP3_PRM_POLCTRL_OFFSET);
 
Quoted 6 lines

arch/arm/mach-omap2/pm34xx.c static void __init configure_vc(void) · line 1299

Quoted 3 lines
arch/arm/mach-omap2/pm34xx.c +1 -0
 	configure_vc();
 	omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
+	omap3_set_prm_setup_vc(setup_times);

I think there's an ordering problem here since the configure_vc() which uses the values is called before the setup_vc().

Yes, the ordering seems to be certainly wrong. I will fix that in the updated patch-set.

Quoted 3 lines

Also, if setup_times is passed as NULL, configure_vc() will be writing wrong values with undefined results to the VC.

I guess not, since it uses default values from the prm_setup table defined in pm34xx.c which are not optimal but certainally not wrong. No? Same is the case with cpuidle params as well.

Quoted 9 lines

Also, if my proposed omap3_pm_init_vc() approach is taken and it is optional, some sort of defaults should probably be set.

Kevin

#5 lore raw

Re: [PATCH 2/3] OMAP3: PM: Configure PRM setup times from board files

Quoted 41 lines · Rajendra
Quoted 30 lines

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/mach-omap2/pm34xx.c

arch/arm/mach-omap2/pm34xx.c int omap3_pm_set_suspend_state(struct

Quoted 4 lines

index 2242d23..6f2fb51 100644

arch/arm/mach-omap2/pm34xx.c +0 -0
@@ -1084,6 +1084,9 @@ int omap3_pm_set_suspend_state(struct 

powerdomain *pwrdm, int state)

Quoted 20 lines
arch/arm/mach-omap2/pm34xx.c +5 -1
 void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc)
 {
+	if (!setup_vc)
+		return;
+
 	prm_setup.clksetup = setup_vc->clksetup;
 	prm_setup.voltsetup_time1 = setup_vc->voltsetup_time1;
 	prm_setup.voltsetup_time2 = setup_vc->voltsetup_time2;
@@ -1285,13 +1288,15 @@ static void __init configure_vc(void)
 
 void omap3_pm_early_init(struct omap_opp *mpu_opps,
 			 struct omap_opp *dsp_opps,
-			 struct omap_opp *l3_opps)
+			 struct omap_opp *l3_opps,
+			 struct prm_setup_vc *setup_times)
 {
 	prm_clear_mod_reg_bits(OMAP3430_OFFMODE_POL, OMAP3430_GR_MOD,
 				OMAP3_PRM_POLCTRL_OFFSET);
 
Quoted 6 lines

arch/arm/mach-omap2/pm34xx.c static void __init configure_vc(void) · line 1299

Quoted 3 lines
arch/arm/mach-omap2/pm34xx.c +1 -0
 	configure_vc();
 	omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
+	omap3_set_prm_setup_vc(setup_times);

I think there's an ordering problem here since the configure_vc() which uses the values is called before the setup_vc().

Yes, the ordering seems to be certainly wrong. I will fix that in the updated patch-set.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

Also, if setup_times is passed as NULL, configure_vc() will be writing wrong values with undefined results to the VC.

I guess not, since it uses default values from the prm_setup table defined in pm34xx.c which are not optimal but certainally not wrong. No? Same is the case with cpuidle params as well.

Ah, you're right. I saw the defaults in cpuidle, but not in pm34xx.c. That should be fine. Then, having these defaults will make the init call optional and only needed in boards that want to override.

Thanks,

Kevin