OMAP: hsmmc: Move mux configuration to hsmmc.c
authorKishore Kadiyala <kishore.kadiyala@ti.com>
Mon, 28 Feb 2011 15:18:03 +0000 (20:48 +0530)
committerTony Lindgren <tony@atomide.com>
Tue, 1 Mar 2011 21:13:24 +0000 (13:13 -0800)
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>
arch/arm/mach-omap2/devices.c
arch/arm/mach-omap2/hsmmc.c

index 100bb425e9c376a239ab77a7fe84307aa37e79de..2f4a598ba67eb725fd092cc1c6a93870197a3ab1 100644 (file)
@@ -708,87 +708,6 @@ void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
 
 #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
-static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
-                       int controller_nr)
-{
-       if ((mmc_controller->slots[0].switch_pin > 0) && \
-               (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
-               omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
-                                       OMAP_PIN_INPUT_PULLUP);
-       if ((mmc_controller->slots[0].gpio_wp > 0) && \
-               (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
-               omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
-                                       OMAP_PIN_INPUT_PULLUP);
-       if (cpu_is_omap34xx()) {
-               if (controller_nr == 0) {
-                       omap_mux_init_signal("sdmmc1_clk",
-                               OMAP_PIN_INPUT_PULLUP);
-                       omap_mux_init_signal("sdmmc1_cmd",
-                               OMAP_PIN_INPUT_PULLUP);
-                       omap_mux_init_signal("sdmmc1_dat0",
-                               OMAP_PIN_INPUT_PULLUP);
-                       if (mmc_controller->slots[0].caps &
-                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
-                               omap_mux_init_signal("sdmmc1_dat1",
-                                       OMAP_PIN_INPUT_PULLUP);
-                               omap_mux_init_signal("sdmmc1_dat2",
-                                       OMAP_PIN_INPUT_PULLUP);
-                               omap_mux_init_signal("sdmmc1_dat3",
-                                       OMAP_PIN_INPUT_PULLUP);
-                       }
-                       if (mmc_controller->slots[0].caps &
-                                               MMC_CAP_8_BIT_DATA) {
-                               omap_mux_init_signal("sdmmc1_dat4",
-                                       OMAP_PIN_INPUT_PULLUP);
-                               omap_mux_init_signal("sdmmc1_dat5",
-                                       OMAP_PIN_INPUT_PULLUP);
-                               omap_mux_init_signal("sdmmc1_dat6",
-                                       OMAP_PIN_INPUT_PULLUP);
-                               omap_mux_init_signal("sdmmc1_dat7",
-                                       OMAP_PIN_INPUT_PULLUP);
-                       }
-               }
-               if (controller_nr == 1) {
-                       /* MMC2 */
-                       omap_mux_init_signal("sdmmc2_clk",
-                               OMAP_PIN_INPUT_PULLUP);
-                       omap_mux_init_signal("sdmmc2_cmd",
-                               OMAP_PIN_INPUT_PULLUP);
-                       omap_mux_init_signal("sdmmc2_dat0",
-                               OMAP_PIN_INPUT_PULLUP);
-
-                       /*
-                        * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
-                        * in the board-*.c files
-                        */
-                       if (mmc_controller->slots[0].caps &
-                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
-                               omap_mux_init_signal("sdmmc2_dat1",
-                                       OMAP_PIN_INPUT_PULLUP);
-                               omap_mux_init_signal("sdmmc2_dat2",
-                                       OMAP_PIN_INPUT_PULLUP);
-                               omap_mux_init_signal("sdmmc2_dat3",
-                                       OMAP_PIN_INPUT_PULLUP);
-                       }
-                       if (mmc_controller->slots[0].caps &
-                                                       MMC_CAP_8_BIT_DATA) {
-                               omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
-                                       OMAP_PIN_INPUT_PULLUP);
-                               omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
-                                       OMAP_PIN_INPUT_PULLUP);
-                               omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
-                                       OMAP_PIN_INPUT_PULLUP);
-                               omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
-                                       OMAP_PIN_INPUT_PULLUP);
-                       }
-               }
-
-               /*
-                * For MMC3 the pins need to be muxed in the board-*.c files
-                */
-       }
-}
-
 void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                        int nr_controllers)
 {
@@ -802,8 +721,6 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                if (!mmc_data[i])
                        continue;
 
-               omap2_mmc_mux(mmc_data[i], i);
-
                switch (i) {
                case 0:
                        base = OMAP2_MMC1_BASE;
index 5496bc7d40add4134dcf679c9a85215cc5757727..1348ac3d60e3580d5609ce2ac0193795cbfcc812 100644 (file)
@@ -16,7 +16,9 @@
 #include <mach/hardware.h>
 #include <plat/mmc.h>
 #include <plat/omap-pm.h>
+#include <plat/mux.h>
 
+#include "mux.h"
 #include "hsmmc.h"
 #include "control.h"
 
@@ -204,6 +206,87 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
        return 0;
 }
 
+static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
+                       int controller_nr)
+{
+       if ((mmc_controller->slots[0].switch_pin > 0) && \
+               (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
+               omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
+                                       OMAP_PIN_INPUT_PULLUP);
+       if ((mmc_controller->slots[0].gpio_wp > 0) && \
+               (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
+               omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
+                                       OMAP_PIN_INPUT_PULLUP);
+       if (cpu_is_omap34xx()) {
+               if (controller_nr == 0) {
+                       omap_mux_init_signal("sdmmc1_clk",
+                               OMAP_PIN_INPUT_PULLUP);
+                       omap_mux_init_signal("sdmmc1_cmd",
+                               OMAP_PIN_INPUT_PULLUP);
+                       omap_mux_init_signal("sdmmc1_dat0",
+                               OMAP_PIN_INPUT_PULLUP);
+                       if (mmc_controller->slots[0].caps &
+                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
+                               omap_mux_init_signal("sdmmc1_dat1",
+                                       OMAP_PIN_INPUT_PULLUP);
+                               omap_mux_init_signal("sdmmc1_dat2",
+                                       OMAP_PIN_INPUT_PULLUP);
+                               omap_mux_init_signal("sdmmc1_dat3",
+                                       OMAP_PIN_INPUT_PULLUP);
+                       }
+                       if (mmc_controller->slots[0].caps &
+                                               MMC_CAP_8_BIT_DATA) {
+                               omap_mux_init_signal("sdmmc1_dat4",
+                                       OMAP_PIN_INPUT_PULLUP);
+                               omap_mux_init_signal("sdmmc1_dat5",
+                                       OMAP_PIN_INPUT_PULLUP);
+                               omap_mux_init_signal("sdmmc1_dat6",
+                                       OMAP_PIN_INPUT_PULLUP);
+                               omap_mux_init_signal("sdmmc1_dat7",
+                                       OMAP_PIN_INPUT_PULLUP);
+                       }
+               }
+               if (controller_nr == 1) {
+                       /* MMC2 */
+                       omap_mux_init_signal("sdmmc2_clk",
+                               OMAP_PIN_INPUT_PULLUP);
+                       omap_mux_init_signal("sdmmc2_cmd",
+                               OMAP_PIN_INPUT_PULLUP);
+                       omap_mux_init_signal("sdmmc2_dat0",
+                               OMAP_PIN_INPUT_PULLUP);
+
+                       /*
+                        * For 8 wire configurations, Lines DAT4, 5, 6 and 7
+                        * need to be muxed in the board-*.c files
+                        */
+                       if (mmc_controller->slots[0].caps &
+                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
+                               omap_mux_init_signal("sdmmc2_dat1",
+                                       OMAP_PIN_INPUT_PULLUP);
+                               omap_mux_init_signal("sdmmc2_dat2",
+                                       OMAP_PIN_INPUT_PULLUP);
+                               omap_mux_init_signal("sdmmc2_dat3",
+                                       OMAP_PIN_INPUT_PULLUP);
+                       }
+                       if (mmc_controller->slots[0].caps &
+                                                       MMC_CAP_8_BIT_DATA) {
+                               omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
+                                       OMAP_PIN_INPUT_PULLUP);
+                               omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
+                                       OMAP_PIN_INPUT_PULLUP);
+                               omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
+                                       OMAP_PIN_INPUT_PULLUP);
+                               omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
+                                       OMAP_PIN_INPUT_PULLUP);
+                       }
+               }
+
+               /*
+                * For MMC3 the pins need to be muxed in the board-*.c files
+                */
+       }
+}
+
 static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
 
 void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
@@ -361,6 +444,7 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
                        continue;
                }
                hsmmc_data[c->mmc - 1] = mmc;
+               omap_hsmmc_mux(hsmmc_data[c->mmc - 1], (c->mmc - 1));
        }
 
        omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);