]> git.sur5r.net Git - u-boot/commitdiff
tegra2: Move MMC clock initialization into MMC driver
authorStephen Warren <swarren@nvidia.com>
Mon, 31 Oct 2011 06:51:34 +0000 (06:51 +0000)
committerAndy Fleming <afleming@freescale.com>
Thu, 3 Nov 2011 07:15:00 +0000 (02:15 -0500)
This centralizes knowledge of MMC clocking into the MMC driver. This also
removes clock setup from the board files, which will simplify later changes
that modify the Harmony board to support the correct set of MMC controllers.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Cc: Andy Fleming <afleming@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
board/nvidia/common/board.c
drivers/mmc/tegra2_mmc.c

index d13537d16614d557ad80818e0326e51421c7e57c..370a25906dc377917d7cd2ca397e84d60ed4611f 100644 (file)
@@ -101,16 +101,6 @@ static void pin_mux_uart(void)
 }
 
 #ifdef CONFIG_TEGRA2_MMC
-/*
- * Routine: clock_init_mmc
- * Description: init the PLL and clocks for the SDMMC controllers
- */
-static void clock_init_mmc(void)
-{
-       clock_start_periph_pll(PERIPH_ID_SDMMC4, CLOCK_ID_PERIPH, 20000000);
-       clock_start_periph_pll(PERIPH_ID_SDMMC3, CLOCK_ID_PERIPH, 20000000);
-}
-
 /*
  * Routine: pin_mux_mmc
  * Description: setup the pin muxes/tristate values for the SDMMC(s)
@@ -157,8 +147,7 @@ int board_init(void)
 int board_mmc_init(bd_t *bd)
 {
        debug("board_mmc_init called\n");
-       /* Enable clocks, muxes, etc. for SDMMC controllers */
-       clock_init_mmc();
+       /* Enable muxes, etc. for SDMMC controllers */
        pin_mux_mmc();
        gpio_config_mmc();
 
index 9e741f223c13b2fc8379af2eea11c9779dee44c5..78b11900ed12683337e5879f9ac3459cf21de52c 100644 (file)
@@ -435,14 +435,22 @@ static int mmc_core_init(struct mmc *mmc)
 
 static int tegra2_mmc_initialize(int dev_index, int bus_width)
 {
+       struct mmc_host *host;
        struct mmc *mmc;
 
        debug(" mmc_initialize called\n");
 
+       host = &mmc_host[dev_index];
+
+       host->clock = 0;
+       tegra2_get_setup(host, dev_index);
+
+       clock_start_periph_pll(host->mmc_id, CLOCK_ID_PERIPH, 20000000);
+
        mmc = &mmc_dev[dev_index];
 
        sprintf(mmc->name, "Tegra2 SD/MMC");
-       mmc->priv = &mmc_host[dev_index];
+       mmc->priv = host;
        mmc->send_cmd = mmc_send_cmd;
        mmc->set_ios = mmc_set_ios;
        mmc->init = mmc_core_init;
@@ -465,8 +473,6 @@ static int tegra2_mmc_initialize(int dev_index, int bus_width)
        mmc->f_min = 375000;
        mmc->f_max = 48000000;
 
-       mmc_host[dev_index].clock = 0;
-       tegra2_get_setup(&mmc_host[dev_index], dev_index);
        mmc_register(mmc);
 
        return 0;