diff options
Diffstat (limited to 'arch/arm/mach-davinci/da850.c')
-rw-r--r-- | arch/arm/mach-davinci/da850.c | 43 |
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 | ||
849 | static const struct da850_opp da850_opp_300 = { | 852 | static 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 | ||
856 | static const struct da850_opp da850_opp_200 = { | 861 | static 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 | ||
863 | static const struct da850_opp da850_opp_96 = { | 870 | static 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 | ||
986 | static struct regulator *cvdd; | ||
987 | |||
988 | static 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 | |||
1000 | static 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 | |||
1013 | out: | ||
1014 | return ret; | ||
1015 | } | ||
1016 | device_initcall(da850_regulator_init); | ||
1017 | #endif | ||
1018 | |||
976 | static struct davinci_soc_info davinci_soc_info_da850 = { | 1019 | static 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), |