]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
Sync MMC device code with arm devel branch
authorTony Lindgren <tony@atomide.com>
Fri, 12 Sep 2008 00:05:32 +0000 (17:05 -0700)
committerTony Lindgren <tony@atomide.com>
Fri, 12 Sep 2008 00:38:33 +0000 (17:38 -0700)
This is to sync with Russell's commit 7736c09c6cf9521f2413d78856a66f4a37046e84.

Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/plat-omap/devices.c

index aa1299faaf3c490e6da54212a0f94d10eda46818..5312677053ace03b5d76e98e4bf5055a35efc965 100644 (file)
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/io.h>
 #include <linux/i2c/menelaus.h>
 
 #include <mach/hardware.h>
-#include <asm/io.h>
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
 
@@ -192,26 +192,26 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
 
 /*-------------------------------------------------------------------------*/
 
-#if    defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) \
-       || defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
+#if    defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
+       defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
 #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
 #define        OMAP_MMC1_BASE          0x4809c000
-#define        OMAP_MMC1_END           OMAP_MMC1_BASE + 0x1fc
+#define        OMAP_MMC1_END           (OMAP_MMC1_BASE + 0x1fc)
 #define        OMAP_MMC1_INT           INT_24XX_MMC_IRQ
 
 #define        OMAP_MMC2_BASE          0x480b4000
-#define        OMAP_MMC2_END           OMAP_MMC2_BASE + 0x1fc
+#define        OMAP_MMC2_END           (OMAP_MMC2_BASE + 0x1fc)
 #define        OMAP_MMC2_INT           INT_24XX_MMC2_IRQ
 
 #else
 
 #define        OMAP_MMC1_BASE          0xfffb7800
-#define        OMAP_MMC1_END           OMAP_MMC1_BASE + 0x7f
+#define        OMAP_MMC1_END           (OMAP_MMC1_BASE + 0x7f)
 #define OMAP_MMC1_INT          INT_MMC
 
 #define        OMAP_MMC2_BASE          0xfffb7c00      /* omap16xx only */
-#define        OMAP_MMC2_END           OMAP_MMC2_BASE + 0x7f
+#define        OMAP_MMC2_END           (OMAP_MMC2_BASE + 0x7f)
 #define        OMAP_MMC2_INT           INT_1610_MMC2
 
 #endif
@@ -250,7 +250,6 @@ static struct omap_mmc_platform_data mmc2_data;
 
 static u64 mmc2_dmamask = 0xffffffff;
 
-
 static struct resource mmc2_resources[] = {
        {
                .start          = OMAP_MMC2_BASE,
@@ -275,37 +274,12 @@ static struct platform_device mmc_omap_device2 = {
 };
 #endif
 
-static void __init omap_init_mmc(void)
+static inline void omap_init_mmc_conf(const struct omap_mmc_config *mmc_conf)
 {
-       const struct omap_mmc_config    *mmc_conf;
-       const struct omap_mmc_conf      *mmc;
-
-       /* NOTE:  assumes MMC was never (wrongly) enabled */
-       mmc_conf = omap_get_config(OMAP_TAG_MMC, struct omap_mmc_config);
-       if (!mmc_conf)
-               return;
-
-       /* block 1 is always available and has just one pinout option */
-       mmc = &mmc_conf->mmc[0];
-
-       if (cpu_is_omap2430() || cpu_is_omap34xx()) {
-               if (mmc->enabled) {
-                       mmc1_data.conf = *mmc;
-                       (void) platform_device_register(&mmc_omap_device1);
-               }
-
-#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
-               mmc = &mmc_conf->mmc[1];
-               if (mmc->enabled) {
-                       mmc2_data.conf = *mmc;
-                       (void) platform_device_register(&mmc_omap_device2);
-               }
-#endif
-
+       if (cpu_is_omap2430() || cpu_is_omap34xx())
                return;
-       }
 
-       if (mmc->enabled) {
+       if (mmc_conf->mmc[0].enabled) {
                if (cpu_is_omap24xx()) {
                        omap_cfg_reg(H18_24XX_MMC_CMD);
                        omap_cfg_reg(H15_24XX_MMC_CLKI);
@@ -323,7 +297,7 @@ static void __init omap_init_mmc(void)
                                omap_cfg_reg(P20_1710_MMC_DATDIR0);
                        }
                }
-               if (mmc->wire4) {
+               if (mmc_conf->mmc[0].wire4) {
                        if (cpu_is_omap24xx()) {
                                omap_cfg_reg(H14_24XX_MMC_DAT1);
                                omap_cfg_reg(E19_24XX_MMC_DAT2);
@@ -334,13 +308,13 @@ static void __init omap_init_mmc(void)
                        } else {
                                omap_cfg_reg(MMC_DAT1);
                                /* NOTE:  DAT2 can be on W10 (here) or M15 */
-                               if (!mmc->nomux)
+                               if (!mmc_conf->mmc[0].nomux)
                                        omap_cfg_reg(MMC_DAT2);
                                omap_cfg_reg(MMC_DAT3);
                        }
                }
 #if defined(CONFIG_ARCH_OMAP2420)
-               if (mmc->internal_clock) {
+               if (mmc_conf->mmc[0].internal_clock) {
                        /*
                         * Use internal loop-back in MMC/SDIO
                         * Module Input Clock selection
@@ -352,20 +326,17 @@ static void __init omap_init_mmc(void)
                        }
                }
 #endif
-               mmc1_data.conf = *mmc;
-               (void) platform_device_register(&mmc_omap_device1);
        }
 
 #ifdef CONFIG_ARCH_OMAP16XX
        /* block 2 is on newer chips, and has many pinout options */
-       mmc = &mmc_conf->mmc[1];
-       if (mmc->enabled) {
-               if (!mmc->nomux) {
+       if (mmc_conf->mmc[1].enabled) {
+               if (!mmc_conf->mmc[1].nomux) {
                        omap_cfg_reg(Y8_1610_MMC2_CMD);
                        omap_cfg_reg(Y10_1610_MMC2_CLK);
                        omap_cfg_reg(R18_1610_MMC2_CLKIN);
                        omap_cfg_reg(W8_1610_MMC2_DAT0);
-                       if (mmc->wire4) {
+                       if (mmc_conf->mmc[1].wire4) {
                                omap_cfg_reg(V8_1610_MMC2_DAT1);
                                omap_cfg_reg(W15_1610_MMC2_DAT2);
                                omap_cfg_reg(R10_1610_MMC2_DAT3);
@@ -381,11 +352,33 @@ static void __init omap_init_mmc(void)
                if (cpu_is_omap1710())
                        omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
                                     MOD_CONF_CTRL_1);
-               mmc2_data.conf = *mmc;
+       }
+#endif
+}
+
+static void __init omap_init_mmc(void)
+{
+       const struct omap_mmc_config    *mmc_conf;
+
+       /* NOTE:  assumes MMC was never (wrongly) enabled */
+       mmc_conf = omap_get_config(OMAP_TAG_MMC, struct omap_mmc_config);
+       if (!mmc_conf)
+               return;
+
+       omap_init_mmc_conf(mmc_conf);
+
+       if (mmc_conf->mmc[0].enabled) {
+               mmc1_data.conf = mmc_conf->mmc[0];
+               (void) platform_device_register(&mmc_omap_device1);
+       }
+
+#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \
+       defined(CONFIG_ARCH_OMAP34XX)
+       if (mmc_conf->mmc[1].enabled) {
+               mmc2_data.conf = mmc_conf->mmc[1];
                (void) platform_device_register(&mmc_omap_device2);
        }
 #endif
-       return;
 }
 
 void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info)
@@ -406,8 +399,8 @@ void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info)
 }
 
 #else
-void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info) {}
 static inline void omap_init_mmc(void) {}
+void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info) {}
 #endif
 
 /*-------------------------------------------------------------------------*/