diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2016-11-11 09:59:57 -0800 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2017-01-18 09:46:19 +0100 |
commit | f3d25fc844f7001d1f4ed7e90e53db7f81c029a6 (patch) | |
tree | 0a77d25d89e42f219d805e97eaa6afaa02ca9256 | |
parent | d7b22787ea3015270000d6b8bcb829c82fb9fc67 (diff) |
usb: gadget: sdp: extend images compatible for jumps
Support U-Boot images in SPL (which makes it possible to download
u-boot.img) and U-Boot scripts in full U-Boot.
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
-rw-r--r-- | drivers/usb/gadget/f_sdp.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index e0acb52f2a8..77c3f94aa49 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -29,6 +29,8 @@ #include <asm/io.h> #include <g_dnl.h> #include <sdp.h> +#include <spl.h> +#include <image.h> #include <imximage.h> #define HID_REPORT_ID_MASK 0x000000ff @@ -672,8 +674,22 @@ static void sdp_handle_in_ep(void) sdp_func->state = SDP_STATE_TX_REGISTER_BUSY; break; case SDP_STATE_JUMP: - printf("Checking imxheader at 0x%08x\n", f_sdp->jmp_address); - status = sdp_jump_imxheader((void *)f_sdp->jmp_address); + printf("Jumping to header at 0x%08x\n", sdp_func->jmp_address); + status = sdp_jump_imxheader((void *)sdp_func->jmp_address); + + /* If imx header fails, try some U-Boot specific headers */ + if (status) { +#ifdef CONFIG_SPL_BUILD + /* In SPL, allow jumps to U-Boot images */ + struct spl_image_info spl_image = {}; + spl_parse_image_header(&spl_image, + (struct image_header *)sdp_func->jmp_address); + jump_to_image_no_args(&spl_image); +#else + /* In U-Boot, allow jumps to scripts */ + source(sdp_func->jmp_address, "script@1"); +#endif + } sdp_func->next_state = SDP_STATE_IDLE; sdp_func->error_status = status; |