/* 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 */
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
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 */
#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
#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
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
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