aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2009-10-22 05:42:16 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-25 13:21:37 -0500
commit13d5e27a4482e43bea9073706033c84cd873b5ca (patch)
tree2b66f5238dce2563741bf0524b2d731a7dc10ded /arch/arm/mach-davinci
parent5aeb15aafc0c378d4ae2aff7b5d5c686793b8a0e (diff)
davinci: DA850/OMAP-L138: avoid using separate initcall for initializing regulator
Using a device_initcall() for initializing the voltage regulator on DA850 is not such a good idea because it gets called for all platforms - even those who do not have a regulator implemented. This leads to a big fat warning message during boot-up when regulator cannot be found. Instead, tie initialization of voltage regulator to cpufreq init. Define a platform specific init call which in case of DA850 gets used for initializing the regulator. On other future platforms it can be used for other purposes. Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/cpufreq.c7
-rw-r--r--arch/arm/mach-davinci/da850.c64
-rw-r--r--arch/arm/mach-davinci/include/mach/cpufreq.h1
3 files changed, 39 insertions, 33 deletions
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c
index 8c8c07b12d87..d3fa6de1e20f 100644
--- a/arch/arm/mach-davinci/cpufreq.c
+++ b/arch/arm/mach-davinci/cpufreq.c
@@ -127,6 +127,13 @@ static int __init davinci_cpu_init(struct cpufreq_policy *policy)
127 if (policy->cpu != 0) 127 if (policy->cpu != 0)
128 return -EINVAL; 128 return -EINVAL;
129 129
130 /* Finish platform specific initialization */
131 if (pdata->init) {
132 result = pdata->init();
133 if (result)
134 return result;
135 }
136
130 policy->cur = policy->min = policy->max = davinci_getspeed(0); 137 policy->cur = policy->min = policy->max = davinci_getspeed(0);
131 138
132 if (freq_table) { 139 if (freq_table) {
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 0f27c93545bf..717806c6cef9 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -907,8 +907,39 @@ static struct cpufreq_frequency_table da850_freq_table[] = {
907 }, 907 },
908}; 908};
909 909
910#ifdef CONFIG_REGULATOR
911static struct regulator *cvdd;
912
913static int da850_set_voltage(unsigned int index)
914{
915 struct da850_opp *opp;
916
917 if (!cvdd)
918 return -ENODEV;
919
920 opp = (struct da850_opp *) da850_freq_table[index].index;
921
922 return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
923}
924
925static int da850_regulator_init(void)
926{
927 cvdd = regulator_get(NULL, "cvdd");
928 if (WARN(IS_ERR(cvdd), "Unable to obtain voltage regulator for CVDD;"
929 " voltage scaling unsupported\n")) {
930 return PTR_ERR(cvdd);
931 }
932
933 return 0;
934}
935#endif
936
910static struct davinci_cpufreq_config cpufreq_info = { 937static struct davinci_cpufreq_config cpufreq_info = {
911 .freq_table = &da850_freq_table[0], 938 .freq_table = &da850_freq_table[0],
939#ifdef CONFIG_REGULATOR
940 .init = da850_regulator_init,
941 .set_voltage = da850_set_voltage,
942#endif
912}; 943};
913 944
914static struct platform_device da850_cpufreq_device = { 945static struct platform_device da850_cpufreq_device = {
@@ -997,39 +1028,6 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate)
997} 1028}
998#endif 1029#endif
999 1030
1000#ifdef CONFIG_REGULATOR
1001static struct regulator *cvdd;
1002
1003static int da850_set_voltage(unsigned int index)
1004{
1005 struct da850_opp *opp;
1006
1007 if (!cvdd)
1008 return -ENODEV;
1009
1010 opp = (struct da850_opp *) da850_freq_table[index].index;
1011
1012 return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
1013}
1014
1015static int __init da850_regulator_init(void)
1016{
1017 int ret = 0;
1018
1019 cvdd = regulator_get(NULL, "cvdd");
1020 if (WARN(IS_ERR(cvdd), "Unable to obtain voltage regulator for CVDD;"
1021 " voltage scaling unsupported\n")) {
1022 ret = PTR_ERR(cvdd);
1023 goto out;
1024 }
1025
1026 cpufreq_info.set_voltage = da850_set_voltage;
1027
1028out:
1029 return ret;
1030}
1031device_initcall(da850_regulator_init);
1032#endif
1033 1031
1034static struct davinci_soc_info davinci_soc_info_da850 = { 1032static struct davinci_soc_info davinci_soc_info_da850 = {
1035 .io_desc = da850_io_desc, 1033 .io_desc = da850_io_desc,
diff --git a/arch/arm/mach-davinci/include/mach/cpufreq.h b/arch/arm/mach-davinci/include/mach/cpufreq.h
index 442bdea44632..3c089cfb6cd6 100644
--- a/arch/arm/mach-davinci/include/mach/cpufreq.h
+++ b/arch/arm/mach-davinci/include/mach/cpufreq.h
@@ -20,6 +20,7 @@
20struct davinci_cpufreq_config { 20struct davinci_cpufreq_config {
21 struct cpufreq_frequency_table *freq_table; 21 struct cpufreq_frequency_table *freq_table;
22 int (*set_voltage) (unsigned int index); 22 int (*set_voltage) (unsigned int index);
23 int (*init) (void);
23}; 24};
24 25
25#endif 26#endif