[U-Boot] [PATCH 8/8] ums: allow the user to specify the device type

Stephen Warren swarren at wwwdotorg.org
Wed Apr 30 23:13:22 CEST 2014


From: Stephen Warren <swarren at nvidia.com>

Allow an optional devtype parameter to the ums command, which specifies
the type of the device to be exported. This could allow exporting a SATA
or even another USB device.

Cc: Przemyslaw Marczak <p.marczak at samsung.com>
Cc: Lukasz Majewski <l.majewski at samsung.com>
Signed-off-by: Stephen Warren <swarren at nvidia.com>
---
 common/cmd_usb_mass_storage.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 31dd37c7c66f..2ef5c0912e9c 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -77,8 +77,13 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 		return CMD_RET_USAGE;
 
 	usb_controller = argv[1];
-	devtype = "mmc";
-	devnum  = argv[2];
+	if (argc >= 4) {
+		devtype = argv[2];
+		devnum  = argv[3];
+	} else {
+		devtype = "mmc";
+		devnum  = argv[2];
+	}
 
 	ums = ums_init(devtype, devnum);
 	if (!ums)
@@ -146,7 +151,8 @@ exit:
 	return CMD_RET_SUCCESS;
 }
 
-U_BOOT_CMD(ums, CONFIG_SYS_MAXARGS, 1, do_usb_mass_storage,
+U_BOOT_CMD(ums, 4, 1, do_usb_mass_storage,
 	"Use the UMS [User Mass Storage]",
-	"ums <USB_controller> <mmc_dev>  e.g. ums 0 0"
+	"ums <USB_controller> [<devtype>] <devnum>  e.g. ums 0 mmc 0\n"
+	"    devtype defaults to mmc"
 );
-- 
1.8.1.5



More information about the U-Boot mailing list