summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlexey Firago <alexey_firago@mentor.com>2015-02-25 17:10:47 +0300
committerLukasz Majewski <l.majewski@samsung.com>2015-04-14 10:19:05 +0200
commite2ec3e461250fc82781c8a83387c140c6fc30a5a (patch)
tree07f8e92a3773a5ba6aa0e820135901e85dddc3e6 /drivers/usb
parent8a41802f21cc270cb00ac7dc1263a4c136c9a31c (diff)
downloadu-boot-imx-e2ec3e461250fc82781c8a83387c140c6fc30a5a.zip
u-boot-imx-e2ec3e461250fc82781c8a83387c140c6fc30a5a.tar.gz
u-boot-imx-e2ec3e461250fc82781c8a83387c140c6fc30a5a.tar.bz2
fastboot: add support for reboot-bootloader command
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 <alexey_firago@mentor.com> Tested-by: Steve Rae <srae@broadcom.com> [Test HW: bcm28155_ap board]
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/f_fastboot.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 751ec9e..206b6d1 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -123,6 +123,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)
{
@@ -326,8 +327,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");
}