diff options
Diffstat (limited to 'arch/arm/mach-omap2/omap_twl.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_twl.c | 107 |
1 files changed, 63 insertions, 44 deletions
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c index 07d6140baa9d..f515a1a056d5 100644 --- a/arch/arm/mach-omap2/omap_twl.c +++ b/arch/arm/mach-omap2/omap_twl.c | |||
@@ -42,8 +42,11 @@ | |||
42 | 42 | ||
43 | #define OMAP4_SRI2C_SLAVE_ADDR 0x12 | 43 | #define OMAP4_SRI2C_SLAVE_ADDR 0x12 |
44 | #define OMAP4_VDD_MPU_SR_VOLT_REG 0x55 | 44 | #define OMAP4_VDD_MPU_SR_VOLT_REG 0x55 |
45 | #define OMAP4_VDD_MPU_SR_CMD_REG 0x56 | ||
45 | #define OMAP4_VDD_IVA_SR_VOLT_REG 0x5B | 46 | #define OMAP4_VDD_IVA_SR_VOLT_REG 0x5B |
47 | #define OMAP4_VDD_IVA_SR_CMD_REG 0x5C | ||
46 | #define OMAP4_VDD_CORE_SR_VOLT_REG 0x61 | 48 | #define OMAP4_VDD_CORE_SR_VOLT_REG 0x61 |
49 | #define OMAP4_VDD_CORE_SR_CMD_REG 0x62 | ||
47 | 50 | ||
48 | #define OMAP4_VP_CONFIG_ERROROFFSET 0x00 | 51 | #define OMAP4_VP_CONFIG_ERROROFFSET 0x00 |
49 | #define OMAP4_VP_VSTEPMIN_VSTEPMIN 0x01 | 52 | #define OMAP4_VP_VSTEPMIN_VSTEPMIN 0x01 |
@@ -95,6 +98,8 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel) | |||
95 | is_offset_valid = true; | 98 | is_offset_valid = true; |
96 | } | 99 | } |
97 | 100 | ||
101 | if (!vsel) | ||
102 | return 0; | ||
98 | /* | 103 | /* |
99 | * There is no specific formula for voltage to vsel | 104 | * There is no specific formula for voltage to vsel |
100 | * conversion above 1.3V. There are special hardcoded | 105 | * conversion above 1.3V. There are special hardcoded |
@@ -106,9 +111,9 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel) | |||
106 | return 1350000; | 111 | return 1350000; |
107 | 112 | ||
108 | if (smps_offset & 0x8) | 113 | if (smps_offset & 0x8) |
109 | return ((((vsel - 1) * 125) + 7000)) * 100; | 114 | return ((((vsel - 1) * 1266) + 70900)) * 10; |
110 | else | 115 | else |
111 | return ((((vsel - 1) * 125) + 6000)) * 100; | 116 | return ((((vsel - 1) * 1266) + 60770)) * 10; |
112 | } | 117 | } |
113 | 118 | ||
114 | static u8 twl6030_uv_to_vsel(unsigned long uv) | 119 | static u8 twl6030_uv_to_vsel(unsigned long uv) |
@@ -127,6 +132,8 @@ static u8 twl6030_uv_to_vsel(unsigned long uv) | |||
127 | is_offset_valid = true; | 132 | is_offset_valid = true; |
128 | } | 133 | } |
129 | 134 | ||
135 | if (!uv) | ||
136 | return 0x00; | ||
130 | /* | 137 | /* |
131 | * There is no specific formula for voltage to vsel | 138 | * There is no specific formula for voltage to vsel |
132 | * conversion above 1.3V. There are special hardcoded | 139 | * conversion above 1.3V. There are special hardcoded |
@@ -134,16 +141,21 @@ static u8 twl6030_uv_to_vsel(unsigned long uv) | |||
134 | * hardcoding only for 1.35 V which is used for 1GH OPP for | 141 | * hardcoding only for 1.35 V which is used for 1GH OPP for |
135 | * OMAP4430. | 142 | * OMAP4430. |
136 | */ | 143 | */ |
137 | if (uv == 1350000) | 144 | if (uv > twl6030_vsel_to_uv(0x39)) { |
145 | if (uv == 1350000) | ||
146 | return 0x3A; | ||
147 | pr_err("%s:OUT OF RANGE! non mapped vsel for %ld Vs max %ld\n", | ||
148 | __func__, uv, twl6030_vsel_to_uv(0x39)); | ||
138 | return 0x3A; | 149 | return 0x3A; |
150 | } | ||
139 | 151 | ||
140 | if (smps_offset & 0x8) | 152 | if (smps_offset & 0x8) |
141 | return DIV_ROUND_UP(uv - 700000, 12500) + 1; | 153 | return DIV_ROUND_UP(uv - 709000, 12660) + 1; |
142 | else | 154 | else |
143 | return DIV_ROUND_UP(uv - 600000, 12500) + 1; | 155 | return DIV_ROUND_UP(uv - 607700, 12660) + 1; |
144 | } | 156 | } |
145 | 157 | ||
146 | static struct omap_volt_pmic_info omap3_mpu_volt_info = { | 158 | static struct omap_voltdm_pmic omap3_mpu_pmic = { |
147 | .slew_rate = 4000, | 159 | .slew_rate = 4000, |
148 | .step_size = 12500, | 160 | .step_size = 12500, |
149 | .on_volt = 1200000, | 161 | .on_volt = 1200000, |
@@ -158,12 +170,13 @@ static struct omap_volt_pmic_info omap3_mpu_volt_info = { | |||
158 | .vp_vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX, | 170 | .vp_vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX, |
159 | .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, | 171 | .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, |
160 | .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, | 172 | .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, |
161 | .pmic_reg = OMAP3_VDD_MPU_SR_CONTROL_REG, | 173 | .volt_reg_addr = OMAP3_VDD_MPU_SR_CONTROL_REG, |
174 | .i2c_high_speed = true, | ||
162 | .vsel_to_uv = twl4030_vsel_to_uv, | 175 | .vsel_to_uv = twl4030_vsel_to_uv, |
163 | .uv_to_vsel = twl4030_uv_to_vsel, | 176 | .uv_to_vsel = twl4030_uv_to_vsel, |
164 | }; | 177 | }; |
165 | 178 | ||
166 | static struct omap_volt_pmic_info omap3_core_volt_info = { | 179 | static struct omap_voltdm_pmic omap3_core_pmic = { |
167 | .slew_rate = 4000, | 180 | .slew_rate = 4000, |
168 | .step_size = 12500, | 181 | .step_size = 12500, |
169 | .on_volt = 1200000, | 182 | .on_volt = 1200000, |
@@ -178,18 +191,19 @@ static struct omap_volt_pmic_info omap3_core_volt_info = { | |||
178 | .vp_vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX, | 191 | .vp_vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX, |
179 | .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, | 192 | .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, |
180 | .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, | 193 | .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, |
181 | .pmic_reg = OMAP3_VDD_CORE_SR_CONTROL_REG, | 194 | .volt_reg_addr = OMAP3_VDD_CORE_SR_CONTROL_REG, |
195 | .i2c_high_speed = true, | ||
182 | .vsel_to_uv = twl4030_vsel_to_uv, | 196 | .vsel_to_uv = twl4030_vsel_to_uv, |
183 | .uv_to_vsel = twl4030_uv_to_vsel, | 197 | .uv_to_vsel = twl4030_uv_to_vsel, |
184 | }; | 198 | }; |
185 | 199 | ||
186 | static struct omap_volt_pmic_info omap4_mpu_volt_info = { | 200 | static struct omap_voltdm_pmic omap4_mpu_pmic = { |
187 | .slew_rate = 4000, | 201 | .slew_rate = 4000, |
188 | .step_size = 12500, | 202 | .step_size = 12660, |
189 | .on_volt = 1350000, | 203 | .on_volt = 1375000, |
190 | .onlp_volt = 1350000, | 204 | .onlp_volt = 1375000, |
191 | .ret_volt = 837500, | 205 | .ret_volt = 830000, |
192 | .off_volt = 600000, | 206 | .off_volt = 0, |
193 | .volt_setup_time = 0, | 207 | .volt_setup_time = 0, |
194 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, | 208 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, |
195 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, | 209 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, |
@@ -198,18 +212,20 @@ static struct omap_volt_pmic_info omap4_mpu_volt_info = { | |||
198 | .vp_vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX, | 212 | .vp_vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX, |
199 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, | 213 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, |
200 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, | 214 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, |
201 | .pmic_reg = OMAP4_VDD_MPU_SR_VOLT_REG, | 215 | .volt_reg_addr = OMAP4_VDD_MPU_SR_VOLT_REG, |
216 | .cmd_reg_addr = OMAP4_VDD_MPU_SR_CMD_REG, | ||
217 | .i2c_high_speed = true, | ||
202 | .vsel_to_uv = twl6030_vsel_to_uv, | 218 | .vsel_to_uv = twl6030_vsel_to_uv, |
203 | .uv_to_vsel = twl6030_uv_to_vsel, | 219 | .uv_to_vsel = twl6030_uv_to_vsel, |
204 | }; | 220 | }; |
205 | 221 | ||
206 | static struct omap_volt_pmic_info omap4_iva_volt_info = { | 222 | static struct omap_voltdm_pmic omap4_iva_pmic = { |
207 | .slew_rate = 4000, | 223 | .slew_rate = 4000, |
208 | .step_size = 12500, | 224 | .step_size = 12660, |
209 | .on_volt = 1100000, | 225 | .on_volt = 1188000, |
210 | .onlp_volt = 1100000, | 226 | .onlp_volt = 1188000, |
211 | .ret_volt = 837500, | 227 | .ret_volt = 830000, |
212 | .off_volt = 600000, | 228 | .off_volt = 0, |
213 | .volt_setup_time = 0, | 229 | .volt_setup_time = 0, |
214 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, | 230 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, |
215 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, | 231 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, |
@@ -218,18 +234,20 @@ static struct omap_volt_pmic_info omap4_iva_volt_info = { | |||
218 | .vp_vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX, | 234 | .vp_vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX, |
219 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, | 235 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, |
220 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, | 236 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, |
221 | .pmic_reg = OMAP4_VDD_IVA_SR_VOLT_REG, | 237 | .volt_reg_addr = OMAP4_VDD_IVA_SR_VOLT_REG, |
238 | .cmd_reg_addr = OMAP4_VDD_IVA_SR_CMD_REG, | ||
239 | .i2c_high_speed = true, | ||
222 | .vsel_to_uv = twl6030_vsel_to_uv, | 240 | .vsel_to_uv = twl6030_vsel_to_uv, |
223 | .uv_to_vsel = twl6030_uv_to_vsel, | 241 | .uv_to_vsel = twl6030_uv_to_vsel, |
224 | }; | 242 | }; |
225 | 243 | ||
226 | static struct omap_volt_pmic_info omap4_core_volt_info = { | 244 | static struct omap_voltdm_pmic omap4_core_pmic = { |
227 | .slew_rate = 4000, | 245 | .slew_rate = 4000, |
228 | .step_size = 12500, | 246 | .step_size = 12660, |
229 | .on_volt = 1100000, | 247 | .on_volt = 1200000, |
230 | .onlp_volt = 1100000, | 248 | .onlp_volt = 1200000, |
231 | .ret_volt = 837500, | 249 | .ret_volt = 830000, |
232 | .off_volt = 600000, | 250 | .off_volt = 0, |
233 | .volt_setup_time = 0, | 251 | .volt_setup_time = 0, |
234 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, | 252 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, |
235 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, | 253 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, |
@@ -238,7 +256,8 @@ static struct omap_volt_pmic_info omap4_core_volt_info = { | |||
238 | .vp_vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX, | 256 | .vp_vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX, |
239 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, | 257 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, |
240 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, | 258 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, |
241 | .pmic_reg = OMAP4_VDD_CORE_SR_VOLT_REG, | 259 | .volt_reg_addr = OMAP4_VDD_CORE_SR_VOLT_REG, |
260 | .cmd_reg_addr = OMAP4_VDD_CORE_SR_CMD_REG, | ||
242 | .vsel_to_uv = twl6030_vsel_to_uv, | 261 | .vsel_to_uv = twl6030_vsel_to_uv, |
243 | .uv_to_vsel = twl6030_uv_to_vsel, | 262 | .uv_to_vsel = twl6030_uv_to_vsel, |
244 | }; | 263 | }; |
@@ -250,14 +269,14 @@ int __init omap4_twl_init(void) | |||
250 | if (!cpu_is_omap44xx()) | 269 | if (!cpu_is_omap44xx()) |
251 | return -ENODEV; | 270 | return -ENODEV; |
252 | 271 | ||
253 | voltdm = omap_voltage_domain_lookup("mpu"); | 272 | voltdm = voltdm_lookup("mpu"); |
254 | omap_voltage_register_pmic(voltdm, &omap4_mpu_volt_info); | 273 | omap_voltage_register_pmic(voltdm, &omap4_mpu_pmic); |
255 | 274 | ||
256 | voltdm = omap_voltage_domain_lookup("iva"); | 275 | voltdm = voltdm_lookup("iva"); |
257 | omap_voltage_register_pmic(voltdm, &omap4_iva_volt_info); | 276 | omap_voltage_register_pmic(voltdm, &omap4_iva_pmic); |
258 | 277 | ||
259 | voltdm = omap_voltage_domain_lookup("core"); | 278 | voltdm = voltdm_lookup("core"); |
260 | omap_voltage_register_pmic(voltdm, &omap4_core_volt_info); | 279 | omap_voltage_register_pmic(voltdm, &omap4_core_pmic); |
261 | 280 | ||
262 | return 0; | 281 | return 0; |
263 | } | 282 | } |
@@ -270,10 +289,10 @@ int __init omap3_twl_init(void) | |||
270 | return -ENODEV; | 289 | return -ENODEV; |
271 | 290 | ||
272 | if (cpu_is_omap3630()) { | 291 | if (cpu_is_omap3630()) { |
273 | omap3_mpu_volt_info.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN; | 292 | omap3_mpu_pmic.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN; |
274 | omap3_mpu_volt_info.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX; | 293 | omap3_mpu_pmic.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX; |
275 | omap3_core_volt_info.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN; | 294 | omap3_core_pmic.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN; |
276 | omap3_core_volt_info.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX; | 295 | omap3_core_pmic.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX; |
277 | } | 296 | } |
278 | 297 | ||
279 | /* | 298 | /* |
@@ -288,11 +307,11 @@ int __init omap3_twl_init(void) | |||
288 | if (!twl_sr_enable_autoinit) | 307 | if (!twl_sr_enable_autoinit) |
289 | omap3_twl_set_sr_bit(true); | 308 | omap3_twl_set_sr_bit(true); |
290 | 309 | ||
291 | voltdm = omap_voltage_domain_lookup("mpu"); | 310 | voltdm = voltdm_lookup("mpu_iva"); |
292 | omap_voltage_register_pmic(voltdm, &omap3_mpu_volt_info); | 311 | omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic); |
293 | 312 | ||
294 | voltdm = omap_voltage_domain_lookup("core"); | 313 | voltdm = voltdm_lookup("core"); |
295 | omap_voltage_register_pmic(voltdm, &omap3_core_volt_info); | 314 | omap_voltage_register_pmic(voltdm, &omap3_core_pmic); |
296 | 315 | ||
297 | return 0; | 316 | return 0; |
298 | } | 317 | } |