diff options
author | Tony Lindgren <tony@atomide.com> | 2014-05-06 16:48:02 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2014-05-06 16:48:02 -0400 |
commit | 08eb9a8c8a01e7bd689aeb05e51ac945f0adaf61 (patch) | |
tree | b869c556bc425cf965ad93619a2a0cc32e0427cb | |
parent | 89ca3b881987f5a4be4c5dbaa7f0df12bbdde2fd (diff) | |
parent | a613b739b8c08eab811e677810045cc0522fc3e6 (diff) |
Merge tag 'ib-mfd-omap-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into omap-for-v3.16/pm
Immutable branch between MFD and ARM OMAP due for v3.16 merge-window.
-rw-r--r-- | arch/arm/mach-omap2/omap_twl.c | 60 | ||||
-rw-r--r-- | drivers/mfd/twl-core.c | 15 |
2 files changed, 15 insertions, 60 deletions
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c index 615e5b1fb025..6bf626700557 100644 --- a/arch/arm/mach-omap2/omap_twl.c +++ b/arch/arm/mach-omap2/omap_twl.c | |||
@@ -46,15 +46,8 @@ | |||
46 | 46 | ||
47 | static bool is_offset_valid; | 47 | static bool is_offset_valid; |
48 | static u8 smps_offset; | 48 | static u8 smps_offset; |
49 | /* | ||
50 | * Flag to ensure Smartreflex bit in TWL | ||
51 | * being cleared in board file is not overwritten. | ||
52 | */ | ||
53 | static bool __initdata twl_sr_enable_autoinit; | ||
54 | 49 | ||
55 | #define TWL4030_DCDC_GLOBAL_CFG 0x06 | ||
56 | #define REG_SMPS_OFFSET 0xE0 | 50 | #define REG_SMPS_OFFSET 0xE0 |
57 | #define SMARTREFLEX_ENABLE BIT(3) | ||
58 | 51 | ||
59 | static unsigned long twl4030_vsel_to_uv(const u8 vsel) | 52 | static unsigned long twl4030_vsel_to_uv(const u8 vsel) |
60 | { | 53 | { |
@@ -251,18 +244,6 @@ int __init omap3_twl_init(void) | |||
251 | if (!cpu_is_omap34xx()) | 244 | if (!cpu_is_omap34xx()) |
252 | return -ENODEV; | 245 | return -ENODEV; |
253 | 246 | ||
254 | /* | ||
255 | * The smartreflex bit on twl4030 specifies if the setting of voltage | ||
256 | * is done over the I2C_SR path. Since this setting is independent of | ||
257 | * the actual usage of smartreflex AVS module, we enable TWL SR bit | ||
258 | * by default irrespective of whether smartreflex AVS module is enabled | ||
259 | * on the OMAP side or not. This is because without this bit enabled, | ||
260 | * the voltage scaling through vp forceupdate/bypass mechanism of | ||
261 | * voltage scaling will not function on TWL over I2C_SR. | ||
262 | */ | ||
263 | if (!twl_sr_enable_autoinit) | ||
264 | omap3_twl_set_sr_bit(true); | ||
265 | |||
266 | voltdm = voltdm_lookup("mpu_iva"); | 247 | voltdm = voltdm_lookup("mpu_iva"); |
267 | omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic); | 248 | omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic); |
268 | 249 | ||
@@ -271,44 +252,3 @@ int __init omap3_twl_init(void) | |||
271 | 252 | ||
272 | return 0; | 253 | return 0; |
273 | } | 254 | } |
274 | |||
275 | /** | ||
276 | * omap3_twl_set_sr_bit() - Set/Clear SR bit on TWL | ||
277 | * @enable: enable SR mode in twl or not | ||
278 | * | ||
279 | * If 'enable' is true, enables Smartreflex bit on TWL 4030 to make sure | ||
280 | * voltage scaling through OMAP SR works. Else, the smartreflex bit | ||
281 | * on twl4030 is cleared as there are platforms which use OMAP3 and T2 but | ||
282 | * use Synchronized Scaling Hardware Strategy (ENABLE_VMODE=1) and Direct | ||
283 | * Strategy Software Scaling Mode (ENABLE_VMODE=0), for setting the voltages, | ||
284 | * in those scenarios this bit is to be cleared (enable = false). | ||
285 | * | ||
286 | * Returns 0 on success, error is returned if I2C read/write fails. | ||
287 | */ | ||
288 | int __init omap3_twl_set_sr_bit(bool enable) | ||
289 | { | ||
290 | u8 temp; | ||
291 | int ret; | ||
292 | if (twl_sr_enable_autoinit) | ||
293 | pr_warning("%s: unexpected multiple calls\n", __func__); | ||
294 | |||
295 | ret = twl_i2c_read_u8(TWL_MODULE_PM_RECEIVER, &temp, | ||
296 | TWL4030_DCDC_GLOBAL_CFG); | ||
297 | if (ret) | ||
298 | goto err; | ||
299 | |||
300 | if (enable) | ||
301 | temp |= SMARTREFLEX_ENABLE; | ||
302 | else | ||
303 | temp &= ~SMARTREFLEX_ENABLE; | ||
304 | |||
305 | ret = twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, temp, | ||
306 | TWL4030_DCDC_GLOBAL_CFG); | ||
307 | if (!ret) { | ||
308 | twl_sr_enable_autoinit = true; | ||
309 | return 0; | ||
310 | } | ||
311 | err: | ||
312 | pr_err("%s: Error access to TWL4030 (%d)\n", __func__, ret); | ||
313 | return ret; | ||
314 | } | ||
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index e87140bef667..db11b4f40611 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
@@ -98,7 +98,11 @@ | |||
98 | #define TWL4030_BASEADD_BACKUP 0x0014 | 98 | #define TWL4030_BASEADD_BACKUP 0x0014 |
99 | #define TWL4030_BASEADD_INT 0x002E | 99 | #define TWL4030_BASEADD_INT 0x002E |
100 | #define TWL4030_BASEADD_PM_MASTER 0x0036 | 100 | #define TWL4030_BASEADD_PM_MASTER 0x0036 |
101 | |||
101 | #define TWL4030_BASEADD_PM_RECEIVER 0x005B | 102 | #define TWL4030_BASEADD_PM_RECEIVER 0x005B |
103 | #define TWL4030_DCDC_GLOBAL_CFG 0x06 | ||
104 | #define SMARTREFLEX_ENABLE BIT(3) | ||
105 | |||
102 | #define TWL4030_BASEADD_RTC 0x001C | 106 | #define TWL4030_BASEADD_RTC 0x001C |
103 | #define TWL4030_BASEADD_SECURED_REG 0x0000 | 107 | #define TWL4030_BASEADD_SECURED_REG 0x0000 |
104 | 108 | ||
@@ -1204,6 +1208,11 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1204 | * Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. | 1208 | * Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. |
1205 | * Program I2C_SCL_CTRL_PU(bit 0)=0, I2C_SDA_CTRL_PU (bit 2)=0, | 1209 | * Program I2C_SCL_CTRL_PU(bit 0)=0, I2C_SDA_CTRL_PU (bit 2)=0, |
1206 | * SR_I2C_SCL_CTRL_PU(bit 4)=0 and SR_I2C_SDA_CTRL_PU(bit 6)=0. | 1210 | * SR_I2C_SCL_CTRL_PU(bit 4)=0 and SR_I2C_SDA_CTRL_PU(bit 6)=0. |
1211 | * | ||
1212 | * Also, always enable SmartReflex bit as that's needed for omaps to | ||
1213 | * to do anything over I2C4 for voltage scaling even if SmartReflex | ||
1214 | * is disabled. Without the SmartReflex bit omap sys_clkreq idle | ||
1215 | * signal will never trigger for retention idle. | ||
1207 | */ | 1216 | */ |
1208 | if (twl_class_is_4030()) { | 1217 | if (twl_class_is_4030()) { |
1209 | u8 temp; | 1218 | u8 temp; |
@@ -1212,6 +1221,12 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1212 | temp &= ~(SR_I2C_SDA_CTRL_PU | SR_I2C_SCL_CTRL_PU | \ | 1221 | temp &= ~(SR_I2C_SDA_CTRL_PU | SR_I2C_SCL_CTRL_PU | \ |
1213 | I2C_SDA_CTRL_PU | I2C_SCL_CTRL_PU); | 1222 | I2C_SDA_CTRL_PU | I2C_SCL_CTRL_PU); |
1214 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1); | 1223 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1); |
1224 | |||
1225 | twl_i2c_read_u8(TWL_MODULE_PM_RECEIVER, &temp, | ||
1226 | TWL4030_DCDC_GLOBAL_CFG); | ||
1227 | temp |= SMARTREFLEX_ENABLE; | ||
1228 | twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, temp, | ||
1229 | TWL4030_DCDC_GLOBAL_CFG); | ||
1215 | } | 1230 | } |
1216 | 1231 | ||
1217 | if (node) { | 1232 | if (node) { |