aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2009-09-22 11:44:02 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-25 13:21:29 -0500
commit35f9acd8bd13ba3d90998b5f31cae3e271309127 (patch)
tree9d4e03ea414368cf8a6ecea72d0f8442c057c7b6 /arch/arm/mach-davinci
parent683b1e1f0e6f7b2690c0ce76751ba8f26f0235c6 (diff)
davinci: DA850/OMAP-L138: add voltage regulation support
This patch adds support for regulating the CVDD voltage for the DA850/OMAP-L138 platform. The CVDD min and max values for each OPP have been obtained from section 5.2 "Recommended Operating Conditions" of SPRS586 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/da850.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 49dcc71168c7..0e1027ea8a40 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -16,6 +16,7 @@
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/regulator/consumer.h>
19 20
20#include <asm/mach/map.h> 21#include <asm/mach/map.h>
21 22
@@ -844,6 +845,8 @@ struct da850_opp {
844 unsigned int prediv; 845 unsigned int prediv;
845 unsigned int mult; 846 unsigned int mult;
846 unsigned int postdiv; 847 unsigned int postdiv;
848 unsigned int cvdd_min; /* in uV */
849 unsigned int cvdd_max; /* in uV */
847}; 850};
848 851
849static const struct da850_opp da850_opp_300 = { 852static const struct da850_opp da850_opp_300 = {
@@ -851,6 +854,8 @@ static const struct da850_opp da850_opp_300 = {
851 .prediv = 1, 854 .prediv = 1,
852 .mult = 25, 855 .mult = 25,
853 .postdiv = 2, 856 .postdiv = 2,
857 .cvdd_min = 1140000,
858 .cvdd_max = 1320000,
854}; 859};
855 860
856static const struct da850_opp da850_opp_200 = { 861static const struct da850_opp da850_opp_200 = {
@@ -858,6 +863,8 @@ static const struct da850_opp da850_opp_200 = {
858 .prediv = 1, 863 .prediv = 1,
859 .mult = 25, 864 .mult = 25,
860 .postdiv = 3, 865 .postdiv = 3,
866 .cvdd_min = 1050000,
867 .cvdd_max = 1160000,
861}; 868};
862 869
863static const struct da850_opp da850_opp_96 = { 870static const struct da850_opp da850_opp_96 = {
@@ -865,6 +872,8 @@ static const struct da850_opp da850_opp_96 = {
865 .prediv = 1, 872 .prediv = 1,
866 .mult = 20, 873 .mult = 20,
867 .postdiv = 5, 874 .postdiv = 5,
875 .cvdd_min = 950000,
876 .cvdd_max = 1050000,
868}; 877};
869 878
870#define OPP(freq) \ 879#define OPP(freq) \
@@ -973,6 +982,40 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate)
973} 982}
974#endif 983#endif
975 984
985#ifdef CONFIG_REGULATOR
986static struct regulator *cvdd;
987
988static int da850_set_voltage(unsigned int index)
989{
990 struct da850_opp *opp;
991
992 if (!cvdd)
993 return -ENODEV;
994
995 opp = (struct da850_opp *) da850_freq_table[index].index;
996
997 return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
998}
999
1000static int __init da850_regulator_init(void)
1001{
1002 int ret = 0;
1003
1004 cvdd = regulator_get(NULL, "cvdd");
1005 if (WARN(IS_ERR(cvdd), "Unable to obtain voltage regulator for CVDD;"
1006 " voltage scaling unsupported\n")) {
1007 ret = PTR_ERR(cvdd);
1008 goto out;
1009 }
1010
1011 cpufreq_info.set_voltage = da850_set_voltage;
1012
1013out:
1014 return ret;
1015}
1016device_initcall(da850_regulator_init);
1017#endif
1018
976static struct davinci_soc_info davinci_soc_info_da850 = { 1019static struct davinci_soc_info davinci_soc_info_da850 = {
977 .io_desc = da850_io_desc, 1020 .io_desc = da850_io_desc,
978 .io_desc_num = ARRAY_SIZE(da850_io_desc), 1021 .io_desc_num = ARRAY_SIZE(da850_io_desc),