diff options
-rw-r--r-- | board/armltd/vexpress64/vexpress64.c | 30 | ||||
-rw-r--r-- | drivers/mmc/mmc.c | 5 | ||||
-rw-r--r-- | include/configs/vexpress_aemv8a.h | 10 |
3 files changed, 44 insertions, 1 deletions
diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c index 2ec3bc983..74a0d7ad9 100644 --- a/board/armltd/vexpress64/vexpress64.c +++ b/board/armltd/vexpress64/vexpress64.c @@ -11,6 +11,7 @@ #include <netdev.h> #include <asm/io.h> #include <linux/compiler.h> +#include "../drivers/mmc/arm_pl180_mmci.h" DECLARE_GLOBAL_DATA_PTR; @@ -54,3 +55,32 @@ int board_eth_init(bd_t *bis) #endif return rc; } + +/* + * Board specific mmc initialization routine. + */ +int cpu_mmc_init(bd_t *bis) +{ + int rc = 0; + (void) bis; +#ifdef CONFIG_ARM_PL180_MMCI + struct pl180_mmc_host *host; + + host = malloc(sizeof(struct pl180_mmc_host)); + if (!host) + return -ENOMEM; + memset(host, 0, sizeof(*host)); + + strcpy(host->name, "MMC"); + host->base = (struct sdi_registers *)CONFIG_ARM_PL180_MMCI_BASE; + host->pwr_init = INIT_PWR; + host->clkdiv_init = SDI_CLKCR_CLKDIV_INIT_V1 | SDI_CLKCR_CLKEN ; + host->voltages = VOLTAGE_WINDOW_MMC; + host->caps = 0; + host->clock_in = ARM_MCLK; + host->clock_min = ARM_MCLK / (2 * (SDI_CLKCR_CLKDIV_INIT_V1 + 1)); + host->clock_max = CONFIG_ARM_PL180_MMCI_CLOCK_FREQ; + rc = arm_pl180_mmci_init(host); +#endif + return rc; +} diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 8b53ead98..25db32fcf 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1322,8 +1322,11 @@ static int mmc_complete_init(struct mmc *mmc) { int err = 0; - if (mmc->op_cond_pending) + if (mmc->op_cond_pending) { + /* Some cards seem to need this */ + mmc_go_idle(mmc); err = mmc_complete_op_cond(mmc); + } if (!err) err = mmc_startup(mmc); diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index dff6adcc7..232743a43 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -125,6 +125,16 @@ #define CONFIG_SYS_SERIAL0 V2M_UART0 #define CONFIG_SYS_SERIAL1 V2M_UART1 +/* PL180 MMC Configuration */ +#define CONFIG_MMC 1 +#define CONFIG_CMD_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_ARM_PL180_MMCI +#define CONFIG_ARM_PL180_MMCI_BASE V2M_MMCI +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 127 +#define CONFIG_ARM_PL180_MMCI_CLOCK_FREQ 6250000 +#define CONFIG_SYS_MMC_MAX_DEVICE 1 + /* Command line configuration */ #define CONFIG_MENU /*#define CONFIG_MENU_SHOW*/ |