[U-Boot] [PATCH 2/3] Marvell: dkb: add mmc support

Lei Wen leiwen at marvell.com
Mon Oct 3 11:02:24 CEST 2011


Signed-off-by: Lei Wen <leiwen at marvell.com>
---
 board/Marvell/dkb/dkb.c |   37 +++++++++++++++++++++++++++++++++++++
 include/configs/dkb.h   |    1 +
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/board/Marvell/dkb/dkb.c b/board/Marvell/dkb/dkb.c
index 00f73e7..e2dd55c 100644
--- a/board/Marvell/dkb/dkb.c
+++ b/board/Marvell/dkb/dkb.c
@@ -24,8 +24,12 @@
 
 #include <common.h>
 #include <mvmfp.h>
+#include <i2c.h>
 #include <asm/arch/mfp.h>
 #include <asm/arch/cpu.h>
+#ifdef CONFIG_GENERIC_MMC
+#include <sdhci.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -40,6 +44,20 @@ int board_early_init_f(void)
 		MFP53_CI2C_SCL,
 		MFP54_CI2C_SDA,
 
+		/* MMC1 */
+		MFP_MMC1_DAT7,
+		MFP_MMC1_DAT6,
+		MFP_MMC1_DAT5,
+		MFP_MMC1_DAT4,
+		MFP_MMC1_DAT3,
+		MFP_MMC1_DAT2,
+		MFP_MMC1_DAT1,
+		MFP_MMC1_DAT0,
+		MFP_MMC1_CMD,
+		MFP_MMC1_CLK,
+		MFP_MMC1_CD,
+		MFP_MMC1_WP,
+
 		MFP_EOC		/*End of configureation*/
 	};
 	/* configure MFP's */
@@ -56,3 +74,22 @@ int board_init(void)
 	gd->bd->bi_boot_params = panth_sdram_base(0) + 0x100;
 	return 0;
 }
+
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bd)
+{
+	ulong mmc_base_address[CONFIG_SYS_MMC_NUM] = CONFIG_SYS_MMC_BASE;
+	u8 i, data;
+	data = 0xd;
+	i2c_write(0x34, 0x28, 1, &data, 1);
+
+	for (i = 0; i < CONFIG_SYS_MMC_NUM; i++) {
+		if (mv_sdh_init(mmc_base_address[i], 0, 0,
+				SDHCI_QUIRK_32BIT_DMA_ADDR))
+			return 1;
+	}
+	*(unsigned int *)0xd4282854 = 0x1b;
+	*(unsigned int *)0xd42828e0 = 0x1b;
+	return 0;
+}
+#endif
diff --git a/include/configs/dkb.h b/include/configs/dkb.h
index 3d27c58..fb02d92 100644
--- a/include/configs/dkb.h
+++ b/include/configs/dkb.h
@@ -47,6 +47,7 @@
 #define CONFIG_SYS_NO_FLASH		/* Declare no flash (NOR/SPI) */
 #include <config_cmd_default.h>
 #define CONFIG_CMD_I2C
+#define CONFIG_CMD_MMC
 #undef CONFIG_CMD_NET
 #undef CONFIG_CMD_NFS
 /*
-- 
1.7.0.4



More information about the U-Boot mailing list