Patchwork [U-Boot,v3,1/7] mx6qsabre{sd, auto}: Add update_sd_firmware support

login
register
mail settings
Submitter Otavio Salvador
Date April 19, 2013, 1:41 p.m.
Message ID <1366378923-15615-1-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/237947/
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Comments

Otavio Salvador - April 19, 2013, 1:41 p.m.
This allow for easy update of firmware in the SD card from a running
U-Boot.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
Changes in v3:
- New patch

Changes in v2: None

 include/configs/mx6qsabre_common.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Stefano Babic - April 25, 2013, 7:38 p.m.
On 19/04/2013 15:41, Otavio Salvador wrote:
> This allow for easy update of firmware in the SD card from a running
> U-Boot.
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---


Applied to u-boot-imx, -next branch, thanks.

Best regards,
Stefano Babic

Patch

diff --git a/include/configs/mx6qsabre_common.h b/include/configs/mx6qsabre_common.h
index 015e2b0..a32d7dd 100644
--- a/include/configs/mx6qsabre_common.h
+++ b/include/configs/mx6qsabre_common.h
@@ -78,6 +78,7 @@ 
 
 #define CONFIG_CMD_BMODE
 #define CONFIG_CMD_BOOTZ
+#define CONFIG_CMD_SETEXPR
 #undef CONFIG_CMD_IMLS
 
 #define CONFIG_BOOTDELAY               10
@@ -98,6 +99,19 @@ 
 	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
 	"mmcpart=" __stringify(CONFIG_SYS_MMC_ENV_PART) "\0" \
 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+	"update_sd_firmware=" \
+		"if test ${ip_dyn} = yes; then " \
+			"setenv get_cmd dhcp; " \
+		"else " \
+			"setenv get_cmd tftp; " \
+		"fi; " \
+		"if mmc dev ${mmcdev}; then "	\
+			"if ${get_cmd} ${update_sd_firmware_filename}; then " \
+				"setexpr fw_sz ${filesize} / 0x200; " \
+				"setexpr fw_sz ${fw_sz} + 1; "	\
+				"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
+			"fi; "	\
+		"fi\0" \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 		"root=${mmcroot}\0" \
 	"loadbootscript=" \