lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <jhlqcoxnvpw5tndmty322y64n4d2me7mkp45nikos6fzamcs3u@kwahmdbv2zgx>
Date: Thu, 3 Jul 2025 15:20:33 +0200
From: Ernest Van Hoecke <ernestvanhoecke@...il.com>
To: Alan Stern <stern@...land.harvard.edu>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Thinh Nguyen <Thinh.Nguyen@...opsys.com>, 
	Roger Quadros <rogerq@...nel.org>, Nishanth Menon <nm@...com>, 
	Vignesh Raghavendra <vigneshr@...com>
Cc: Sebastian Reichel <sebastian.reichel@...labora.com>, 
	Chance Yang <chance.yang@...ron.us>, Prashanth K <prashanth.k@....qualcomm.com>, 
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: dwc3-am62/usb-conn-gpio: USB gadget not added when booting in
 host mode

On Tue, Jun 24, 2025 at 05:08:32PM +0200, Ernest Van Hoecke wrote:
> On the TI AM62 when using a USB OTG port, I found some unexpected
> behaviour when booting with this port in host mode.
>
> This happens, for example, when booting with a USB pen drive inserted
> When the pen drive is later removed, the OTG port correctly switches
> to "device" mode instead of "host" mode, but the related USB gadget
> does not come up (in my case, a CDC NCM configuration).
>
> This issue only occurs when CONFIG_USB_CONN_GPIO and
> CONFIG_USB_DWC3_AM62 are set to m and not when these modules are
> built-in.
>

Hi all,

This turned out not to be a kernel issue. For future reference and
anyone else running into this I'll document what our problem was
below.

The systemd target `usb-gadget.target` is triggered by udev when a UDC
first comes up. It can happen that by the time gadget-start runs, this
UDC has been removed from the system again.

For example, we saw such a situation using the DWC3 USB controller and
usb-conn-gpio kernel modules as loadables. By the time of the DWC3 init,
udev was active, and during init DWC3 started the USB OTG port in device
mode. If a pen drive was plugged in at boot, it would quickly switch to
host mode right after initialisation, emitting another udev event for
the removal of the UDC. The systemd target was thus reached, but by the
time gadget-start ran, the UDC was gone.

  dwc3 init       usb-conn-gpio role switch
      │                       │
      ▼                       ▼
udev: add UDC─┐         udev: del UDC─────►/sys/class/udc empty
              │                                         │
              │                                         x
              │                                         │
              │                                         ▼
              └────────────►usb-gadget.target─────►gadget-start

For us the solution was to add a udev rule to bind the gadget every
time the UDC comes up, so the situation can resolve itself.

Kind regards,
Ernest

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ