fastboot/mach-meson: release usb_gadget on reboot commands
Subsystems (4)
v2 cover fastboot/mach-meson: release usb_gadget 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.
This series proposes 2 approaches for this problem:
* generic fix, which ensures that usb_gadget_disconnect() is called when the board receives any "fastboot reboot" commands
* platform specific reset implementation for g12a to ensure that the usb controller gets properly reset.
Changes in v2:
* Transformed into a series to provide both generic and platform
specific fix (Marek)
* Simplified generic fix via g_dnl_trigger_detach() (Marek)
* Link to v1: https://lore.kernel.org/r/[email protected]
---
Mattijs Korpershoek (2):
usb: gadget: fastboot: detach usb on reboot commands
mach-meson: g12a: reset usb controller in reset_misc()
arch/arm/mach-meson/board-g12a.c | 14 ++++++++++++++ cmd/fastboot.c | 2 +- configs/bananapi-m5_defconfig | 2 ++ configs/beelink-gsking-x_defconfig | 2 ++ configs/beelink-gtking_defconfig | 2 ++ configs/beelink-gtkingpro_defconfig | 2 ++ configs/khadas-vim3_android_ab_defconfig | 2 ++ configs/khadas-vim3_android_defconfig | 2 ++ configs/khadas-vim3_defconfig | 2 ++ configs/khadas-vim3l_android_ab_defconfig | 2 ++ configs/khadas-vim3l_android_defconfig | 2 ++ configs/khadas-vim3l_defconfig | 2 ++ configs/odroid-c4_defconfig | 2 ++ configs/odroid-hc4_defconfig | 2 ++ configs/odroid-n2_defconfig | 2 ++ configs/radxa-zero_defconfig | 2 ++ configs/u200_defconfig | 2 ++ drivers/usb/gadget/f_fastboot.c | 1 + 18 files changed, 46 insertions(+), 1 deletion(-)
---
base-commit: 2d4591353452638132d711551fec3495b7644731
change-id: 20220728-reset-usb-controller-1b54be54b9d8
Best regards,
Signature · 1 line
Mattijs Korpershoek <[email protected]>
PATCH v2 1/2 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()).
--- cmd/fastboot.c | 2 +- drivers/usb/gadget/f_fastboot.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
cmd/fastboot.c +1 -1
@@ -83,9 +83,9 @@ static int do_fastboot_usb(int argc, char *const argv[], ret =CMD_RET_SUCCESS ; exit: +usb_gadget_release (controller_index);g_dnl_unregister ();g_dnl_clear_detach (); -usb_gadget_release (controller_index);return ret;#else
drivers/usb/gadget/f_fastboot.c +1 -0
@@ -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 :
Signature · 1 line
b4 0.11.0-dev-5166b
Marek Vasut
AppliedRe: [PATCH v2 1/2] usb: gadget: fastboot: detach usb on reboot commands
Quoted 18 lines · Mattijs Korpershoek
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-triggerIn 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.
Quoted 6 lines
Make sure we always call
usb_gadget_release()when a "fastboot reboot" command is issued.Note:
usb_gadget_release()should be called beforeg_dnl_unregister()becauseg_dnl_unregister()triggers acomplete()call on each endpoint (thus callingdo_reset()).
Applied to usb/master , thanks
PATCH v2 2/2 mach-meson: g12a: reset usb controller in reset_misc()
In reply to Mattijs KorpershoekOn some g12a boards like the VIM3L and the SEI610, with some USB cables/hosts, there is a long (5s) delay before between "fastboot reboot" and the host detecting a USB reset.
This breaks tools relying on "fastboot reboot fastboot" which assume that 1s after the command send, the board should disconnect on usb.
To reproduce, enable fastboot in U-Boot console:
=> fastboot usb 0
Then, on the host, run:
# echo "running fastboot reboot bootloader" > /dev/kmsg && fastboot reboot bootloader Rebooting into bootloader OKAY [ 0.003s] Finished. Total time: 3.033s
[54074.251551] running fastboot reboot bootloader ... there is a delay of 5s before we detect a disconnection ... [54079.041238] usb 1-7.4: USB disconnect, device number 72 [54079.239625] usb 1-7.4: new high-speed USB device number 73 using xhci_hcd [54079.359103] usb 1-7.4: New USB device found, idVendor=1b8e, idProduct=fada, bcdDevice= 2.27 [54079.359110] usb 1-7.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [54079.359112] usb 1-7.4: Product: USB download gadget [54079.359114] usb 1-7.4: Manufacturer: U-Boot [54079.359116] usb 1-7.4: SerialNumber: C8631470CC41
Note: this does not happen when we use the RST button on the board.
To fix this, re-implement a platform reset which calls board_usb_cleanup() before resetting the board.
--- arch/arm/mach-meson/board-g12a.c | 14 ++++++++++++++ configs/bananapi-m5_defconfig | 2 ++ configs/beelink-gsking-x_defconfig | 2 ++ configs/beelink-gtking_defconfig | 2 ++ configs/beelink-gtkingpro_defconfig | 2 ++ configs/khadas-vim3_android_ab_defconfig | 2 ++ configs/khadas-vim3_android_defconfig | 2 ++ configs/khadas-vim3_defconfig | 2 ++ configs/khadas-vim3l_android_ab_defconfig | 2 ++ configs/khadas-vim3l_android_defconfig | 2 ++ configs/khadas-vim3l_defconfig | 2 ++ configs/odroid-c4_defconfig | 2 ++ configs/odroid-hc4_defconfig | 2 ++ configs/odroid-n2_defconfig | 2 ++ configs/radxa-zero_defconfig | 2 ++ configs/u200_defconfig | 2 ++ 16 files changed, 44 insertions(+)
arch/arm/mach-meson/board-g12a.c +14 -0
@@ -17,7 +17,9 @@#include <asm/io.h> #include <asm/armv8/mmu.h> #include <linux/sizes.h> +#include <linux/psci.h> #include <usb.h> +#include <reset.h> #include <linux/usb/otg.h> #include <asm/arch/usb.h> #include <usb/dwc2_udc.h>
@@ -217,3 +219,15 @@ int board_usb_cleanup(int index, enum usb_init_type init) return 0; }#endif + +#if !CONFIG_IS_ENABLED (PSCI_RESET ) +void reset_misc (void ) +{ +struct udevice *dev; + +board_usb_cleanup (0 ,USB_INIT_UNKNOWN ); + +uclass_get_device_by_name (UCLASS_FIRMWARE ,"psci" , &dev); +invoke_psci_fn (PSCI_0_2_FN_SYSTEM_RESET ,0 ,0 ,0 ); +} +#endif
configs/bananapi-m5_defconfig +2 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -9,6 +10,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING="bpi-m5" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/beelink-gsking-x_defconfig +2 -0
@@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="beelink-s922x" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -10,6 +11,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" beelink" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/beelink-gtking_defconfig +2 -0
@@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="beelink-s922x" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -10,6 +11,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" beelink" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/beelink-gtkingpro_defconfig +2 -0
@@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="beelink-s922x" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -10,6 +11,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" beelink" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/khadas-vim3_android_ab_defconfig +2 -0
@@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="vim3" CONFIG_SYS_CONFIG_NAME="khadas-vim3_android" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -11,6 +12,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" khadas-vim3" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/khadas-vim3_android_defconfig +2 -0
@@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="vim3" CONFIG_SYS_CONFIG_NAME="khadas-vim3_android" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -11,6 +12,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" khadas-vim3" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/khadas-vim3_defconfig +2 -0
@@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="vim3" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -10,6 +11,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" khadas-vim3" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/khadas-vim3l_android_ab_defconfig +2 -0
@@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="vim3" CONFIG_SYS_CONFIG_NAME="khadas-vim3l_android" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -11,6 +12,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" khadas-vim3l" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/khadas-vim3l_android_defconfig +2 -0
@@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="vim3" CONFIG_SYS_CONFIG_NAME="khadas-vim3l_android" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -11,6 +12,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" khadas-vim3l" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/khadas-vim3l_defconfig +2 -0
@@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="vim3" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -10,6 +11,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" khadas-vim3l" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/odroid-c4_defconfig +2 -0
@@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="odroid-n2" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -10,6 +11,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" odroid-c4/hc4" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/odroid-hc4_defconfig +2 -0
@@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="odroid-n2" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -10,6 +11,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" odroid-hc4" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_AHCI=y
configs/odroid-n2_defconfig +2 -0
@@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_SYS_BOARD="odroid-n2" +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -10,6 +11,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" odroid-n2/n2-plus" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/radxa-zero_defconfig +2 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -9,6 +10,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" radxa-zero" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
configs/u200_defconfig +2 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_ARM_SMCCC=y CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_NR_DRAM_BANKS=1
@@ -9,6 +10,7 @@ CONFIG_MESON_G12A=y CONFIG_DEBUG_UART_BASE=0xff803000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_IDENT_STRING=" u200" +# CONFIG_PSCI_RESET is not set CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_DEBUG_UART=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
Signature · 1 line
b4 0.11.0-dev-5166b
Re: [PATCH v2 2/2] mach-meson: g12a: reset usb controller in reset_misc()
Quoted 25 lines · Mattijs Korpershoek
On some g12a boards like the VIM3L and the SEI610, with some USB cables/hosts, there is a long (5s) delay before between "fastboot reboot" and the host detecting a USB reset.
This breaks tools relying on "fastboot reboot fastboot" which assume that 1s after the command send, the board should disconnect on usb.
To reproduce, enable fastboot in U-Boot console:
=> fastboot usb 0Then, on the host, run:
# echo "running fastboot reboot bootloader" > /dev/kmsg && fastboot reboot bootloader Rebooting into bootloader OKAY [ 0.003s] Finished. Total time: 3.033s[54074.251551] running fastboot reboot bootloader ... there is a delay of 5s before we detect a disconnection ... [54079.041238] usb 1-7.4: USB disconnect, device number 72 [54079.239625] usb 1-7.4: new high-speed USB device number 73 using xhci_hcd [54079.359103] usb 1-7.4: New USB device found, idVendor=1b8e, idProduct=fada, bcdDevice= 2.27 [54079.359110] usb 1-7.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [54079.359112] usb 1-7.4: Product: USB download gadget [54079.359114] usb 1-7.4: Manufacturer: U-Boot [54079.359116] usb 1-7.4: SerialNumber: C8631470CC41
Quoted 4 lines
Note: this does not happen when we use the RST button on the board.
To fix this, re-implement a platform reset which calls
board_usb_cleanup()before resetting the board.
Shouldn't that call happen somewhere in drivers/usb/ .remove() callback instead ?
Neil Armstrong
maintainerRe: [PATCH v2 2/2] mach-meson: g12a: reset usb controller in reset_misc()
Hi,
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Mattijs Korpershoek
On some g12a boards like the VIM3L and the SEI610, with some USB cables/hosts, there is a long (5s) delay before between "fastboot reboot" and the host detecting a USB reset.
This breaks tools relying on "fastboot reboot fastboot" which assume that 1s after the command send, the board should disconnect on usb.
To reproduce, enable fastboot in U-Boot console:
=> fastboot usb 0Then, on the host, run:
# echo "running fastboot reboot bootloader" > /dev/kmsg && fastboot reboot bootloader Rebooting into bootloader OKAY [ 0.003s] Finished. Total time: 3.033s[54074.251551] running fastboot reboot bootloader ... there is a delay of 5s before we detect a disconnection ... [54079.041238] usb 1-7.4: USB disconnect, device number 72 [54079.239625] usb 1-7.4: new high-speed USB device number 73 using xhci_hcd [54079.359103] usb 1-7.4: New USB device found, idVendor=1b8e, idProduct=fada, bcdDevice= 2.27 [54079.359110] usb 1-7.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [54079.359112] usb 1-7.4: Product: USB download gadget [54079.359114] usb 1-7.4: Manufacturer: U-Boot [54079.359116] usb 1-7.4: SerialNumber: C8631470CC41
Quoted 6 lines
Quoted 4 lines
Note: this does not happen when we use the RST button on the board.
To fix this, re-implement a platform reset which calls
board_usb_cleanup()before resetting the board.Shouldn't that call happen somewhere in
drivers/usb/.remove() callback instead ?
No since dwc2 isn't DM yet, handling is done in arch/arm/mac-meson board_usb_*() for now
Neil
Re: [PATCH v2 2/2] mach-meson: g12a: reset usb controller in reset_misc()
Quoted 1 line · Neil Armstrong
Hi,
Hi,
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Mattijs Korpershoek
Quoted 25 lines
On some g12a boards like the VIM3L and the SEI610, with some USB cables/hosts, there is a long (5s) delay before between "fastboot reboot" and the host detecting a USB reset.
This breaks tools relying on "fastboot reboot fastboot" which assume that 1s after the command send, the board should disconnect on usb.
To reproduce, enable fastboot in U-Boot console:
=> fastboot usb 0Then, on the host, run:
# echo "running fastboot reboot bootloader" > /dev/kmsg && fastboot reboot bootloader Rebooting into bootloader OKAY [ 0.003s] Finished. Total time: 3.033s[54074.251551] running fastboot reboot bootloader ... there is a delay of 5s before we detect a disconnection ... [54079.041238] usb 1-7.4: USB disconnect, device number 72 [54079.239625] usb 1-7.4: new high-speed USB device number 73 using xhci_hcd [54079.359103] usb 1-7.4: New USB device found, idVendor=1b8e, idProduct=fada, bcdDevice= 2.27 [54079.359110] usb 1-7.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [54079.359112] usb 1-7.4: Product: USB download gadget [54079.359114] usb 1-7.4: Manufacturer: U-Boot [54079.359116] usb 1-7.4: SerialNumber: C8631470CC41
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Note: this does not happen when we use the RST button on the board.
To fix this, re-implement a platform reset which calls
board_usb_cleanup()before resetting the board.Shouldn't that call happen somewhere in
drivers/usb/.remove() callback instead ?No since dwc2 isn't DM yet, handling is done in
arch/arm/mac-mesonboard_usb_*() for now
Seems DWC2 is DM:
$ git grep U_BOOT_DRIVER drivers/usb/ | grep dwc2
drivers/usb/gadget/dwc2_udc_otg.c:U_BOOT_DRIVER(dwc2_udc_otg) = {
drivers/usb/host/dwc2.c:U_BOOT_DRIVER(usb_dwc2) = {[email protected]
maintainerRe: [PATCH v2 2/2] mach-meson: g12a: reset usb controller in reset_misc()
Quoted 39 lines · Marek Vasut
Quoted 1 line · Neil Armstrong
Hi,
Hi,
Quoted 34 lines · Marek Vasut
Quoted 32 lines · Mattijs Korpershoek
Quoted 25 lines
On some g12a boards like the VIM3L and the SEI610, with some USB cables/hosts, there is a long (5s) delay before between "fastboot reboot" and the host detecting a USB reset.
This breaks tools relying on "fastboot reboot fastboot" which assume that 1s after the command send, the board should disconnect on usb.
To reproduce, enable fastboot in U-Boot console:
=> fastboot usb 0Then, on the host, run:
# echo "running fastboot reboot bootloader" > /dev/kmsg && fastboot reboot bootloader Rebooting into bootloader OKAY [ 0.003s] Finished. Total time: 3.033s[54074.251551] running fastboot reboot bootloader ... there is a delay of 5s before we detect a disconnection ... [54079.041238] usb 1-7.4: USB disconnect, device number 72 [54079.239625] usb 1-7.4: new high-speed USB device number 73 using xhci_hcd [54079.359103] usb 1-7.4: New USB device found, idVendor=1b8e, idProduct=fada, bcdDevice= 2.27 [54079.359110] usb 1-7.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [54079.359112] usb 1-7.4: Product: USB download gadget [54079.359114] usb 1-7.4: Manufacturer: U-Boot [54079.359116] usb 1-7.4: SerialNumber: C8631470CC41Quoted 4 lines
Note: this does not happen when we use the RST button on the board.
To fix this, re-implement a platform reset which calls
board_usb_cleanup()before resetting the board.Shouldn't that call happen somewhere in
drivers/usb/.remove() callback instead ?
Quoted 8 lines
Quoted 1 line
No since dwc2 isn't DM yet, handling is done in
arch/arm/mac-mesonboard_usb_*() for nowSeems DWC2 is DM:
$ git grep U_BOOT_DRIVER drivers/usb/ | grep dwc2 drivers/usb/gadget/dwc2_udc_otg.c:U_BOOT_DRIVER(dwc2_udc_otg) = { drivers/usb/host/dwc2.c:U_BOOT_DRIVER(usb_dwc2) = {
My bad, seems I missed the dwc2 otg DM wagon...
We will need to switch to this now then, thanks,
Neil
Re: [PATCH v2 2/2] mach-meson: g12a: reset usb controller in reset_misc()
Quoted 44 lines · On 10/11/22 09:12, [email protected] wrote:
Quoted 43 lines · Marek Vasut
Quoted 1 line · Neil Armstrong
Hi,
Hi,
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Mattijs Korpershoek
Quoted 25 lines
On some g12a boards like the VIM3L and the SEI610, with some USB cables/hosts, there is a long (5s) delay before between "fastboot reboot" and the host detecting a USB reset.
This breaks tools relying on "fastboot reboot fastboot" which assume that 1s after the command send, the board should disconnect on usb.
To reproduce, enable fastboot in U-Boot console:
=> fastboot usb 0Then, on the host, run:
# echo "running fastboot reboot bootloader" > /dev/kmsg && fastboot reboot bootloader Rebooting into bootloader OKAY [ 0.003s] Finished. Total time: 3.033s[54074.251551] running fastboot reboot bootloader ... there is a delay of 5s before we detect a disconnection ... [54079.041238] usb 1-7.4: USB disconnect, device number 72 [54079.239625] usb 1-7.4: new high-speed USB device number 73 using xhci_hcd [54079.359103] usb 1-7.4: New USB device found, idVendor=1b8e, idProduct=fada, bcdDevice= 2.27 [54079.359110] usb 1-7.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [54079.359112] usb 1-7.4: Product: USB download gadget [54079.359114] usb 1-7.4: Manufacturer: U-Boot [54079.359116] usb 1-7.4: SerialNumber: C8631470CC41Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Note: this does not happen when we use the RST button on the board.
To fix this, re-implement a platform reset which calls
board_usb_cleanup()before resetting the board.Shouldn't that call happen somewhere in
drivers/usb/.remove() callback instead ?No since dwc2 isn't DM yet, handling is done in
arch/arm/mac-mesonboard_usb_*() for nowSeems DWC2 is DM:
Quoted 8 lines
Quoted 4 lines
$ git grep U_BOOT_DRIVER drivers/usb/ | grep dwc2 drivers/usb/gadget/dwc2_udc_otg.c:U_BOOT_DRIVER(dwc2_udc_otg) = { drivers/usb/host/dwc2.c:U_BOOT_DRIVER(usb_dwc2) = {My bad, seems I missed the dwc2 otg DM wagon...
We will need to switch to this now then, thanks,
Thanks. I picked 1/2 at least, so you can only focus on 2/2 and send just that.
Re: [PATCH v2 2/2] mach-meson: g12a: reset usb controller in reset_misc()
Quoted 56 lines · Marek Vasut
Quoted 55 lines · On 10/11/22 09:12, [email protected] wrote:
Quoted 53 lines · Marek Vasut
Quoted 1 line · Neil Armstrong
Hi,
Hi,
Quoted 33 lines · Marek Vasut
Quoted 32 lines · Mattijs Korpershoek
Quoted 31 lines
On some g12a boards like the VIM3L and the SEI610, with some USB cables/hosts, there is a long (5s) delay before between "fastboot reboot" and the host detecting a USB reset.
This breaks tools relying on "fastboot reboot fastboot" which assume that 1s after the command send, the board should disconnect on usb.
To reproduce, enable fastboot in U-Boot console:
=> fastboot usb 0Then, on the host, run:
# echo "running fastboot reboot bootloader" > /dev/kmsg && fastboot reboot bootloader Rebooting into bootloader OKAY [ 0.003s] Finished. Total time: 3.033s[54074.251551] running fastboot reboot bootloader ... there is a delay of 5s before we detect a disconnection ... [54079.041238] usb 1-7.4: USB disconnect, device number 72 [54079.239625] usb 1-7.4: new high-speed USB device number 73 using xhci_hcd [54079.359103] usb 1-7.4: New USB device found, idVendor=1b8e, idProduct=fada, bcdDevice= 2.27 [54079.359110] usb 1-7.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [54079.359112] usb 1-7.4: Product: USB download gadget [54079.359114] usb 1-7.4: Manufacturer: U-Boot [54079.359116] usb 1-7.4: SerialNumber: C8631470CC41Note: this does not happen when we use the RST button on the board.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
To fix this, re-implement a platform reset which calls
board_usb_cleanup()before resetting the board.Shouldn't that call happen somewhere in
drivers/usb/.remove() callback instead ?No since dwc2 isn't DM yet, handling is done in
arch/arm/mac-mesonboard_usb_*() for nowSeems DWC2 is DM:
$ git grep U_BOOT_DRIVER drivers/usb/ | grep dwc2 drivers/usb/gadget/dwc2_udc_otg.c:U_BOOT_DRIVER(dwc2_udc_otg) = { drivers/usb/host/dwc2.c:U_BOOT_DRIVER(usb_dwc2) = {
Quoted 6 lines
Quoted 3 lines
My bad, seems I missed the dwc2 otg DM wagon...
We will need to switch to this now then, thanks,
Thanks. I picked 1/2 at least, so you can only focus on 2/2 and send just that.
Yes, thank you for picking 1/2
Neil, do you want me to look into converting the meson arch which uses DWC2 to DM?
I'm not sure I'm confident to do these changes properly but I'm willing to give it a try.
If you plan to do it yourself, fine by me. I'll respin 2/2 after that.
[email protected]
maintainerRe: [PATCH v2 2/2] mach-meson: g12a: reset usb controller in reset_misc()
Quoted 65 lines · Mattijs Korpershoek
Quoted 56 lines · Marek Vasut
Quoted 55 lines · On 10/11/22 09:12, [email protected] wrote:
Quoted 53 lines · Marek Vasut
Quoted 1 line · Neil Armstrong
Hi,
Hi,
Quoted 33 lines · Marek Vasut
Quoted 32 lines · Mattijs Korpershoek
Quoted 31 lines
On some g12a boards like the VIM3L and the SEI610, with some USB cables/hosts, there is a long (5s) delay before between "fastboot reboot" and the host detecting a USB reset.
This breaks tools relying on "fastboot reboot fastboot" which assume that 1s after the command send, the board should disconnect on usb.
To reproduce, enable fastboot in U-Boot console:
=> fastboot usb 0Then, on the host, run:
# echo "running fastboot reboot bootloader" > /dev/kmsg && fastboot reboot bootloader Rebooting into bootloader OKAY [ 0.003s] Finished. Total time: 3.033s[54074.251551] running fastboot reboot bootloader ... there is a delay of 5s before we detect a disconnection ... [54079.041238] usb 1-7.4: USB disconnect, device number 72 [54079.239625] usb 1-7.4: new high-speed USB device number 73 using xhci_hcd [54079.359103] usb 1-7.4: New USB device found, idVendor=1b8e, idProduct=fada, bcdDevice= 2.27 [54079.359110] usb 1-7.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [54079.359112] usb 1-7.4: Product: USB download gadget [54079.359114] usb 1-7.4: Manufacturer: U-Boot [54079.359116] usb 1-7.4: SerialNumber: C8631470CC41Note: this does not happen when we use the RST button on the board.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
To fix this, re-implement a platform reset which calls
board_usb_cleanup()before resetting the board.Shouldn't that call happen somewhere in
drivers/usb/.remove() callback instead ?No since dwc2 isn't DM yet, handling is done in
arch/arm/mac-mesonboard_usb_*() for nowSeems DWC2 is DM:
$ git grep U_BOOT_DRIVER drivers/usb/ | grep dwc2 drivers/usb/gadget/dwc2_udc_otg.c:U_BOOT_DRIVER(dwc2_udc_otg) = { drivers/usb/host/dwc2.c:U_BOOT_DRIVER(usb_dwc2) = {Quoted 6 lines
Quoted 3 lines
My bad, seems I missed the dwc2 otg DM wagon...
We will need to switch to this now then, thanks,
Thanks. I picked 1/2 at least, so you can only focus on 2/2 and send just that.
Quoted 7 lines
Yes, thank you for picking 1/2
Neil, do you want me to look into converting the meson arch which uses DWC2 to DM?
I'm not sure I'm confident to do these changes properly but I'm willing to give it a try.
If you plan to do it yourself, fine by me. I'll respin 2/2 after that.
Sure, give a try, if you don't manage I can help!
Neil
Re: [PATCH v2 2/2] mach-meson: g12a: reset usb controller in reset_misc()
Quoted 68 lines · On Tue, Oct 11, 2022 at 19:57, [email protected] wrote:
Quoted 67 lines · Mattijs Korpershoek
Quoted 56 lines · Marek Vasut
Quoted 55 lines · On 10/11/22 09:12, [email protected] wrote:
Quoted 53 lines · Marek Vasut
Quoted 1 line · Neil Armstrong
Hi,
Hi,
Quoted 33 lines · Marek Vasut
Quoted 32 lines · Mattijs Korpershoek
Quoted 31 lines
On some g12a boards like the VIM3L and the SEI610, with some USB cables/hosts, there is a long (5s) delay before between "fastboot reboot" and the host detecting a USB reset.
This breaks tools relying on "fastboot reboot fastboot" which assume that 1s after the command send, the board should disconnect on usb.
To reproduce, enable fastboot in U-Boot console:
=> fastboot usb 0Then, on the host, run:
# echo "running fastboot reboot bootloader" > /dev/kmsg && fastboot reboot bootloader Rebooting into bootloader OKAY [ 0.003s] Finished. Total time: 3.033s[54074.251551] running fastboot reboot bootloader ... there is a delay of 5s before we detect a disconnection ... [54079.041238] usb 1-7.4: USB disconnect, device number 72 [54079.239625] usb 1-7.4: new high-speed USB device number 73 using xhci_hcd [54079.359103] usb 1-7.4: New USB device found, idVendor=1b8e, idProduct=fada, bcdDevice= 2.27 [54079.359110] usb 1-7.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [54079.359112] usb 1-7.4: Product: USB download gadget [54079.359114] usb 1-7.4: Manufacturer: U-Boot [54079.359116] usb 1-7.4: SerialNumber: C8631470CC41Note: this does not happen when we use the RST button on the board.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
To fix this, re-implement a platform reset which calls
board_usb_cleanup()before resetting the board.Shouldn't that call happen somewhere in
drivers/usb/.remove() callback instead ?No since dwc2 isn't DM yet, handling is done in
arch/arm/mac-mesonboard_usb_*() for nowSeems DWC2 is DM:
$ git grep U_BOOT_DRIVER drivers/usb/ | grep dwc2 drivers/usb/gadget/dwc2_udc_otg.c:U_BOOT_DRIVER(dwc2_udc_otg) = { drivers/usb/host/dwc2.c:U_BOOT_DRIVER(usb_dwc2) = {Quoted 6 lines
Quoted 3 lines
My bad, seems I missed the dwc2 otg DM wagon...
We will need to switch to this now then, thanks,
Thanks. I picked 1/2 at least, so you can only focus on 2/2 and send just that.
Yes, thank you for picking 1/2
Quoted 7 lines
Quoted 5 lines
Neil, do you want me to look into converting the meson arch which uses DWC2 to DM?
I'm not sure I'm confident to do these changes properly but I'm willing to give it a try.
If you plan to do it yourself, fine by me. I'll respin 2/2 after that.Sure, give a try, if you don't manage I can help!
Done here:
https://lore.kernel.org/u-boot/[email protected]/
Quoted 3 lines
Neil