diff options
Diffstat (limited to 'arch/arm/mach-omap2/mmc-twl4030.c')
-rw-r--r-- | arch/arm/mach-omap2/mmc-twl4030.c | 18 |
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) | |||
178 | static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd) | 178 | static 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) | 241 | doit: |
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, |