diff options
author | Tony Lindgren <tony@atomide.com> | 2008-12-10 20:37:16 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-12-10 20:37:16 -0500 |
commit | d88746652b4d133284d1fdd05b5e999e8f44c998 (patch) | |
tree | 2a6cfd6fe175a18eb4b4f600e0a79444259c9a5d /arch/arm/mach-omap2/devices.c | |
parent | 652bcd8f72cc0cdf4499ce7d73990514e5e3e4b9 (diff) |
omap mmc: Add better MMC low-level init
This will simplify the MMC low-level init, and make it more
flexible to add support for a newer MMC controller in the
following patches.
The patch rearranges platform data and gets rid of slot vs
controller confusion in the old data structures. Also fix
device id numbering in the clock code.
Some code snippets are based on an earlier patch by
Russell King <linux@arm.linux.org.uk>.
Cc: Pierre Ossman <drzeus-mmc@drzeus.cx>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/devices.c')
-rw-r--r-- | arch/arm/mach-omap2/devices.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 90af2ac469aa..8ccdfcf2942c 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <mach/mux.h> | 24 | #include <mach/mux.h> |
25 | #include <mach/gpio.h> | 25 | #include <mach/gpio.h> |
26 | #include <mach/eac.h> | 26 | #include <mach/eac.h> |
27 | #include <mach/mmc.h> | ||
27 | 28 | ||
28 | #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) | 29 | #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) |
29 | #define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE) | 30 | #define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE) |
@@ -295,6 +296,88 @@ static void omap_init_sha1_md5(void) | |||
295 | static inline void omap_init_sha1_md5(void) { } | 296 | static inline void omap_init_sha1_md5(void) { } |
296 | #endif | 297 | #endif |
297 | 298 | ||
299 | /*-------------------------------------------------------------------------*/ | ||
300 | |||
301 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ | ||
302 | defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) | ||
303 | |||
304 | static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, | ||
305 | int controller_nr) | ||
306 | { | ||
307 | if (cpu_is_omap2420() && controller_nr == 0) { | ||
308 | omap_cfg_reg(H18_24XX_MMC_CMD); | ||
309 | omap_cfg_reg(H15_24XX_MMC_CLKI); | ||
310 | omap_cfg_reg(G19_24XX_MMC_CLKO); | ||
311 | omap_cfg_reg(F20_24XX_MMC_DAT0); | ||
312 | omap_cfg_reg(F19_24XX_MMC_DAT_DIR0); | ||
313 | omap_cfg_reg(G18_24XX_MMC_CMD_DIR); | ||
314 | if (mmc_controller->slots[0].wire4) { | ||
315 | omap_cfg_reg(H14_24XX_MMC_DAT1); | ||
316 | omap_cfg_reg(E19_24XX_MMC_DAT2); | ||
317 | omap_cfg_reg(D19_24XX_MMC_DAT3); | ||
318 | omap_cfg_reg(E20_24XX_MMC_DAT_DIR1); | ||
319 | omap_cfg_reg(F18_24XX_MMC_DAT_DIR2); | ||
320 | omap_cfg_reg(E18_24XX_MMC_DAT_DIR3); | ||
321 | } | ||
322 | |||
323 | /* | ||
324 | * Use internal loop-back in MMC/SDIO Module Input Clock | ||
325 | * selection | ||
326 | */ | ||
327 | if (mmc_controller->slots[0].internal_clock) { | ||
328 | u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | ||
329 | v |= (1 << 24); | ||
330 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | |||
335 | void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, | ||
336 | int nr_controllers) | ||
337 | { | ||
338 | int i; | ||
339 | |||
340 | for (i = 0; i < nr_controllers; i++) { | ||
341 | unsigned long base, size; | ||
342 | unsigned int irq = 0; | ||
343 | |||
344 | if (!mmc_data[i]) | ||
345 | continue; | ||
346 | |||
347 | omap2_mmc_mux(mmc_data[i], i); | ||
348 | |||
349 | switch (i) { | ||
350 | case 0: | ||
351 | base = OMAP2_MMC1_BASE; | ||
352 | irq = INT_24XX_MMC_IRQ; | ||
353 | break; | ||
354 | case 1: | ||
355 | base = OMAP2_MMC2_BASE; | ||
356 | irq = INT_24XX_MMC2_IRQ; | ||
357 | break; | ||
358 | case 2: | ||
359 | if (!cpu_is_omap34xx()) | ||
360 | return; | ||
361 | base = OMAP3_MMC3_BASE; | ||
362 | irq = INT_34XX_MMC3_IRQ; | ||
363 | break; | ||
364 | default: | ||
365 | continue; | ||
366 | } | ||
367 | |||
368 | if (cpu_is_omap2420()) | ||
369 | size = OMAP2420_MMC_SIZE; | ||
370 | else | ||
371 | size = HSMMC_SIZE; | ||
372 | |||
373 | omap_mmc_add(i, base, size, irq, mmc_data[i]); | ||
374 | }; | ||
375 | } | ||
376 | |||
377 | #endif | ||
378 | |||
379 | /*-------------------------------------------------------------------------*/ | ||
380 | |||
298 | #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE) | 381 | #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE) |
299 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) | 382 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) |
300 | #define OMAP_HDQ_BASE 0x480B2000 | 383 | #define OMAP_HDQ_BASE 0x480B2000 |