aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2010-02-15 13:03:34 -0500
committerTony Lindgren <tony@atomide.com>2010-02-15 13:03:34 -0500
commitce6f00165d5314698afd04ee20cede156cfcc593 (patch)
treed7df468cf7143cdb99917b5de25a923c4abc2807
parente3df0fb4132fff8717cb0c08403c12138fd3ae39 (diff)
omap: RX51: Remux to pull eMMC lines down when powering off
It has been discovered that, when eMMC is powered off, current will flow from OMAP eMMC data pull-ups to the eMMC voltage supply. Configuring pads for OMAP off-mode does not help because eMMC is powered off independently of OMAP off-mode. Hence the pads are now re-configured when eMMC is powered on or off. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c43
-rw-r--r--arch/arm/mach-omap2/hsmmc.c8
-rw-r--r--arch/arm/mach-omap2/hsmmc.h2
-rw-r--r--arch/arm/plat-omap/include/plat/mmc.h1
4 files changed, 53 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index ab07ca2d4085..4377a4cf36eb 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -209,6 +209,46 @@ static struct twl4030_madc_platform_data rx51_madc_data = {
209 .irq_line = 1, 209 .irq_line = 1,
210}; 210};
211 211
212/* Enable input logic and pull all lines up when eMMC is on. */
213static struct omap_board_mux rx51_mmc2_on_mux[] = {
214 OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
215 OMAP3_MUX(SDMMC2_DAT0, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
216 OMAP3_MUX(SDMMC2_DAT1, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
217 OMAP3_MUX(SDMMC2_DAT2, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
218 OMAP3_MUX(SDMMC2_DAT3, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
219 OMAP3_MUX(SDMMC2_DAT4, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
220 OMAP3_MUX(SDMMC2_DAT5, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
221 OMAP3_MUX(SDMMC2_DAT6, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
222 OMAP3_MUX(SDMMC2_DAT7, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
223 { .reg_offset = OMAP_MUX_TERMINATOR },
224};
225
226/* Disable input logic and pull all lines down when eMMC is off. */
227static struct omap_board_mux rx51_mmc2_off_mux[] = {
228 OMAP3_MUX(SDMMC2_CMD, OMAP_PULL_ENA | OMAP_MUX_MODE0),
229 OMAP3_MUX(SDMMC2_DAT0, OMAP_PULL_ENA | OMAP_MUX_MODE0),
230 OMAP3_MUX(SDMMC2_DAT1, OMAP_PULL_ENA | OMAP_MUX_MODE0),
231 OMAP3_MUX(SDMMC2_DAT2, OMAP_PULL_ENA | OMAP_MUX_MODE0),
232 OMAP3_MUX(SDMMC2_DAT3, OMAP_PULL_ENA | OMAP_MUX_MODE0),
233 OMAP3_MUX(SDMMC2_DAT4, OMAP_PULL_ENA | OMAP_MUX_MODE0),
234 OMAP3_MUX(SDMMC2_DAT5, OMAP_PULL_ENA | OMAP_MUX_MODE0),
235 OMAP3_MUX(SDMMC2_DAT6, OMAP_PULL_ENA | OMAP_MUX_MODE0),
236 OMAP3_MUX(SDMMC2_DAT7, OMAP_PULL_ENA | OMAP_MUX_MODE0),
237 { .reg_offset = OMAP_MUX_TERMINATOR },
238};
239
240/*
241 * Current flows to eMMC when eMMC is off and the data lines are pulled up,
242 * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
243 */
244static void rx51_mmc2_remux(struct device *dev, int slot, int power_on)
245{
246 if (power_on)
247 omap_mux_write_array(rx51_mmc2_on_mux);
248 else
249 omap_mux_write_array(rx51_mmc2_off_mux);
250}
251
212static struct omap2_hsmmc_info mmc[] __initdata = { 252static struct omap2_hsmmc_info mmc[] __initdata = {
213 { 253 {
214 .name = "external", 254 .name = "external",
@@ -222,11 +262,12 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
222 { 262 {
223 .name = "internal", 263 .name = "internal",
224 .mmc = 2, 264 .mmc = 2,
225 .wires = 8, 265 .wires = 8, /* See also rx51_mmc2_remux */
226 .gpio_cd = -EINVAL, 266 .gpio_cd = -EINVAL,
227 .gpio_wp = -EINVAL, 267 .gpio_wp = -EINVAL,
228 .nonremovable = true, 268 .nonremovable = true,
229 .power_saving = true, 269 .power_saving = true,
270 .remux = rx51_mmc2_remux,
230 }, 271 },
231 {} /* Terminator */ 272 {} /* Terminator */
232}; 273};
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index cc7e77f09268..4a05c3722d54 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -48,6 +48,9 @@ static void hsmmc1_before_set_reg(struct device *dev, int slot,
48 u32 reg, prog_io; 48 u32 reg, prog_io;
49 struct omap_mmc_platform_data *mmc = dev->platform_data; 49 struct omap_mmc_platform_data *mmc = dev->platform_data;
50 50
51 if (mmc->slots[0].remux)
52 mmc->slots[0].remux(dev, slot, power_on);
53
51 /* 54 /*
52 * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the 55 * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the
53 * card with Vcc regulator (from twl4030 or whatever). OMAP has both 56 * card with Vcc regulator (from twl4030 or whatever). OMAP has both
@@ -121,6 +124,9 @@ static void hsmmc23_before_set_reg(struct device *dev, int slot,
121{ 124{
122 struct omap_mmc_platform_data *mmc = dev->platform_data; 125 struct omap_mmc_platform_data *mmc = dev->platform_data;
123 126
127 if (mmc->slots[0].remux)
128 mmc->slots[0].remux(dev, slot, power_on);
129
124 if (power_on) { 130 if (power_on) {
125 /* Only MMC2 supports a CLKIN */ 131 /* Only MMC2 supports a CLKIN */
126 if (mmc->slots[0].internal_clock) { 132 if (mmc->slots[0].internal_clock) {
@@ -185,6 +191,8 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
185 mmc->slots[0].switch_pin = c->gpio_cd; 191 mmc->slots[0].switch_pin = c->gpio_cd;
186 mmc->slots[0].gpio_wp = c->gpio_wp; 192 mmc->slots[0].gpio_wp = c->gpio_wp;
187 193
194 mmc->slots[0].remux = c->remux;
195
188 if (c->cover_only) 196 if (c->cover_only)
189 mmc->slots[0].cover = 1; 197 mmc->slots[0].cover = 1;
190 198
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index e946b5f79be1..f641f592ffad 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -19,6 +19,8 @@ struct omap2_hsmmc_info {
19 char *name; /* or NULL for default */ 19 char *name; /* or NULL for default */
20 struct device *dev; /* returned: pointer to mmc adapter */ 20 struct device *dev; /* returned: pointer to mmc adapter */
21 int ocr_mask; /* temporary HACK */ 21 int ocr_mask; /* temporary HACK */
22 /* Remux (pad configuation) when powering on/off */
23 void (*remux)(struct device *dev, int slot, int power_on);
22}; 24};
23 25
24#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) 26#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index 515701bb47d2..8b23d32895f1 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -105,6 +105,7 @@ struct omap_mmc_platform_data {
105 int (*get_ro)(struct device *dev, int slot); 105 int (*get_ro)(struct device *dev, int slot);
106 int (*set_sleep)(struct device *dev, int slot, int sleep, 106 int (*set_sleep)(struct device *dev, int slot, int sleep,
107 int vdd, int cardsleep); 107 int vdd, int cardsleep);
108 void (*remux)(struct device *dev, int slot, int power_on);
108 /* Call back before enabling / disabling regulators */ 109 /* Call back before enabling / disabling regulators */
109 void (*before_set_reg)(struct device *dev, int slot, 110 void (*before_set_reg)(struct device *dev, int slot,
110 int power_on, int vdd); 111 int power_on, int vdd);