mx6qsabre{sd, auto}: Add update_sd_firmware support
authorOtavio Salvador <otavio@ossystems.com.br>
Fri, 19 Apr 2013 03:41:57 +0000 (03:41 +0000)
committerStefano Babic <sbabic@denx.de>
Thu, 25 Apr 2013 19:29:46 +0000 (21:29 +0200)
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>
include/configs/mx6qsabre_common.h

index f5f115fa009269a1214cdac20f3053af7729436b..7298a7692e9d849dd74e4ba3fa8da1cda82659e1 100644 (file)
@@ -78,6 +78,7 @@
 
 #define CONFIG_CMD_BMODE
 #define CONFIG_CMD_BOOTZ
+#define CONFIG_CMD_SETEXPR
 #undef CONFIG_CMD_IMLS
 
 #define CONFIG_BOOTDELAY               1
        "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=" \