]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
tegra2: Enable MMC for Seaboard
authorTom Warren <twarren@nvidia.com>
Wed, 21 Sep 2011 12:40:07 +0000 (12:40 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Thu, 27 Oct 2011 19:56:29 +0000 (21:56 +0200)
This adds the required GPIO and pinmux configuration to make eMMC / SD work
on Seaboard.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Warren <twarren@nvidia.com>
board/nvidia/common/board.c
board/nvidia/common/board.h
board/nvidia/harmony/harmony.c
board/nvidia/seaboard/seaboard.c
drivers/mmc/tegra2_mmc.c

index 5ba7bda33f491ca243cdf18f84afe4f1bd7eba55..d13537d16614d557ad80818e0326e51421c7e57c 100644 (file)
@@ -160,6 +160,7 @@ int board_mmc_init(bd_t *bd)
        /* Enable clocks, muxes, etc. for SDMMC controllers */
        clock_init_mmc();
        pin_mux_mmc();
+       gpio_config_mmc();
 
        debug("board_mmc_init: init eMMC\n");
        /* init dev 0, eMMC chip, with 4-bit bus */
@@ -171,18 +172,6 @@ int board_mmc_init(bd_t *bd)
 
        return 0;
 }
-
-/* this is a weak define that we are overriding */
-int board_mmc_getcd(u8 *cd, struct mmc *mmc)
-{
-       debug("board_mmc_getcd called\n");
-       /*
-        * Hard-code CD presence for now. Need to add GPIO inputs
-        * for Seaboard & Harmony (& Kaen/Aebl/Wario?)
-        */
-       *cd = 1;
-       return 0;
-}
 #endif
 
 #ifdef CONFIG_BOARD_EARLY_INIT_F
index d649eb763a7740223417b89cad23a2a7f25137b1..344e70283e318c7b66cf84b209f2f52a1791b99a 100644 (file)
@@ -26,6 +26,7 @@
 
 void tegra2_start(void);
 void gpio_config_uart(void);
+void gpio_config_mmc(void);
 int tegra2_mmc_init(int dev_index, int bus_width);
 
 #endif /* BOARD_H */
index f1ab050899e062d7a1f5088ac9f0a61d3dca5b03..cbb30d63014ee98b26937d9849c47d88268b98c6 100644 (file)
@@ -24,6 +24,9 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/tegra2.h>
+#ifdef CONFIG_TEGRA2_MMC
+#include <mmc.h>
+#endif
 
 /*
  * Routine: gpio_config_uart
 void gpio_config_uart(void)
 {
 }
+
+#ifdef CONFIG_TEGRA2_MMC
+/*
+ * Routine: gpio_config_mmc
+ * Description: Set GPIOs for SD card
+ */
+void gpio_config_mmc(void)
+{
+       /* Not implemented for now */
+}
+
+/* this is a weak define that we are overriding */
+int board_mmc_getcd(u8 *cd, struct mmc *mmc)
+{
+       debug("board_mmc_getcd called\n");
+       /*
+        * Hard-code CD presence for now. Need to add GPIO inputs
+        * for Harmony
+        */
+       *cd = 1;
+       return 0;
+}
+#endif
index 4b9a8f33e89daef1c9458be0b176e01211ab225e..bc67d0f94c0be159786f231117decba110b7bea7 100644 (file)
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/tegra2.h>
-#include <asm/arch/gpio.h>
+#include <asm/gpio.h>
+#ifdef CONFIG_TEGRA2_MMC
+#include <mmc.h>
+#endif
 
 /*
  * Routine: gpio_config_uart
@@ -50,3 +53,33 @@ void gpio_config_uart(void)
        val |= 1 << GPIO_BIT(gp);
        writel(val, &bank->gpio_dir_out[GPIO_PORT(gp)]);
 }
+
+#ifdef CONFIG_TEGRA2_MMC
+/*
+ * Routine: gpio_config_mmc
+ * Description: Set GPIOs for SDMMC3 SDIO slot.
+ */
+void gpio_config_mmc(void)
+{
+       /* Set EN_VDDIO_SD (GPIO I6) */
+       gpio_direction_output(GPIO_PI6, 1);
+
+       /* Config pin as GPI for Card Detect (GPIO I5) */
+       gpio_direction_input(GPIO_PI5);
+}
+
+/* this is a weak define that we are overriding */
+int board_mmc_getcd(u8 *cd, struct mmc *mmc)
+{
+       debug("board_mmc_getcd called\n");
+       *cd = 1;                        /* Assume card is inserted, or eMMC */
+
+       if (IS_SD(mmc)) {
+               /* Seaboard SDMMC3 = SDIO3_CD = GPIO_PI5 */
+               if (gpio_get_value(GPIO_PI5))
+                       *cd = 0;
+       }
+
+       return 0;
+}
+#endif
index a71785cd7c00cde76f117d1c1f7f87e22f4d9a77..9e741f223c13b2fc8379af2eea11c9779dee44c5 100644 (file)
@@ -452,7 +452,7 @@ static int tegra2_mmc_initialize(int dev_index, int bus_width)
                mmc->host_caps = MMC_MODE_8BIT;
        else
                mmc->host_caps = MMC_MODE_4BIT;
-       mmc->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
+       mmc->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_HC;
 
        /*
         * min freq is for card identification, and is the highest