aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishal Bhoj <vishal.bhoj@linaro.org>2014-05-21 11:12:22 +0530
committerVishal Bhoj <vishal.bhoj@linaro.org>2014-05-21 11:28:04 +0530
commit280e962afbef851a39346bdd60d535e0ee1e147f (patch)
tree2aacc9eaa11f8b9ca5eab812649c73c463cb87a1
parentb44bd2c73c4cfb6e3b9e7f8cf987e8e39aa74a0b (diff)
Add MMC support on vexpress64 platformarmv8
This patch adds MMC specific initializations for Vexpress64. There is a probable bug(I am not an mmc expert) in u-boot code calling MMC_SEND_OP_COND in READY state which is forbidden on the models. Forcing the MMC controller to idle state before invoking the MMC_SEND_OP_COND command seems to fix the issue. Similar fix is already being used in other routines. Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
-rw-r--r--board/armltd/vexpress64/vexpress64.c27
-rw-r--r--drivers/mmc/mmc.c3
-rw-r--r--include/configs/vexpress_aemv8a.h14
3 files changed, 43 insertions, 1 deletions
diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c
index 2ec3bc983..863c7b084 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;
@@ -36,6 +37,32 @@ int timer_init(void)
return 0;
}
+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;
+}
+
/*
* Board specific reset that is system reset.
*/
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index c6a1c23fb..da74ace69 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1263,6 +1263,9 @@ static int mmc_complete_init(struct mmc *mmc)
{
int err = 0;
+ /* Some cards seem to need this */
+ mmc_go_idle(mmc);
+
if (mmc->op_cond_pending)
err = mmc_complete_op_cond(mmc);
diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h
index e8517027e..6374cd844 100644
--- a/include/configs/vexpress_aemv8a.h
+++ b/include/configs/vexpress_aemv8a.h
@@ -9,7 +9,6 @@
#define __VEXPRESS_AEMV8A_H
#define DEBUG
-
#define CONFIG_REMAKE_ELF
/*#define CONFIG_ARMV8_SWITCH_TO_EL1*/
@@ -54,6 +53,7 @@
#define V2M_BASE 0x80000000
+
/*
* Physical addresses, offset from V2M_PA_CS0-3
*/
@@ -140,6 +140,18 @@
#define CONFIG_CMD_FAT
#define CONFIG_DOS_PARTITION
+#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_API
+#define CONFIG_SYS_MMC_MAX_DEVICE 1
+#define CONFIG_NET_MULTI
+
+
/* BOOTP options */
#define CONFIG_BOOTP_BOOTFILESIZE
#define CONFIG_BOOTP_BOOTPATH