diff options
Diffstat (limited to 'arch/arm/mach-omap2/hsmmc.c')
-rw-r--r-- | arch/arm/mach-omap2/hsmmc.c | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index f4a1020559a7..bd844af13af5 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c | |||
@@ -171,6 +171,17 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot, | |||
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | static void hsmmc2_select_input_clk_src(struct omap_mmc_platform_data *mmc) | ||
175 | { | ||
176 | u32 reg; | ||
177 | |||
178 | if (mmc->slots[0].internal_clock) { | ||
179 | reg = omap_ctrl_readl(control_devconf1_offset); | ||
180 | reg |= OMAP2_MMCSDIO2ADPCLKISEL; | ||
181 | omap_ctrl_writel(reg, control_devconf1_offset); | ||
182 | } | ||
183 | } | ||
184 | |||
174 | static void hsmmc23_before_set_reg(struct device *dev, int slot, | 185 | static void hsmmc23_before_set_reg(struct device *dev, int slot, |
175 | int power_on, int vdd) | 186 | int power_on, int vdd) |
176 | { | 187 | { |
@@ -179,16 +190,19 @@ static void hsmmc23_before_set_reg(struct device *dev, int slot, | |||
179 | if (mmc->slots[0].remux) | 190 | if (mmc->slots[0].remux) |
180 | mmc->slots[0].remux(dev, slot, power_on); | 191 | mmc->slots[0].remux(dev, slot, power_on); |
181 | 192 | ||
182 | if (power_on) { | 193 | if (power_on) |
183 | /* Only MMC2 supports a CLKIN */ | 194 | hsmmc2_select_input_clk_src(mmc); |
184 | if (mmc->slots[0].internal_clock) { | 195 | } |
185 | u32 reg; | ||
186 | 196 | ||
187 | reg = omap_ctrl_readl(control_devconf1_offset); | 197 | static int am35x_hsmmc2_set_power(struct device *dev, int slot, |
188 | reg |= OMAP2_MMCSDIO2ADPCLKISEL; | 198 | int power_on, int vdd) |
189 | omap_ctrl_writel(reg, control_devconf1_offset); | 199 | { |
190 | } | 200 | struct omap_mmc_platform_data *mmc = dev->platform_data; |
191 | } | 201 | |
202 | if (power_on) | ||
203 | hsmmc2_select_input_clk_src(mmc); | ||
204 | |||
205 | return 0; | ||
192 | } | 206 | } |
193 | 207 | ||
194 | static int nop_mmc_set_power(struct device *dev, int slot, int power_on, | 208 | static int nop_mmc_set_power(struct device *dev, int slot, int power_on, |
@@ -200,10 +214,12 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on, | |||
200 | static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, | 214 | static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, |
201 | int controller_nr) | 215 | int controller_nr) |
202 | { | 216 | { |
203 | if (gpio_is_valid(mmc_controller->slots[0].switch_pin)) | 217 | if (gpio_is_valid(mmc_controller->slots[0].switch_pin) && |
218 | (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES)) | ||
204 | omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, | 219 | omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, |
205 | OMAP_PIN_INPUT_PULLUP); | 220 | OMAP_PIN_INPUT_PULLUP); |
206 | if (gpio_is_valid(mmc_controller->slots[0].gpio_wp)) | 221 | if (gpio_is_valid(mmc_controller->slots[0].gpio_wp) && |
222 | (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES)) | ||
207 | omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, | 223 | omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, |
208 | OMAP_PIN_INPUT_PULLUP); | 224 | OMAP_PIN_INPUT_PULLUP); |
209 | if (cpu_is_omap34xx()) { | 225 | if (cpu_is_omap34xx()) { |
@@ -296,6 +312,7 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, | |||
296 | mmc->slots[0].name = hc_name; | 312 | mmc->slots[0].name = hc_name; |
297 | mmc->nr_slots = 1; | 313 | mmc->nr_slots = 1; |
298 | mmc->slots[0].caps = c->caps; | 314 | mmc->slots[0].caps = c->caps; |
315 | mmc->slots[0].pm_caps = c->pm_caps; | ||
299 | mmc->slots[0].internal_clock = !c->ext_clock; | 316 | mmc->slots[0].internal_clock = !c->ext_clock; |
300 | mmc->dma_mask = 0xffffffff; | 317 | mmc->dma_mask = 0xffffffff; |
301 | if (cpu_is_omap44xx()) | 318 | if (cpu_is_omap44xx()) |
@@ -336,11 +353,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, | |||
336 | * | 353 | * |
337 | * temporary HACK: ocr_mask instead of fixed supply | 354 | * temporary HACK: ocr_mask instead of fixed supply |
338 | */ | 355 | */ |
339 | mmc->slots[0].ocr_mask = c->ocr_mask; | 356 | if (cpu_is_omap3505() || cpu_is_omap3517()) |
340 | 357 | mmc->slots[0].ocr_mask = MMC_VDD_165_195 | | |
341 | if (cpu_is_omap3517() || cpu_is_omap3505()) | 358 | MMC_VDD_26_27 | |
342 | mmc->slots[0].set_power = nop_mmc_set_power; | 359 | MMC_VDD_27_28 | |
360 | MMC_VDD_29_30 | | ||
361 | MMC_VDD_30_31 | | ||
362 | MMC_VDD_31_32; | ||
343 | else | 363 | else |
364 | mmc->slots[0].ocr_mask = c->ocr_mask; | ||
365 | |||
366 | if (!cpu_is_omap3517() && !cpu_is_omap3505()) | ||
344 | mmc->slots[0].features |= HSMMC_HAS_PBIAS; | 367 | mmc->slots[0].features |= HSMMC_HAS_PBIAS; |
345 | 368 | ||
346 | if (cpu_is_omap44xx() && (omap_rev() > OMAP4430_REV_ES1_0)) | 369 | if (cpu_is_omap44xx() && (omap_rev() > OMAP4430_REV_ES1_0)) |
@@ -363,6 +386,9 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, | |||
363 | } | 386 | } |
364 | } | 387 | } |
365 | 388 | ||
389 | if (cpu_is_omap3517() || cpu_is_omap3505()) | ||
390 | mmc->slots[0].set_power = nop_mmc_set_power; | ||
391 | |||
366 | /* OMAP3630 HSMMC1 supports only 4-bit */ | 392 | /* OMAP3630 HSMMC1 supports only 4-bit */ |
367 | if (cpu_is_omap3630() && | 393 | if (cpu_is_omap3630() && |
368 | (c->caps & MMC_CAP_8_BIT_DATA)) { | 394 | (c->caps & MMC_CAP_8_BIT_DATA)) { |
@@ -372,6 +398,9 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, | |||
372 | } | 398 | } |
373 | break; | 399 | break; |
374 | case 2: | 400 | case 2: |
401 | if (cpu_is_omap3517() || cpu_is_omap3505()) | ||
402 | mmc->slots[0].set_power = am35x_hsmmc2_set_power; | ||
403 | |||
375 | if (c->ext_clock) | 404 | if (c->ext_clock) |
376 | c->transceiver = 1; | 405 | c->transceiver = 1; |
377 | if (c->transceiver && (c->caps & MMC_CAP_8_BIT_DATA)) { | 406 | if (c->transceiver && (c->caps & MMC_CAP_8_BIT_DATA)) { |