diff options
author | Simon Glass <sjg@chromium.org> | 2011-06-14 15:00:25 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:39:35 -0700 |
commit | c2f963b424c0e1f7210489b5646d7862570ec8f5 (patch) | |
tree | 9b459dceac57ce7107d101f1f47736795a423c2b /drivers/mmc | |
parent | b994da09cbfa7cb94d5c9c6501770cfec3fa5b94 (diff) |
fdt: tegra2: Support SDMMC config through FDT
This adds FDT configuration of USB ports.
BUG=chromium-os:11623
TEST=Build and boot u-boot; run mmc_boot
Change-Id: I62c015c64e3c3d9996b7117136eb636333fdc0e1
Reviewed-on: http://gerrit.chromium.org/gerrit/2781
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/tegra2_mmc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/mmc/tegra2_mmc.c b/drivers/mmc/tegra2_mmc.c index 2ceb0ad345..5a497923b6 100644 --- a/drivers/mmc/tegra2_mmc.c +++ b/drivers/mmc/tegra2_mmc.c @@ -30,6 +30,7 @@ #include <malloc.h> #include <asm/clocks.h> #include "tegra2_mmc.h" +#include "fdt_decode.h" enum { MAX_HOSTS = 4, /* support 4 mmc hosts */ @@ -669,6 +670,32 @@ int board_mmc_getcd(u8 *cd, struct mmc *mmc) int tegra2_mmc_init(const void *blob) { +#ifdef CONFIG_OF_CONTROL + struct fdt_sdmmc config; + int node, upto = 0; + + do { + node = fdt_decode_next_alias(blob, "sdmmc", + COMPAT_NVIDIA_TEGRA250_SDMMC, &upto); + if (node < 0) + break; + if (fdt_decode_sdmmc(blob, node, &config)) + return -1; + if (!config.enabled) + continue; + + /* turn on the power / setup GPIOs */ + fdt_setup_gpio(&config.power_gpio); + fdt_setup_gpio(&config.cd_gpio); + fdt_setup_gpio(&config.wp_gpio); + + if (init_port(upto - 1, config.periph_id, config.reg, + config.width, + fdt_get_gpio_num(&config.cd_gpio), + fdt_get_gpio_num(&config.wp_gpio))) + return -1; + } while (node); +#else /* For now these are still hard-coded for Seaboard */ /* init dev 0, eMMC chip, with 4-bit bus */ @@ -686,5 +713,6 @@ int tegra2_mmc_init(const void *blob) (struct tegra2_mmc *)NV_PA_SDMMC3_BASE, 4, GPIO_PI5, GPIO_PH1)) return -1; +#endif return 0; } |