[PATCH v2 0/2] fastboot/mach-meson: release usb_gadget on reboot commands

Mattijs Korpershoek mkorpershoek at baylibre.com
Fri Oct 7 11:38:21 CEST 2022


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/20220721135955.360195-1-mkorpershoek@baylibre.com

Signed-off-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>

---
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,
-- 
Mattijs Korpershoek <mkorpershoek at baylibre.com>


More information about the U-Boot mailing list