aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/hsmmc.c
diff options
context:
space:
mode:
authorKishore Kadiyala <kishore.kadiyala@ti.com>2011-02-28 10:18:03 -0500
committerTony Lindgren <tony@atomide.com>2011-03-01 16:13:24 -0500
commitd8d0a61c658e252de3077f6076f13423642caf67 (patch)
tree62d6ba1e1d7b43d65fa5b5562c7b828e2bb2e087 /arch/arm/mach-omap2/hsmmc.c
parent6ab8946f672497a55625d2106250d2923125fdfb (diff)
OMAP: hsmmc: Move mux configuration to hsmmc.c
Moving the definition of mux setting API from devices.c to hsmmc.c and renaming it from "omap2_mmc_mux" to "omap_hsmmc_mux". Also calling "omap_hsmmc_mux" from omap2_hsmmc_init. Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com> Cc: Chris Ball <cjb@laptop.org Cc: Tony Lindgren <tony@atomide.com Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/hsmmc.c')
-rw-r--r--arch/arm/mach-omap2/hsmmc.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 5496bc7d40a..1348ac3d60e 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -16,7 +16,9 @@
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <plat/mmc.h> 17#include <plat/mmc.h>
18#include <plat/omap-pm.h> 18#include <plat/omap-pm.h>
19#include <plat/mux.h>
19 20
21#include "mux.h"
20#include "hsmmc.h" 22#include "hsmmc.h"
21#include "control.h" 23#include "control.h"
22 24
@@ -204,6 +206,87 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
204 return 0; 206 return 0;
205} 207}
206 208
209static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
210 int controller_nr)
211{
212 if ((mmc_controller->slots[0].switch_pin > 0) && \
213 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
214 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
215 OMAP_PIN_INPUT_PULLUP);
216 if ((mmc_controller->slots[0].gpio_wp > 0) && \
217 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
218 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
219 OMAP_PIN_INPUT_PULLUP);
220 if (cpu_is_omap34xx()) {
221 if (controller_nr == 0) {
222 omap_mux_init_signal("sdmmc1_clk",
223 OMAP_PIN_INPUT_PULLUP);
224 omap_mux_init_signal("sdmmc1_cmd",
225 OMAP_PIN_INPUT_PULLUP);
226 omap_mux_init_signal("sdmmc1_dat0",
227 OMAP_PIN_INPUT_PULLUP);
228 if (mmc_controller->slots[0].caps &
229 (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
230 omap_mux_init_signal("sdmmc1_dat1",
231 OMAP_PIN_INPUT_PULLUP);
232 omap_mux_init_signal("sdmmc1_dat2",
233 OMAP_PIN_INPUT_PULLUP);
234 omap_mux_init_signal("sdmmc1_dat3",
235 OMAP_PIN_INPUT_PULLUP);
236 }
237 if (mmc_controller->slots[0].caps &
238 MMC_CAP_8_BIT_DATA) {
239 omap_mux_init_signal("sdmmc1_dat4",
240 OMAP_PIN_INPUT_PULLUP);
241 omap_mux_init_signal("sdmmc1_dat5",
242 OMAP_PIN_INPUT_PULLUP);
243 omap_mux_init_signal("sdmmc1_dat6",
244 OMAP_PIN_INPUT_PULLUP);
245 omap_mux_init_signal("sdmmc1_dat7",
246 OMAP_PIN_INPUT_PULLUP);
247 }
248 }
249 if (controller_nr == 1) {
250 /* MMC2 */
251 omap_mux_init_signal("sdmmc2_clk",
252 OMAP_PIN_INPUT_PULLUP);
253 omap_mux_init_signal("sdmmc2_cmd",
254 OMAP_PIN_INPUT_PULLUP);
255 omap_mux_init_signal("sdmmc2_dat0",
256 OMAP_PIN_INPUT_PULLUP);
257
258 /*
259 * For 8 wire configurations, Lines DAT4, 5, 6 and 7
260 * need to be muxed in the board-*.c files
261 */
262 if (mmc_controller->slots[0].caps &
263 (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
264 omap_mux_init_signal("sdmmc2_dat1",
265 OMAP_PIN_INPUT_PULLUP);
266 omap_mux_init_signal("sdmmc2_dat2",
267 OMAP_PIN_INPUT_PULLUP);
268 omap_mux_init_signal("sdmmc2_dat3",
269 OMAP_PIN_INPUT_PULLUP);
270 }
271 if (mmc_controller->slots[0].caps &
272 MMC_CAP_8_BIT_DATA) {
273 omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
274 OMAP_PIN_INPUT_PULLUP);
275 omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
276 OMAP_PIN_INPUT_PULLUP);
277 omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
278 OMAP_PIN_INPUT_PULLUP);
279 omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
280 OMAP_PIN_INPUT_PULLUP);
281 }
282 }
283
284 /*
285 * For MMC3 the pins need to be muxed in the board-*.c files
286 */
287 }
288}
289
207static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata; 290static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
208 291
209void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) 292void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
@@ -361,6 +444,7 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
361 continue; 444 continue;
362 } 445 }
363 hsmmc_data[c->mmc - 1] = mmc; 446 hsmmc_data[c->mmc - 1] = mmc;
447 omap_hsmmc_mux(hsmmc_data[c->mmc - 1], (c->mmc - 1));
364 } 448 }
365 449
366 omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC); 450 omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);