Patchwork [U-Boot] mx6sabresd: Add eMMC specific environment to allow U-Boot update

login
register
mail settings
Submitter Otavio Salvador
Date Oct. 21, 2013, 11:29 p.m.
Message ID <1382398185-8295-1-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/285294/
State Changes Requested
Delegated to: Stefano Babic
Headers show

Comments

Otavio Salvador - Oct. 21, 2013, 11:29 p.m.
A new 'update_emmc_firmware' target is added to allow for easy U-Boot
update in the eMMC as it has secury boot partition and this needs
specific handling on how to program the specific partition.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 include/configs/mx6sabre_common.h | 23 +++++++++++++++++++++++
 include/configs/mx6sabresd.h      |  2 ++
 2 files changed, 25 insertions(+)

Patch

diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h
index bf6113b..a87ec12 100644
--- a/include/configs/mx6sabre_common.h
+++ b/include/configs/mx6sabre_common.h
@@ -78,6 +78,28 @@ 
 #define CONFIG_LOADADDR                        0x12000000
 #define CONFIG_SYS_TEXT_BASE           0x17800000
 
+#ifdef CONFIG_SUPPORT_EMMC_BOOT
+#define EMMC_ENV \
+	"emmcdev=2\0" \
+	"update_emmc_firmware=" \
+		"if test ${ip_dyn} = yes; then " \
+			"setenv get_cmd dhcp; " \
+		"else " \
+			"setenv get_cmd tftp; " \
+		"fi; " \
+		"if ${get_cmd} ${update_sd_firmware_filename}; then " \
+			"if mmc dev ${emmcdev} && " \
+				"mmc open ${emmcdev} 1; then "	\
+				"setexpr fw_sz ${filesize} / 0x200; " \
+				"setexpr fw_sz ${fw_sz} + 1; "	\
+				"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
+				"mmc close ${emmcdev} 1; " \
+			"fi; "	\
+		"fi\0"
+#else
+#define EMMC_DEV ""
+#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"script=boot.scr\0" \
 	"uimage=uImage\0" \
@@ -104,6 +126,7 @@ 
 				"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
 			"fi; "	\
 		"fi\0" \
+	EMMC_ENV	  \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 		"root=${mmcroot}\0" \
 	"loadbootscript=" \
diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h
index 3229bc7..7653ecb 100644
--- a/include/configs/mx6sabresd.h
+++ b/include/configs/mx6sabresd.h
@@ -30,6 +30,8 @@ 
 #define CONFIG_SYS_MMC_ENV_DEV		1	/* SDHC3 */
 #endif
 
+#define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */
+
 /* Framebuffer */
 #define CONFIG_VIDEO
 #define CONFIG_VIDEO_IPUV3