Commit 034ae7b4 authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 07d83cc9
...@@ -178,7 +178,10 @@ static int twl_mmc_resume(struct device *dev, int slot) ...@@ -178,7 +178,10 @@ static int twl_mmc_resume(struct device *dev, int slot)
static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd) static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
{ {
int ret; int ret;
u8 vmmc, dev_grp_val; u8 vmmc = 0, dev_grp_val;
if (!vdd)
goto doit;
if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP) { if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP) {
/* VMMC1: max 220 mA. And for 8-bit mode, /* 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,8 +206,7 @@ static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
/* error if VSIM needed */ /* error if VSIM needed */
break; break;
default: default:
vmmc = 0; return -EINVAL;
break;
} }
} else if (c->twl_vmmc_dev_grp == VMMC2_DEV_GRP) { } else if (c->twl_vmmc_dev_grp == VMMC2_DEV_GRP) {
/* VMMC2: max 100 mA */ /* VMMC2: max 100 mA */
...@@ -230,21 +232,21 @@ static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd) ...@@ -230,21 +232,21 @@ static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
vmmc = VMMC2_315V; vmmc = VMMC2_315V;
break; break;
default: default:
vmmc = 0; return -EINVAL;
break;
} }
} else { } else {
return 0; return -EINVAL;
} }
if (vmmc) doit:
if (vdd)
dev_grp_val = VMMC_DEV_GRP_P1; /* Power up */ dev_grp_val = VMMC_DEV_GRP_P1; /* Power up */
else else
dev_grp_val = LDO_CLR; /* Power down */ dev_grp_val = LDO_CLR; /* Power down */
ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
dev_grp_val, c->twl_vmmc_dev_grp); dev_grp_val, c->twl_vmmc_dev_grp);
if (ret) if (ret || !vdd)
return ret; return ret;
ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
......
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