[U-Boot] [PATCH 2/2] board: stmark2: changes for mmc boot

Angelo Dureghello angelo at sysam.it
Sun Jun 23 20:56:40 UTC 2019


Signed-off-by: Angelo Dureghello <angelo at sysam.it>
---
 board/sysam/stmark2/stmark2.c | 15 +++++++++++++++
 configs/stmark2_defconfig     |  9 +++++++++
 include/configs/stmark2.h     | 27 +++++++++++++++------------
 3 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/board/sysam/stmark2/stmark2.c b/board/sysam/stmark2/stmark2.c
index 790199a640..f5f62e09a9 100644
--- a/board/sysam/stmark2/stmark2.c
+++ b/board/sysam/stmark2/stmark2.c
@@ -9,8 +9,10 @@
 #include <spi.h>
 #include <asm/io.h>
 #include <asm/immap.h>
+#ifdef CONFIG_FSL_ESDHC
 #include <mmc.h>
 #include <fsl_esdhc.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -44,3 +46,16 @@ int testdram(void)
 {
 	return 0;
 }
+
+#ifdef CONFIG_FSL_ESDHC
+struct fsl_esdhc_cfg esdhc_cfg = {
+	.esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR,
+};
+
+int board_mmc_init(bd_t *bd)
+{
+	esdhc_cfg.sdhc_clk = gd->arch.sdhc_clk;
+
+	return fsl_esdhc_initialize(bd, &esdhc_cfg);
+}
+#endif
diff --git a/configs/stmark2_defconfig b/configs/stmark2_defconfig
index b039ebb9ea..e36b597b01 100644
--- a/configs/stmark2_defconfig
+++ b/configs/stmark2_defconfig
@@ -12,11 +12,16 @@ CONFIG_SYS_PROMPT="stmark2 $ "
 # CONFIG_CMD_IMPORTENV is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FS_GENERIC=y
 CONFIG_CMD_MTDPARTS=y
+CONFIG_DOS_PARTITION=y
 CONFIG_MTDIDS_DEFAULT="nor0=spi-flash.0"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-flash.0:1m(u-boot),7m(kernel),-(rootfs)"
 CONFIG_DEFAULT_DEVICE_TREE="stmark2"
@@ -25,6 +30,8 @@ CONFIG_USE_ENV_SPI_CS=y
 CONFIG_ENV_SPI_CS=1
 # CONFIG_NET is not set
 CONFIG_MTD_DEVICE=y
+CONFIG_MMC=y
+CONFIG_FSL_ESDHC=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=50000000
@@ -34,3 +41,5 @@ CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CF_SPI=y
 CONFIG_REGEX=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0 rw rootfstype=ramfs rdinit=/sbin/init devtmpfs.mount=1"
diff --git a/include/configs/stmark2.h b/include/configs/stmark2.h
index 35966580a9..f02c10c59c 100644
--- a/include/configs/stmark2.h
+++ b/include/configs/stmark2.h
@@ -19,31 +19,26 @@
 
 #define CONFIG_TIMESTAMP
 
-#define CONFIG_BOOTARGS						\
-	"console=ttyS0,115200 root=/dev/ram0 rw "		\
-		"rootfstype=ramfs "				\
-		"rdinit=/bin/init "				\
-		"devtmpfs.mount=1"
-
 #define CONFIG_BOOTCOMMAND					\
-	"sf probe 0:1 50000000; "				\
-	"sf read ${loadaddr} 0x100000 ${kern_size}; "		\
-	"bootm ${loadaddr}"
+	"run boot_sd; bootm ${loadaddr} ${loadaddr_ramfs}"
 
 #define CONFIG_EXTRA_ENV_SETTINGS				\
+	"boot_sd=load mmc 0:1 ${loadaddr} uImage; "		\
+		"load mmc 0:1 ${loadaddr_ramfs} uRamfs\0"	\
 	"kern_size=0x700000\0"					\
 	"loadaddr=0x40001000\0"					\
+	"loadaddr_ramfs=0x41001000\0"				\
 		"-(rootfs)\0"					\
-	"update_uboot=loady ${loadaddr}; "			\
+	"update_sf_uboot=loady ${loadaddr}; "			\
 		"sf probe 0:1 50000000; "			\
 		"sf erase 0 0x80000; "				\
 		"sf write ${loadaddr} 0 ${filesize}\0"		\
-	"update_kernel=loady ${loadaddr}; "			\
+	"update_sf_kernel=loady ${loadaddr}; "			\
 		"setenv kern_size ${filesize}; saveenv; "	\
 		"sf probe 0:1 50000000; "			\
 		"sf erase 0x100000 0x700000; "			\
 		"sf write ${loadaddr} 0x100000 ${filesize}\0"	\
-	"update_rootfs=loady ${loadaddr}; "			\
+	"update_sf_rootfs=loady ${loadaddr}; "			\
 		"sf probe 0:1 50000000; "			\
 		"sf erase 0x00800000 0x100000; "		\
 		"sf write ${loadaddr} 0x00800000 ${filesize}\0"	\
@@ -62,6 +57,13 @@
 #define CONFIG_MCFTMR
 #undef CONFIG_MCFPIT
 
+/* MMC Config*/
+#ifdef CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_ESDHC_ADDR	0xfc0cc000
+#define CONFIG_SYS_FSL_ESDHC_BE
+#define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
+#endif
+
 /* DSPI and Serial Flash */
 #define CONFIG_CF_DSPI
 #define CONFIG_SERIAL_FLASH
@@ -72,6 +74,7 @@
 #define CONFIG_EXTRA_CLOCK
 
 #define CONFIG_PRAM			2048	/* 2048 KB */
+#define CONFIG_CMDLINE_EDITING
 #define CONFIG_SYS_CBSIZE		256	/* Console I/O Buffer Size */
 
 /* Print Buffer Size */
-- 
2.20.1



More information about the U-Boot mailing list