From 8c7cf3423a7592d9f18f197bd1b26da6f2892bf2 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Wed, 6 Jan 2010 10:24:19 +0900 Subject: [PATCH] usbd: add download mode Signed-off-by: Minkyu Kang --- common/cmd_usbd.c | 19 +++++++++++++------ include/usbd.h | 6 ++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/common/cmd_usbd.c b/common/cmd_usbd.c index e22d0dc..675203e 100644 --- a/common/cmd_usbd.c +++ b/common/cmd_usbd.c @@ -37,6 +37,8 @@ static unsigned char yaffs_data[2112]; static unsigned long down_ram_addr; +static int down_mode; + /* cpu/${CPU} dependent */ extern void do_reset(void); @@ -722,7 +724,7 @@ static int process_data(struct usbd_ops *usbd) case BOOT_PART_ID: #ifdef CONFIG_S5PC1XX /* Workaround: for prevent revision mismatch */ - if (cpu_is_s5pc110()) { + if (cpu_is_s5pc110() && (down_mode != MODE_FORCE)) { int img_rev = 1; long *img_header = (long *)down_ram_addr; @@ -831,7 +833,12 @@ int do_usbd_down(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) struct usbd_ops *usbd; int err; - printf("USB Downloader v%s\n", APP_VERSION); + if (argc > 1) + down_mode = simple_strtoul(argv[1], NULL, 10); + else + down_mode = MODE_NORMAL; + + printf("USB Downloader v%s (%d)\n", APP_VERSION, down_mode); /* get partition info */ err = get_part_info(); @@ -880,8 +887,8 @@ int do_usbd_down(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -U_BOOT_CMD(usbdown, 3, 0, do_usbd_down, - "initialize USB device and ready to receive" - " for Windows server (specific)\n", - "[download address]\n" +U_BOOT_CMD(usbdown, CONFIG_SYS_MAXARGS, 1, do_usbd_down, + "Initialize USB device and Run USB Downloader (specific)", + "- normal mode\n" + "usbdown mode - specific mode (0: NORAML, 1: FORCE)\n" ); diff --git a/include/usbd.h b/include/usbd.h index 0ea1be9..6187af9 100644 --- a/include/usbd.h +++ b/include/usbd.h @@ -61,6 +61,12 @@ enum { STATUS_ERROR, }; +/* download mode definition */ +enum { + MODE_NORMAL = 0, + MODE_FORCE, +}; + /* * USB Downloader Operations * All functions and valuable are mandatory -- 2.7.4