summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorMattijs Korpershoek <mkorpershoek@baylibre.com>2022-10-07 12:38:22 +0300
committerMarek Vasut <marex@denx.de>2022-10-10 19:08:18 +0300
commit5f7e01e9d5d8005e9a8fbbdf8a05dfd63a5e5f04 (patch)
tree83b2944c268cb7546042eb545e125e0384c0be10 /drivers/usb
parent75341e9c16aa10929a1616060a3b565ecf6e1418 (diff)
downloadu-boot-5f7e01e9d5d8005e9a8fbbdf8a05dfd63a5e5f04.tar.xz
usb: gadget: fastboot: detach usb on reboot commands
When host issues "fastboot reboot fastboot", it's expected that the board drops the USB connection before resetting. On some boards, such as Khadas VIM3L and SEI610, this is not the case. We observe the following error: $ fastboot reboot fastboot Rebooting into fastboot OKAY [ 0.004s] fastboot: error: Failed to boot into userspace fastboot; one or more components might be unbootable. This does not happen when we use the RST button on the board. It can be reproduced in linux with: # echo b > /proc/sysrq-trigger In this case, we hit a undefined hardware behavior, where D+ and D- are in an unknown state. Therefore the host can't detect usb disconnection. Make sure we always call usb_gadget_release() when a "fastboot reboot" command is issued. Note: usb_gadget_release() should be called before g_dnl_unregister() because g_dnl_unregister() triggers a complete() call on each endpoint (thus calling do_reset()). Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/f_fastboot.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index d0e92c7a07..07b1681c8a 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -544,6 +544,7 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
case FASTBOOT_COMMAND_REBOOT_FASTBOOTD:
case FASTBOOT_COMMAND_REBOOT_RECOVERY:
fastboot_func->in_req->complete = compl_do_reset;
+ g_dnl_trigger_detach();
break;
#if CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT)
case FASTBOOT_COMMAND_ACMD: