u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Christian Hewitt <christianshewitt@gmail.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	 Marek Vasut <marex@denx.de>, Lukasz Majewski <lukma@denx.de>
Cc: u-boot@lists.denx.de, Simon Glass <sjg@chromium.org>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	u-boot-amlogic@groups.io
Subject: [PATCH v2 0/2] fastboot/mach-meson: release usb_gadget on reboot commands
Date: Fri, 07 Oct 2022 11:38:21 +0200	[thread overview]
Message-ID: <20220728-reset-usb-controller-v2-0-ef7657ce78b1@baylibre.com> (raw)

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@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@baylibre.com>

             reply	other threads:[~2022-10-07  9:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07  9:38 Mattijs Korpershoek [this message]
2022-10-07  9:38 ` [PATCH v2 1/2] usb: gadget: fastboot: detach usb on reboot commands Mattijs Korpershoek
2022-10-10 16:08   ` Marek Vasut
2022-10-07  9:38 ` [PATCH v2 2/2] mach-meson: g12a: reset usb controller in reset_misc() Mattijs Korpershoek
2022-10-10 16:09   ` Marek Vasut
2022-10-10 16:22     ` Neil Armstrong
2022-10-10 17:16       ` Marek Vasut
2022-10-11  7:12         ` neil.armstrong
2022-10-11 15:39           ` Marek Vasut
2022-10-11 16:36             ` Mattijs Korpershoek
2022-10-11 17:57               ` neil.armstrong
2022-11-23 15:45                 ` Mattijs Korpershoek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220728-reset-usb-controller-v2-0-ef7657ce78b1@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=christianshewitt@gmail.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=neil.armstrong@linaro.org \
    --cc=sjg@chromium.org \
    --cc=u-boot-amlogic@groups.io \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).