usb: gadget: fastboot: detach usb just before rebooting
The patch fixes the following error when updating a BSH SMM S2 board:
3:72>Start Cmd:FB[-t 8000]: ucmd nand write ${loadaddr} nanddtb ${filesize}
3:72>Okay (0.023s)
3:72>Start Cmd:FB: reboot
3:72>Fail Bulk(R):LIBUSB_ERROR_IO(0s)
The "fastboot reboot" command detaches the USB when it still needs to be
used. So let's detach the USB just before the reset.
CC: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Fixes: 5f7e01e9d5
("usb: gadget: fastboot: detach usb on reboot commands")
Suggested-by: Michael Trimarchi <michael@amarulasolutions.com>
Co-developed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
This commit is contained in:
parent
5454dea313
commit
66b5847b30
@ -421,6 +421,7 @@ static int fastboot_tx_write_str(const char *buffer)
|
|||||||
|
|
||||||
static void compl_do_reset(struct usb_ep *ep, struct usb_request *req)
|
static void compl_do_reset(struct usb_ep *ep, struct usb_request *req)
|
||||||
{
|
{
|
||||||
|
g_dnl_unregister();
|
||||||
do_reset(NULL, 0, 0, NULL);
|
do_reset(NULL, 0, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,7 +543,6 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
|
|||||||
case FASTBOOT_COMMAND_REBOOT_FASTBOOTD:
|
case FASTBOOT_COMMAND_REBOOT_FASTBOOTD:
|
||||||
case FASTBOOT_COMMAND_REBOOT_RECOVERY:
|
case FASTBOOT_COMMAND_REBOOT_RECOVERY:
|
||||||
fastboot_func->in_req->complete = compl_do_reset;
|
fastboot_func->in_req->complete = compl_do_reset;
|
||||||
g_dnl_trigger_detach();
|
|
||||||
break;
|
break;
|
||||||
case FASTBOOT_COMMAND_ACMD:
|
case FASTBOOT_COMMAND_ACMD:
|
||||||
if (CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT))
|
if (CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT))
|
||||||
|
Loading…
Reference in New Issue
Block a user