aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/mmc-twl4030.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-03-23 21:23:48 -0400
committerTony Lindgren <tony@atomide.com>2009-03-23 21:51:23 -0400
commit034ae7b41720a26cadd4b2f02bf0b23e79240344 (patch)
treed38884c588e3c0ebd18f3f7a8078c69d325c9da0 /arch/arm/mach-omap2/mmc-twl4030.c
parent07d83cc9c839a5f05c7c1b6d823a8f483bda0441 (diff)
ARM: OMAP3: mmc-twl4030 fix for vmmc = 0
Resolve longstanding issue noted by Adrian Hunter: confusion between settting VSEL=0 (which is 1.8V on MMC1) and poweroff. Also, leave VSEL alone if we're just powering the regulator off. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/mmc-twl4030.c')
-rw-r--r--arch/arm/mach-omap2/mmc-twl4030.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c
index d9fad8dda152..d43421400e9d 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -178,7 +178,10 @@ static int twl_mmc_resume(struct device *dev, int slot)
178static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd) 178static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
179{ 179{
180 int ret; 180 int ret;
181 u8 vmmc, dev_grp_val; 181 u8 vmmc = 0, dev_grp_val;
182
183 if (!vdd)
184 goto doit;
182 185
183 if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP) { 186 if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP) {
184 /* VMMC1: max 220 mA. And for 8-bit mode, 187 /* VMMC1: max 220 mA. And for 8-bit mode,
@@ -203,8 +206,7 @@ static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
203 /* error if VSIM needed */ 206 /* error if VSIM needed */
204 break; 207 break;
205 default: 208 default:
206 vmmc = 0; 209 return -EINVAL;
207 break;
208 } 210 }
209 } else if (c->twl_vmmc_dev_grp == VMMC2_DEV_GRP) { 211 } else if (c->twl_vmmc_dev_grp == VMMC2_DEV_GRP) {
210 /* VMMC2: max 100 mA */ 212 /* VMMC2: max 100 mA */
@@ -230,21 +232,21 @@ static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
230 vmmc = VMMC2_315V; 232 vmmc = VMMC2_315V;
231 break; 233 break;
232 default: 234 default:
233 vmmc = 0; 235 return -EINVAL;
234 break;
235 } 236 }
236 } else { 237 } else {
237 return 0; 238 return -EINVAL;
238 } 239 }
239 240
240 if (vmmc) 241doit:
242 if (vdd)
241 dev_grp_val = VMMC_DEV_GRP_P1; /* Power up */ 243 dev_grp_val = VMMC_DEV_GRP_P1; /* Power up */
242 else 244 else
243 dev_grp_val = LDO_CLR; /* Power down */ 245 dev_grp_val = LDO_CLR; /* Power down */
244 246
245 ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 247 ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
246 dev_grp_val, c->twl_vmmc_dev_grp); 248 dev_grp_val, c->twl_vmmc_dev_grp);
247 if (ret) 249 if (ret || !vdd)
248 return ret; 250 return ret;
249 251
250 ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 252 ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,