From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Rae Date: Thu, 5 Mar 2015 16:10:02 -0800 Subject: [U-Boot] [PATCH v3] fastboot: add support for reboot-bootloader command In-Reply-To: <1424873447-22426-1-git-send-email-alexey_firago@mentor.com> References: <1424873447-22426-1-git-send-email-alexey_firago@mentor.com> Message-ID: <54F8F05A.4050709@broadcom.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 15-02-25 06:10 AM, Alexey Firago wrote: > The "fastboot reboot-bootloader" command is defined to > re-enter into fastboot mode after rebooting into > bootloader. This command is usually used after updating > bootloader via fastboot. > > This commit implements only a generic side of the > command - setting of the reset flag and then resetting. > Setting of the reset flag is implemented using __weak > fb_set_reboot_flag() function. The actual setting and > checking of the reset flag should be implemented by > a boot script and/or board/SoC specific code. > > Signed-off-by: Alexey Firago > --- > > Changes in v3: > - return -ENOSYS from default fb_set_reboot_flag() > > Changes in v2: > - return error in default fb_set_reboot_flag() > > drivers/usb/gadget/f_fastboot.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c > index 310175a..a000c25 100644 > --- a/drivers/usb/gadget/f_fastboot.c > +++ b/drivers/usb/gadget/f_fastboot.c > @@ -122,6 +122,7 @@ static struct usb_gadget_strings *fastboot_strings[] = { > }; > > static void rx_handler_command(struct usb_ep *ep, struct usb_request *req); > +static int strcmp_l1(const char *s1, const char *s2); > > static void fastboot_complete(struct usb_ep *ep, struct usb_request *req) > { > @@ -317,8 +318,20 @@ static void compl_do_reset(struct usb_ep *ep, struct usb_request *req) > do_reset(NULL, 0, 0, NULL); > } > > +int __weak fb_set_reboot_flag(void) > +{ > + return -ENOSYS; > +} > + > static void cb_reboot(struct usb_ep *ep, struct usb_request *req) > { > + char *cmd = req->buf; > + if (!strcmp_l1("reboot-bootloader", cmd)) { > + if (fb_set_reboot_flag()) { > + fastboot_tx_write_str("FAILCannot set reboot flag"); > + return; > + } > + } > fastboot_func->in_req->complete = compl_do_reset; > fastboot_tx_write_str("OKAY"); > } > Tested-by: Steve Rae (on bcm28155_ap board) Thanks!