Re: [U-Boot] [PATCH v1 3/7] usb: gadget: sdp: extend images compatible for jumps
On 05/08/2017 01:38, Stefan Agner wrote: > From: Stefan Agner > > Support U-Boot images in SPL so that u-boot.img files can be > directly downloaded and executed. Furthermore support U-Boot > scripts download and execution in full U-Boot so that custom > recovery actions can be downloaded from the host in a third > step. > > Signed-off-by: Stefan Agner > --- > > drivers/usb/gadget/f_sdp.c | 20 ++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c > index eb89695aaf..9a752843f0 100644 > --- a/drivers/usb/gadget/f_sdp.c > +++ b/drivers/usb/gadget/f_sdp.c > @@ -29,6 +29,8 @@ > #include > #include > #include > +#include > +#include > #include > > #define HID_REPORT_ID_MASK 0x00ff > @@ -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; > Reviewed-by: Stefano Babic Best regards, Stefano Babic -- = DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 3/7] usb: gadget: sdp: extend images compatible for jumps
Hi Stefan, From: Stefan Agner Support U-Boot images in SPL so that u-boot.img files can be directly downloaded and executed. Furthermore support U-Boot scripts download and execution in full U-Boot so that custom recovery actions can be downloaded from the host in a third step. Signed-off-by: Stefan Agner Reviewed-by: Łukasz Majewski --- drivers/usb/gadget/f_sdp.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index eb89695aaf..9a752843f0 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #define HID_REPORT_ID_MASK 0x00ff @@ -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; -- Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 3/7] usb: gadget: sdp: extend images compatible for jumps
From: Stefan Agner Support U-Boot images in SPL so that u-boot.img files can be directly downloaded and executed. Furthermore support U-Boot scripts download and execution in full U-Boot so that custom recovery actions can be downloaded from the host in a third step. Signed-off-by: Stefan Agner --- drivers/usb/gadget/f_sdp.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index eb89695aaf..9a752843f0 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #define HID_REPORT_ID_MASK 0x00ff @@ -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; -- 2.13.3 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot