diff mbox

[U-Boot] Enable xmodem support

Message ID 1372287264-1939-1-git-send-email-angus@akkea.ca
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Angus Ainslie June 26, 2013, 10:54 p.m. UTC
This is a trivial patch that just enables xmodem downloads using the existing
ymodem framework.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
---
 common/cmd_load.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

Comments

Tom Rini Aug. 18, 2013, 9:49 p.m. UTC | #1
On Wed, Jun 26, 2013 at 04:54:24PM -0600, Angus Ainslie wrote:

> This is a trivial patch that just enables xmodem downloads using the existing
> ymodem framework.
> 
> Signed-off-by: Angus Ainslie <angus@akkea.ca>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/cmd_load.c b/common/cmd_load.c
index 0832e92..ed282b5 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -34,7 +34,7 @@ 
 DECLARE_GLOBAL_DATA_PTR;
 
 #if defined(CONFIG_CMD_LOADB)
-static ulong load_serial_ymodem(ulong offset);
+static ulong load_serial_ymodem(ulong offset, int mode);
 #endif
 
 #if defined(CONFIG_CMD_LOADS)
@@ -478,7 +478,15 @@  static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc,
 			offset,
 			load_baudrate);
 
-		addr = load_serial_ymodem(offset);
+		addr = load_serial_ymodem(offset, xyzModem_ymodem);
+
+	} else if (strcmp(argv[0],"loadx")==0) {
+		printf("## Ready for binary (xmodem) download "
+			"to 0x%08lX at %d bps...\n",
+			offset,
+			load_baudrate);
+
+		addr = load_serial_ymodem(offset, xyzModem_xmodem);
 
 	} else {
 
@@ -958,7 +966,7 @@  static int getcxmodem(void) {
 		return (getc());
 	return -1;
 }
-static ulong load_serial_ymodem(ulong offset)
+static ulong load_serial_ymodem(ulong offset, int mode)
 {
 	int size;
 	int err;
@@ -969,7 +977,7 @@  static ulong load_serial_ymodem(ulong offset)
 	ulong addr = 0;
 
 	size = 0;
-	info.mode = xyzModem_ymodem;
+	info.mode = mode;
 	res = xyzModem_stream_open(&info, &err);
 	if (!res) {
 
@@ -1072,6 +1080,14 @@  U_BOOT_CMD(
 );
 
 U_BOOT_CMD(
+	loadx, 3, 0,	do_load_serial_bin,
+	"load binary file over serial line (xmodem mode)",
+	"[ off ] [ baud ]\n"
+	"    - load binary file over serial line"
+	" with offset 'off' and baudrate 'baud'"
+);
+
+U_BOOT_CMD(
 	loady, 3, 0,	do_load_serial_bin,
 	"load binary file over serial line (ymodem mode)",
 	"[ off ] [ baud ]\n"