Commit 35f9acd8 authored by Sekhar Nori's avatar Sekhar Nori Committed by Kevin Hilman

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: default avatarSekhar Nori <nsekhar@ti.com>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 683b1e1f
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <linux/regulator/consumer.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
...@@ -844,6 +845,8 @@ struct da850_opp { ...@@ -844,6 +845,8 @@ struct da850_opp {
unsigned int prediv; unsigned int prediv;
unsigned int mult; unsigned int mult;
unsigned int postdiv; unsigned int postdiv;
unsigned int cvdd_min; /* in uV */
unsigned int cvdd_max; /* in uV */
}; };
static const struct da850_opp da850_opp_300 = { static const struct da850_opp da850_opp_300 = {
...@@ -851,6 +854,8 @@ static const struct da850_opp da850_opp_300 = { ...@@ -851,6 +854,8 @@ static const struct da850_opp da850_opp_300 = {
.prediv = 1, .prediv = 1,
.mult = 25, .mult = 25,
.postdiv = 2, .postdiv = 2,
.cvdd_min = 1140000,
.cvdd_max = 1320000,
}; };
static const struct da850_opp da850_opp_200 = { static const struct da850_opp da850_opp_200 = {
...@@ -858,6 +863,8 @@ static const struct da850_opp da850_opp_200 = { ...@@ -858,6 +863,8 @@ static const struct da850_opp da850_opp_200 = {
.prediv = 1, .prediv = 1,
.mult = 25, .mult = 25,
.postdiv = 3, .postdiv = 3,
.cvdd_min = 1050000,
.cvdd_max = 1160000,
}; };
static const struct da850_opp da850_opp_96 = { static const struct da850_opp da850_opp_96 = {
...@@ -865,6 +872,8 @@ static const struct da850_opp da850_opp_96 = { ...@@ -865,6 +872,8 @@ static const struct da850_opp da850_opp_96 = {
.prediv = 1, .prediv = 1,
.mult = 20, .mult = 20,
.postdiv = 5, .postdiv = 5,
.cvdd_min = 950000,
.cvdd_max = 1050000,
}; };
#define OPP(freq) \ #define OPP(freq) \
...@@ -973,6 +982,40 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate) ...@@ -973,6 +982,40 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate)
} }
#endif #endif
#ifdef CONFIG_REGULATOR
static struct regulator *cvdd;
static int da850_set_voltage(unsigned int index)
{
struct da850_opp *opp;
if (!cvdd)
return -ENODEV;
opp = (struct da850_opp *) da850_freq_table[index].index;
return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
}
static int __init da850_regulator_init(void)
{
int ret = 0;
cvdd = regulator_get(NULL, "cvdd");
if (WARN(IS_ERR(cvdd), "Unable to obtain voltage regulator for CVDD;"
" voltage scaling unsupported\n")) {
ret = PTR_ERR(cvdd);
goto out;
}
cpufreq_info.set_voltage = da850_set_voltage;
out:
return ret;
}
device_initcall(da850_regulator_init);
#endif
static struct davinci_soc_info davinci_soc_info_da850 = { static struct davinci_soc_info davinci_soc_info_da850 = {
.io_desc = da850_io_desc, .io_desc = da850_io_desc,
.io_desc_num = ARRAY_SIZE(da850_io_desc), .io_desc_num = ARRAY_SIZE(da850_io_desc),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment