aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/omap_twl.c20
-rw-r--r--arch/arm/mach-omap2/vc.c35
-rw-r--r--arch/arm/mach-omap2/vc.h7
-rw-r--r--arch/arm/mach-omap2/vc3xxx_data.c22
-rw-r--r--arch/arm/mach-omap2/vc44xx_data.c28
-rw-r--r--arch/arm/mach-omap2/voltage.h18
-rw-r--r--arch/arm/mach-omap2/voltagedomains3xxx_data.c5
-rw-r--r--arch/arm/mach-omap2/voltagedomains44xx_data.c8
-rw-r--r--arch/arm/mach-omap2/vp.h7
-rw-r--r--arch/arm/mach-omap2/vp3xxx_data.c10
-rw-r--r--arch/arm/mach-omap2/vp44xx_data.c15
11 files changed, 147 insertions, 28 deletions
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index c38a530a7f47..dca1d662d5e0 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -141,10 +141,6 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
141static struct omap_voltdm_pmic omap3_mpu_pmic = { 141static struct omap_voltdm_pmic omap3_mpu_pmic = {
142 .slew_rate = 4000, 142 .slew_rate = 4000,
143 .step_size = 12500, 143 .step_size = 12500,
144 .on_volt = 1200000,
145 .onlp_volt = 1000000,
146 .ret_volt = 975000,
147 .off_volt = 600000,
148 .volt_setup_time = 0xfff, 144 .volt_setup_time = 0xfff,
149 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, 145 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET,
150 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, 146 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN,
@@ -162,10 +158,6 @@ static struct omap_voltdm_pmic omap3_mpu_pmic = {
162static struct omap_voltdm_pmic omap3_core_pmic = { 158static struct omap_voltdm_pmic omap3_core_pmic = {
163 .slew_rate = 4000, 159 .slew_rate = 4000,
164 .step_size = 12500, 160 .step_size = 12500,
165 .on_volt = 1200000,
166 .onlp_volt = 1000000,
167 .ret_volt = 975000,
168 .off_volt = 600000,
169 .volt_setup_time = 0xfff, 161 .volt_setup_time = 0xfff,
170 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, 162 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET,
171 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, 163 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN,
@@ -183,10 +175,6 @@ static struct omap_voltdm_pmic omap3_core_pmic = {
183static struct omap_voltdm_pmic omap4_mpu_pmic = { 175static struct omap_voltdm_pmic omap4_mpu_pmic = {
184 .slew_rate = 4000, 176 .slew_rate = 4000,
185 .step_size = 12660, 177 .step_size = 12660,
186 .on_volt = 1375000,
187 .onlp_volt = 1375000,
188 .ret_volt = 830000,
189 .off_volt = 0,
190 .volt_setup_time = 0, 178 .volt_setup_time = 0,
191 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 179 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
192 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 180 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
@@ -205,10 +193,6 @@ static struct omap_voltdm_pmic omap4_mpu_pmic = {
205static struct omap_voltdm_pmic omap4_iva_pmic = { 193static struct omap_voltdm_pmic omap4_iva_pmic = {
206 .slew_rate = 4000, 194 .slew_rate = 4000,
207 .step_size = 12660, 195 .step_size = 12660,
208 .on_volt = 1188000,
209 .onlp_volt = 1188000,
210 .ret_volt = 830000,
211 .off_volt = 0,
212 .volt_setup_time = 0, 196 .volt_setup_time = 0,
213 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 197 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
214 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 198 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
@@ -227,10 +211,6 @@ static struct omap_voltdm_pmic omap4_iva_pmic = {
227static struct omap_voltdm_pmic omap4_core_pmic = { 211static struct omap_voltdm_pmic omap4_core_pmic = {
228 .slew_rate = 4000, 212 .slew_rate = 4000,
229 .step_size = 12660, 213 .step_size = 12660,
230 .on_volt = 1200000,
231 .onlp_volt = 1200000,
232 .ret_volt = 830000,
233 .off_volt = 0,
234 .volt_setup_time = 0, 214 .volt_setup_time = 0,
235 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 215 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
236 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 216 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 880249b17012..4c3c41fd2637 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -135,6 +135,8 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
135 vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift); 135 vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift);
136 voltdm->write(vc_cmdval, vc->cmdval_reg); 136 voltdm->write(vc_cmdval, vc->cmdval_reg);
137 137
138 voltdm->vc_param->on = target_volt;
139
138 omap_vp_update_errorgain(voltdm, target_volt); 140 omap_vp_update_errorgain(voltdm, target_volt);
139 141
140 return 0; 142 return 0;
@@ -284,6 +286,30 @@ static void __init omap_vc_i2c_init(struct voltagedomain *voltdm)
284 initialized = true; 286 initialized = true;
285} 287}
286 288
289/**
290 * omap_vc_calc_vsel - calculate vsel value for a channel
291 * @voltdm: channel to calculate value for
292 * @uvolt: microvolt value to convert to vsel
293 *
294 * Converts a microvolt value to vsel value for the used PMIC.
295 * This checks whether the microvolt value is out of bounds, and
296 * adjusts the value accordingly. If unsupported value detected,
297 * warning is thrown.
298 */
299static u8 omap_vc_calc_vsel(struct voltagedomain *voltdm, u32 uvolt)
300{
301 if (voltdm->pmic->vddmin > uvolt)
302 uvolt = voltdm->pmic->vddmin;
303 if (voltdm->pmic->vddmax < uvolt) {
304 WARN(1, "%s: voltage not supported by pmic: %u vs max %u\n",
305 __func__, uvolt, voltdm->pmic->vddmax);
306 /* Lets try maximum value anyway */
307 uvolt = voltdm->pmic->vddmax;
308 }
309
310 return voltdm->pmic->uv_to_vsel(uvolt);
311}
312
287void __init omap_vc_init_channel(struct voltagedomain *voltdm) 313void __init omap_vc_init_channel(struct voltagedomain *voltdm)
288{ 314{
289 struct omap_vc_channel *vc = voltdm->vc; 315 struct omap_vc_channel *vc = voltdm->vc;
@@ -335,10 +361,11 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
335 } 361 }
336 362
337 /* Set up the on, inactive, retention and off voltage */ 363 /* Set up the on, inactive, retention and off voltage */
338 on_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->on_volt); 364 on_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->on);
339 onlp_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->onlp_volt); 365 onlp_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->onlp);
340 ret_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->ret_volt); 366 ret_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->ret);
341 off_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->off_volt); 367 off_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->off);
368
342 val = ((on_vsel << vc->common->cmd_on_shift) | 369 val = ((on_vsel << vc->common->cmd_on_shift) |
343 (onlp_vsel << vc->common->cmd_onlp_shift) | 370 (onlp_vsel << vc->common->cmd_onlp_shift) |
344 (ret_vsel << vc->common->cmd_ret_shift) | 371 (ret_vsel << vc->common->cmd_ret_shift) |
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
index 478bf6b432c4..7618b69811d0 100644
--- a/arch/arm/mach-omap2/vc.h
+++ b/arch/arm/mach-omap2/vc.h
@@ -111,6 +111,13 @@ extern struct omap_vc_channel omap4_vc_mpu;
111extern struct omap_vc_channel omap4_vc_iva; 111extern struct omap_vc_channel omap4_vc_iva;
112extern struct omap_vc_channel omap4_vc_core; 112extern struct omap_vc_channel omap4_vc_core;
113 113
114extern struct omap_vc_param omap3_mpu_vc_data;
115extern struct omap_vc_param omap3_core_vc_data;
116
117extern struct omap_vc_param omap4_mpu_vc_data;
118extern struct omap_vc_param omap4_iva_vc_data;
119extern struct omap_vc_param omap4_core_vc_data;
120
114void omap_vc_init_channel(struct voltagedomain *voltdm); 121void omap_vc_init_channel(struct voltagedomain *voltdm);
115int omap_vc_pre_scale(struct voltagedomain *voltdm, 122int omap_vc_pre_scale(struct voltagedomain *voltdm,
116 unsigned long target_volt, 123 unsigned long target_volt,
diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c
index 5d8eaf31569c..75bc4aa22b3a 100644
--- a/arch/arm/mach-omap2/vc3xxx_data.c
+++ b/arch/arm/mach-omap2/vc3xxx_data.c
@@ -71,3 +71,25 @@ struct omap_vc_channel omap3_vc_core = {
71 .smps_cmdra_mask = OMAP3430_CMDRA1_MASK, 71 .smps_cmdra_mask = OMAP3430_CMDRA1_MASK,
72 .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT, 72 .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT,
73}; 73};
74
75/*
76 * Voltage levels for different operating modes: on, sleep, retention and off
77 */
78#define OMAP3_ON_VOLTAGE_UV 1200000
79#define OMAP3_ONLP_VOLTAGE_UV 1000000
80#define OMAP3_RET_VOLTAGE_UV 975000
81#define OMAP3_OFF_VOLTAGE_UV 600000
82
83struct omap_vc_param omap3_mpu_vc_data = {
84 .on = OMAP3_ON_VOLTAGE_UV,
85 .onlp = OMAP3_ONLP_VOLTAGE_UV,
86 .ret = OMAP3_RET_VOLTAGE_UV,
87 .off = OMAP3_OFF_VOLTAGE_UV,
88};
89
90struct omap_vc_param omap3_core_vc_data = {
91 .on = OMAP3_ON_VOLTAGE_UV,
92 .onlp = OMAP3_ONLP_VOLTAGE_UV,
93 .ret = OMAP3_RET_VOLTAGE_UV,
94 .off = OMAP3_OFF_VOLTAGE_UV,
95};
diff --git a/arch/arm/mach-omap2/vc44xx_data.c b/arch/arm/mach-omap2/vc44xx_data.c
index d70b930f2739..085e5d6a04fd 100644
--- a/arch/arm/mach-omap2/vc44xx_data.c
+++ b/arch/arm/mach-omap2/vc44xx_data.c
@@ -87,3 +87,31 @@ struct omap_vc_channel omap4_vc_core = {
87 .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT, 87 .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT,
88}; 88};
89 89
90/*
91 * Voltage levels for different operating modes: on, sleep, retention and off
92 */
93#define OMAP4_ON_VOLTAGE_UV 1375000
94#define OMAP4_ONLP_VOLTAGE_UV 1375000
95#define OMAP4_RET_VOLTAGE_UV 837500
96#define OMAP4_OFF_VOLTAGE_UV 0
97
98struct omap_vc_param omap4_mpu_vc_data = {
99 .on = OMAP4_ON_VOLTAGE_UV,
100 .onlp = OMAP4_ONLP_VOLTAGE_UV,
101 .ret = OMAP4_RET_VOLTAGE_UV,
102 .off = OMAP4_OFF_VOLTAGE_UV,
103};
104
105struct omap_vc_param omap4_iva_vc_data = {
106 .on = OMAP4_ON_VOLTAGE_UV,
107 .onlp = OMAP4_ONLP_VOLTAGE_UV,
108 .ret = OMAP4_RET_VOLTAGE_UV,
109 .off = OMAP4_OFF_VOLTAGE_UV,
110};
111
112struct omap_vc_param omap4_core_vc_data = {
113 .on = OMAP4_ON_VOLTAGE_UV,
114 .onlp = OMAP4_ONLP_VOLTAGE_UV,
115 .ret = OMAP4_RET_VOLTAGE_UV,
116 .off = OMAP4_OFF_VOLTAGE_UV,
117};
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index a3607b83790d..697095551bb6 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -74,6 +74,8 @@ struct voltagedomain {
74 const struct omap_vfsm_instance *vfsm; 74 const struct omap_vfsm_instance *vfsm;
75 struct omap_vp_instance *vp; 75 struct omap_vp_instance *vp;
76 struct omap_voltdm_pmic *pmic; 76 struct omap_voltdm_pmic *pmic;
77 struct omap_vp_param *vp_param;
78 struct omap_vc_param *vc_param;
77 79
78 /* VC/VP register access functions: SoC specific */ 80 /* VC/VP register access functions: SoC specific */
79 u32 (*read) (u8 offset); 81 u32 (*read) (u8 offset);
@@ -125,10 +127,6 @@ struct voltagedomain {
125struct omap_voltdm_pmic { 127struct omap_voltdm_pmic {
126 int slew_rate; 128 int slew_rate;
127 int step_size; 129 int step_size;
128 u32 on_volt;
129 u32 onlp_volt;
130 u32 ret_volt;
131 u32 off_volt;
132 u16 volt_setup_time; 130 u16 volt_setup_time;
133 u16 i2c_slave_addr; 131 u16 i2c_slave_addr;
134 u16 volt_reg_addr; 132 u16 volt_reg_addr;
@@ -145,6 +143,18 @@ struct omap_voltdm_pmic {
145 u8 (*uv_to_vsel) (unsigned long uV); 143 u8 (*uv_to_vsel) (unsigned long uV);
146}; 144};
147 145
146struct omap_vp_param {
147 u32 vddmax;
148 u32 vddmin;
149};
150
151struct omap_vc_param {
152 u32 on;
153 u32 onlp;
154 u32 ret;
155 u32 off;
156};
157
148void omap_voltage_get_volttable(struct voltagedomain *voltdm, 158void omap_voltage_get_volttable(struct voltagedomain *voltdm,
149 struct omap_volt_data **volt_data); 159 struct omap_volt_data **volt_data);
150struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, 160struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index 63afbfed3cbc..261bb7cb4e60 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -117,6 +117,11 @@ void __init omap3xxx_voltagedomains_init(void)
117 } 117 }
118#endif 118#endif
119 119
120 omap3_voltdm_mpu.vp_param = &omap3_mpu_vp_data;
121 omap3_voltdm_core.vp_param = &omap3_core_vp_data;
122 omap3_voltdm_mpu.vc_param = &omap3_mpu_vc_data;
123 omap3_voltdm_core.vc_param = &omap3_core_vc_data;
124
120 if (soc_is_am35xx()) 125 if (soc_is_am35xx())
121 voltdms = voltagedomains_am35xx; 126 voltdms = voltagedomains_am35xx;
122 else 127 else
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index c3115f6853d4..a2d7d9ca2380 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -106,6 +106,14 @@ void __init omap44xx_voltagedomains_init(void)
106 omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data; 106 omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data;
107#endif 107#endif
108 108
109 omap4_voltdm_mpu.vp_param = &omap4_mpu_vp_data;
110 omap4_voltdm_iva.vp_param = &omap4_iva_vp_data;
111 omap4_voltdm_core.vp_param = &omap4_core_vp_data;
112
113 omap4_voltdm_mpu.vc_param = &omap4_mpu_vc_data;
114 omap4_voltdm_iva.vc_param = &omap4_iva_vc_data;
115 omap4_voltdm_core.vc_param = &omap4_core_vc_data;
116
109 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++) 117 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
110 voltdm->sys_clk.name = sys_clk_name; 118 voltdm->sys_clk.name = sys_clk_name;
111 119
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h
index 7c155d248aa3..0fdf7080e4a6 100644
--- a/arch/arm/mach-omap2/vp.h
+++ b/arch/arm/mach-omap2/vp.h
@@ -117,6 +117,13 @@ extern struct omap_vp_instance omap4_vp_mpu;
117extern struct omap_vp_instance omap4_vp_iva; 117extern struct omap_vp_instance omap4_vp_iva;
118extern struct omap_vp_instance omap4_vp_core; 118extern struct omap_vp_instance omap4_vp_core;
119 119
120extern struct omap_vp_param omap3_mpu_vp_data;
121extern struct omap_vp_param omap3_core_vp_data;
122
123extern struct omap_vp_param omap4_mpu_vp_data;
124extern struct omap_vp_param omap4_iva_vp_data;
125extern struct omap_vp_param omap4_core_vp_data;
126
120void omap_vp_init(struct voltagedomain *voltdm); 127void omap_vp_init(struct voltagedomain *voltdm);
121void omap_vp_enable(struct voltagedomain *voltdm); 128void omap_vp_enable(struct voltagedomain *voltdm);
122void omap_vp_disable(struct voltagedomain *voltdm); 129void omap_vp_disable(struct voltagedomain *voltdm);
diff --git a/arch/arm/mach-omap2/vp3xxx_data.c b/arch/arm/mach-omap2/vp3xxx_data.c
index bd89f80089f5..1914e026245e 100644
--- a/arch/arm/mach-omap2/vp3xxx_data.c
+++ b/arch/arm/mach-omap2/vp3xxx_data.c
@@ -77,3 +77,13 @@ struct omap_vp_instance omap3_vp_core = {
77 .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET, 77 .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET,
78 .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET, 78 .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET,
79}; 79};
80
81struct omap_vp_param omap3_mpu_vp_data = {
82 .vddmin = OMAP3430_VP1_VLIMITTO_VDDMIN,
83 .vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX,
84};
85
86struct omap_vp_param omap3_core_vp_data = {
87 .vddmin = OMAP3430_VP2_VLIMITTO_VDDMIN,
88 .vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX,
89};
diff --git a/arch/arm/mach-omap2/vp44xx_data.c b/arch/arm/mach-omap2/vp44xx_data.c
index 8c031d16879e..e62f6b018beb 100644
--- a/arch/arm/mach-omap2/vp44xx_data.c
+++ b/arch/arm/mach-omap2/vp44xx_data.c
@@ -87,3 +87,18 @@ struct omap_vp_instance omap4_vp_core = {
87 .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET, 87 .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
88 .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET, 88 .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
89}; 89};
90
91struct omap_vp_param omap4_mpu_vp_data = {
92 .vddmin = OMAP4_VP_MPU_VLIMITTO_VDDMIN,
93 .vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX,
94};
95
96struct omap_vp_param omap4_iva_vp_data = {
97 .vddmin = OMAP4_VP_IVA_VLIMITTO_VDDMIN,
98 .vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX,
99};
100
101struct omap_vp_param omap4_core_vp_data = {
102 .vddmin = OMAP4_VP_CORE_VLIMITTO_VDDMIN,
103 .vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX,
104};