diff mbox

[U-Boot,23/32] nitrogen6x: config: expose SATA, then MMC over USB

Message ID 1412277413-30271-24-git-send-email-eric.nelson@boundarydevices.com
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Commit Message

Eric Nelson Oct. 2, 2014, 7:16 p.m. UTC
If no boot script was found, expose internal storage over the
USB mass storage gadget to allow easy programming.

This is especially useful when SD cards are inaccessible or when
loading SATA drives.

More details are available in this blog post:
        http://boundarydevices.com/u-boot-usb-mass-storage-gadget/

Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
---
 include/configs/nitrogen6x.h | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Comments

Stefano Babic Oct. 6, 2014, 4:08 p.m. UTC | #1
On 02/10/2014 21:16, Eric Nelson wrote:
> If no boot script was found, expose internal storage over the
> USB mass storage gadget to allow easy programming.
> 
> This is especially useful when SD cards are inaccessible or when
> loading SATA drives.
> 
> More details are available in this blog post:
>         http://boundarydevices.com/u-boot-usb-mass-storage-gadget/
> 
> Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
> ---



Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic
diff mbox

Patch

diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h
index 3c24443..b31b922 100644
--- a/include/configs/nitrogen6x.h
+++ b/include/configs/nitrogen6x.h
@@ -180,6 +180,7 @@ 
 #endif
 
 #define CONFIG_DRIVE_TYPES CONFIG_DRIVE_SATA CONFIG_DRIVE_MMC CONFIG_DRIVE_USB
+#define CONFIG_UMSDEVS CONFIG_DRIVE_SATA CONFIG_DRIVE_MMC
 
 #if defined(CONFIG_SABRELITE)
 #define CONFIG_EXTRA_ENV_SETTINGS \
@@ -260,6 +261,7 @@ 
 #else
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"bootdevs=" CONFIG_DRIVE_TYPES "\0" \
+	"umsdevs=" CONFIG_UMSDEVS "\0" \
 	"console=ttymxc1\0" \
 	"clearenv=if sf probe || sf probe || sf probe 1 ; then " \
 		"sf erase 0xc0000 0x2000 && " \
@@ -281,7 +283,26 @@ 
 		"echo ; echo 6x_bootscript not found ; " \
 		"echo ; echo serial console at 115200, 8N1 ; echo ; " \
 		"echo details at http://boundarydevices.com/6q_bootscript ; " \
-		"setenv stdout serial\0" \
+		"setenv stdout serial;" \
+		"setenv stdin serial,usbkbd;" \
+		"for dtype in ${umsdevs} ; do " \
+			"if itest.s sata == ${dtype}; then " \
+				"initcmd='sata init' ;" \
+			"else " \
+				"initcmd='mmc rescan' ;" \
+			"fi; " \
+			"for disk in 0 1 ; do " \
+				"if $initcmd && $dtype dev $disk ; then " \
+					"setenv stdout serial,vga; " \
+					"echo expose ${dtype} ${disk} " \
+						"over USB; " \
+					"ums 0 $dtype $disk ;" \
+				"fi; " \
+		"	done; " \
+		"done ;" \
+		"setenv stdout serial,vga; " \
+		"echo no block devices found;" \
+		"\0" \
 	"initrd_high=0xffffffff\0" \
 	"upgradeu=for dtype in ${bootdevs}" \
 		"; do " \