diff mbox

[PM] omap3: cpufreq: allow default opp table init

Message ID 1274318093-29010-1-git-send-email-nm@ti.com (mailing list archive)
State New, archived
Delegated to: Kevin Hilman
Headers show

Commit Message

Nishanth Menon May 20, 2010, 1:14 a.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/cpufreq34xx.c b/arch/arm/mach-omap2/cpufreq34xx.c
index 8747dd6..b9d75cf 100644
--- a/arch/arm/mach-omap2/cpufreq34xx.c
+++ b/arch/arm/mach-omap2/cpufreq34xx.c
@@ -110,6 +110,9 @@  static struct omap_opp_def __initdata omap36xx_dsp_rate_table[] = {
 	OMAP_OPP_DEF(0, 0, 0)
 };
 
+/* Temp variable to allow multiple calls */
+static u8 __initdata omap3_table_init;
+
 int __init omap3_pm_init_opp_table(void)
 {
 	int i, r;
@@ -130,6 +133,14 @@  int __init omap3_pm_init_opp_table(void)
 		OPP_DSP
 	};
 
+	/*
+	 * Allow multiple calls, but initialize only if not already initalized
+	 * even if the previous call failed, coz, no reason we'd succeed again
+	 */
+	if (omap3_table_init)
+		return 0;
+	omap3_table_init = 1;
+
 	omap3_opp_def_list = cpu_is_omap3630() ? omap36xx_opp_def_list :
 				omap34xx_opp_def_list;
 
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 984bdbf..203c7e8 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -47,6 +47,7 @@ 
 #include "clockdomains.h"
 #include <plat/omap_hwmod.h>
 
+#include "omap3-opp.h"
 /*
  * The machine specific code may provide the extra mapping besides the
  * default mapping provided here.
@@ -307,6 +308,9 @@  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)
 {
+	/* initialize the opp table if board file has not done so */
+	omap3_pm_init_opp_table();
+
 	pwrdm_init(powerdomains_omap);
 	clkdm_init(clockdomains_omap, clkdm_autodeps);
 	if (cpu_is_omap242x())