aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2008-12-10 20:37:16 -0500
committerTony Lindgren <tony@atomide.com>2008-12-10 20:37:16 -0500
commitd88746652b4d133284d1fdd05b5e999e8f44c998 (patch)
tree2a6cfd6fe175a18eb4b4f600e0a79444259c9a5d /arch/arm/mach-omap2
parent652bcd8f72cc0cdf4499ce7d73990514e5e3e4b9 (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')
-rw-r--r--arch/arm/mach-omap2/clock24xx.h9
-rw-r--r--arch/arm/mach-omap2/clock34xx.h10
-rw-r--r--arch/arm/mach-omap2/devices.c83
3 files changed, 90 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h
index 242a19d86ccd..ff6cd14d254d 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock24xx.h
@@ -2522,7 +2522,6 @@ static struct clk usbhs_ick = {
2522 2522
2523static struct clk mmchs1_ick = { 2523static struct clk mmchs1_ick = {
2524 .name = "mmchs_ick", 2524 .name = "mmchs_ick",
2525 .id = 1,
2526 .parent = &l4_ck, 2525 .parent = &l4_ck,
2527 .flags = CLOCK_IN_OMAP243X, 2526 .flags = CLOCK_IN_OMAP243X,
2528 .clkdm_name = "core_l4_clkdm", 2527 .clkdm_name = "core_l4_clkdm",
@@ -2533,7 +2532,6 @@ static struct clk mmchs1_ick = {
2533 2532
2534static struct clk mmchs1_fck = { 2533static struct clk mmchs1_fck = {
2535 .name = "mmchs_fck", 2534 .name = "mmchs_fck",
2536 .id = 1,
2537 .parent = &func_96m_ck, 2535 .parent = &func_96m_ck,
2538 .flags = CLOCK_IN_OMAP243X, 2536 .flags = CLOCK_IN_OMAP243X,
2539 .clkdm_name = "core_l3_clkdm", 2537 .clkdm_name = "core_l3_clkdm",
@@ -2544,7 +2542,7 @@ static struct clk mmchs1_fck = {
2544 2542
2545static struct clk mmchs2_ick = { 2543static struct clk mmchs2_ick = {
2546 .name = "mmchs_ick", 2544 .name = "mmchs_ick",
2547 .id = 2, 2545 .id = 1,
2548 .parent = &l4_ck, 2546 .parent = &l4_ck,
2549 .flags = CLOCK_IN_OMAP243X, 2547 .flags = CLOCK_IN_OMAP243X,
2550 .clkdm_name = "core_l4_clkdm", 2548 .clkdm_name = "core_l4_clkdm",
@@ -2555,7 +2553,7 @@ static struct clk mmchs2_ick = {
2555 2553
2556static struct clk mmchs2_fck = { 2554static struct clk mmchs2_fck = {
2557 .name = "mmchs_fck", 2555 .name = "mmchs_fck",
2558 .id = 2, 2556 .id = 1,
2559 .parent = &func_96m_ck, 2557 .parent = &func_96m_ck,
2560 .flags = CLOCK_IN_OMAP243X, 2558 .flags = CLOCK_IN_OMAP243X,
2561 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), 2559 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
@@ -2595,7 +2593,6 @@ static struct clk mdm_intc_ick = {
2595 2593
2596static struct clk mmchsdb1_fck = { 2594static struct clk mmchsdb1_fck = {
2597 .name = "mmchsdb_fck", 2595 .name = "mmchsdb_fck",
2598 .id = 1,
2599 .parent = &func_32k_ck, 2596 .parent = &func_32k_ck,
2600 .flags = CLOCK_IN_OMAP243X, 2597 .flags = CLOCK_IN_OMAP243X,
2601 .clkdm_name = "core_l4_clkdm", 2598 .clkdm_name = "core_l4_clkdm",
@@ -2606,7 +2603,7 @@ static struct clk mmchsdb1_fck = {
2606 2603
2607static struct clk mmchsdb2_fck = { 2604static struct clk mmchsdb2_fck = {
2608 .name = "mmchsdb_fck", 2605 .name = "mmchsdb_fck",
2609 .id = 2, 2606 .id = 1,
2610 .parent = &func_32k_ck, 2607 .parent = &func_32k_ck,
2611 .flags = CLOCK_IN_OMAP243X, 2608 .flags = CLOCK_IN_OMAP243X,
2612 .clkdm_name = "core_l4_clkdm", 2609 .clkdm_name = "core_l4_clkdm",
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index 7217a0824ec4..a826094d89b5 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -1374,7 +1374,7 @@ static struct clk core_96m_fck = {
1374 1374
1375static struct clk mmchs3_fck = { 1375static struct clk mmchs3_fck = {
1376 .name = "mmchs_fck", 1376 .name = "mmchs_fck",
1377 .id = 3, 1377 .id = 2,
1378 .parent = &core_96m_fck, 1378 .parent = &core_96m_fck,
1379 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1379 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1380 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT, 1380 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
@@ -1385,7 +1385,7 @@ static struct clk mmchs3_fck = {
1385 1385
1386static struct clk mmchs2_fck = { 1386static struct clk mmchs2_fck = {
1387 .name = "mmchs_fck", 1387 .name = "mmchs_fck",
1388 .id = 2, 1388 .id = 1,
1389 .parent = &core_96m_fck, 1389 .parent = &core_96m_fck,
1390 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1390 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1391 .enable_bit = OMAP3430_EN_MMC2_SHIFT, 1391 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
@@ -1406,7 +1406,6 @@ static struct clk mspro_fck = {
1406 1406
1407static struct clk mmchs1_fck = { 1407static struct clk mmchs1_fck = {
1408 .name = "mmchs_fck", 1408 .name = "mmchs_fck",
1409 .id = 1,
1410 .parent = &core_96m_fck, 1409 .parent = &core_96m_fck,
1411 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1410 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1412 .enable_bit = OMAP3430_EN_MMC1_SHIFT, 1411 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
@@ -1722,7 +1721,7 @@ static struct clk usbtll_ick = {
1722 1721
1723static struct clk mmchs3_ick = { 1722static struct clk mmchs3_ick = {
1724 .name = "mmchs_ick", 1723 .name = "mmchs_ick",
1725 .id = 3, 1724 .id = 2,
1726 .parent = &core_l4_ick, 1725 .parent = &core_l4_ick,
1727 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1726 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1728 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT, 1727 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
@@ -1774,7 +1773,7 @@ static struct clk des2_ick = {
1774 1773
1775static struct clk mmchs2_ick = { 1774static struct clk mmchs2_ick = {
1776 .name = "mmchs_ick", 1775 .name = "mmchs_ick",
1777 .id = 2, 1776 .id = 1,
1778 .parent = &core_l4_ick, 1777 .parent = &core_l4_ick,
1779 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1778 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1780 .enable_bit = OMAP3430_EN_MMC2_SHIFT, 1779 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
@@ -1785,7 +1784,6 @@ static struct clk mmchs2_ick = {
1785 1784
1786static struct clk mmchs1_ick = { 1785static struct clk mmchs1_ick = {
1787 .name = "mmchs_ick", 1786 .name = "mmchs_ick",
1788 .id = 1,
1789 .parent = &core_l4_ick, 1787 .parent = &core_l4_ick,
1790 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1788 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1791 .enable_bit = OMAP3430_EN_MMC1_SHIFT, 1789 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
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)
295static inline void omap_init_sha1_md5(void) { } 296static 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
304static 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
335void __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