U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v9 0/9] usb: ehci-vf: make the USB host port usable
@ 2026-10-23 11:15 Mehmet Fide
  2026-10-23 11:15 ` [PATCH v9 1/9] fdtdec: match an alias to its stem only when the number follows it Mehmet Fide
                   ` (9 more replies)
  0 siblings, 10 replies; 20+ messages in thread
From: Mehmet Fide @ 2026-10-23 11:15 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Simon Glass, Tom Rini, Fabio Estevam, Stefan Agner,
	Francesco Dolcini, Krzysztof Kozlowski, u-boot, mehmet.fide

From: Mehmet Fide <mehmet.fide@screeningeagle.com>

"usb start" on a Colibri VF50 or VF61 kills U-Boot with a data abort,
and even with that fixed the host port stays unpowered:

- patch 1 makes the flat-tree alias lookups match a stem exactly, as
  the live tree does; their prefix match is what gave the two USB
  controllers of the Vybrid the sequence numbers 2 and 3
- patch 2 fixes the data abort: the controller index came from that
  sequence number and indexed past the driver's tables
- patches 3 to 7 drop the dead non-DM path and the empty bind hook,
  take dr_mode through usb_get_dr_mode() and the ID detect gpio
  through the device, and the PHY, usbmisc and anatop bases from the
  device tree instead of the tables
- patch 8 sorts the includes
- patch 9 enables the vbus-supply of the port

Patches 3 to 7 are the follow-up Marek asked for in his review of the
data abort fix: the PHY and usbmisc tables are gone, and the port index
that is left, for board_ehci_hcd_init() and the anatop registers, comes
from the clock of the PHY.

v9:
- Krzysztof's review of v8: patch 7 takes the port index from the clock
  of the PHY, VF610_CLK_USBPHY0 or VF610_CLK_USBPHY1, instead of the
  usbphy alias, which is not documented ABI; the ofnode_get_alias_seq()
  patch of v8 is dropped, so patches 6 to 10 of v8 are now 5 to 9
- patch 9 puts dev before vbus_supply in the private data (Marek)
- patches 5 and 9 carry Marek's Reviewed-by; patch 7 drops his v8 one,
  its code changed, and so does patch 8 for the one include it now sorts
- rebased on main

v8:
- Marek's review of v7: patch 6 reads dr_mode through usb_get_dr_mode()
  alone and takes USB_DR_MODE_UNKNOWN as host, for legacy device trees
  without the property; an unknown value now means host as well, as
  in v6, instead of the -EINVAL of v7
- new patch 9 sorts the includes; patch 10 adds its two in order and
  leaves the argument of the reset hook named dev
- patches 7 and 8 carry Marek's Reviewed-by
- rebased on main

v7:
- Marek's review of v6: the dr_mode patch is split in two, patch 6 only
  replaces the private enum and the strcmp() chain, the new patch 7
  moves the ID detect gpio request to the device and into the probe,
  checks the results of gpio_request_by_name() and dm_gpio_get_value(),
  and frees the gpio in a new remove hook and on the failing probe
  paths, so the probe that follows a "usb stop" can request it again
- a dr_mode value the driver does not know fails the probe with
  -EINVAL again, as it did before the series; v6 made it host
- patch 8 keeps the u32 portnr, the alias lookup writes a local int
- the tags sit above the Signed-off-by; patch 3 carries Marek's
  Reviewed-by
- Simon's Reviewed-by on v6 carried to patches 1 to 5, whose code is
  unchanged; patches 6 and 8 changed after his review and patch 7 is
  new
- patch 9 drops the Reviewed-by of Marek and Simon on v6: its VBUS code
  is unchanged, but it now adds its line to the remove hook of patch 7
- rebased on main

v6:
- Marek's review of v5: patch 3 names USB_HOST as the option that
  selects DM_USB, patch 4 loses its two Fixes tags, patches 2 and 4
  carry his Reviewed-by
- new patch 6: the driver's own dr_mode enum and parsing go, it uses
  usb_get_dr_mode() and USB_DR_MODE_* as ehci-mx6 does
- patch 7 reads the phandles of the controller node with
  dev_read_phandle_with_args() and passes the private data to the
  helpers instead of single addresses
- patch 8 reports through dev_err() and dev_dbg()

v5:
- Simon's review of patch 4 (now 5): the live and the flat lookup
  treated the stem differently, exact against prefix, and the register
  base patch relied on the prefix to find usbphy0 with the "usb" stem.
  New patch 1 makes the flat lookup exact, ofnode_get_alias_seq()
  documents it and its test checks a prefix stem; the PHY node is
  looked up with the "usbphy" stem
- ofnode_get_alias_seq() now works on a node of any tree, on the live
  tree as well: of_alias_get_id() looks a node outside the control tree
  up in the /aliases node of its own tree; a test uses the other tree of
  the sandbox tests
- the checkpatch note of patch 4 (now 5) moved below the --- line
- rebased on main after the v2026.10 release

v4:
- rebased on next; the dm core change that moved of_to_plat() after
  pinctrl is gone, the regulator GPIO is now claimed at probe time
  upstream, which is what the vbus patch needed
- the data abort fix joins the series, the register base patch depends
  on it
- the vbus patch enables VBUS in the reset hook only, as ehci-mx6 does;
  v3 enabled it there and in the shared init, so the regulator counted
  two enables per probe and "usb stop" never switched VBUS off
- the dm core patch gains a test and no longer documents -ENOENT for a
  missing alias, the live tree returns -ENODEV

v8 of this series:
https://lore.kernel.org/u-boot/20261022070900.616265-1-mehmet.fide@gmail.com/
v7 of this series:
https://lore.kernel.org/u-boot/20261020101608.2818265-1-mehmet.fide@gmail.com/
v6 of this series:
https://lore.kernel.org/u-boot/20261016072526.2277530-1-mehmet.fide@gmail.com/
v5 of this series:
https://lore.kernel.org/u-boot/20261013090738.377537-1-mehmet.fide@gmail.com/
v4 of this series:
https://lore.kernel.org/u-boot/cover.1791381507.git.mehmet.fide@screeningeagle.com/
v2 of the register base series:
https://lore.kernel.org/u-boot/20260820071511.1036506-1-mehmet.fide@gmail.com/
v3 of the vbus series:
https://lore.kernel.org/u-boot/20260820102523.1076815-1-mehmet.fide@gmail.com/
the data abort fix on its own:
https://lore.kernel.org/u-boot/20260818151236.2891878-1-mehmet.fide@gmail.com/

Tested on a Colibri VF50 V1.2A on the Iris carrier, colibri_vf_defconfig
on main (903c9578eeb): "usb start" finds a USB stick behind the host
port at usb@400b4000 and reads the same data before and after "usb
reset", VBUS goes on at "usb start" and off at "usb stop", also after
repeated resets, and Linux takes the port over when U-Boot boots it
without "usb stop". The code of patches 1 to 4 is the one tested on a
VF61 V1.2B for v6; patches 5 to 9 changed only in the driver and were
tested on the VF50 as above, usb0 on PLL3 and usb1 on PLL7. With local
device trees that make usb0 an OTG port with the fsl,cdet-gpio
colibri_vf had before its device tree sync, both ID states went through
"usb start", "usb reset" and "usb stop" cycles: read as device, the port
is not available on every start and the gpio stays free; read as host
(GPIO_ACTIVE_LOW), the port holds the gpio while it runs and gives it
back at "usb stop". Without the frees, every probe after the first fails
with -EBUSY. An unknown dr_mode and a missing one both give a host port.
The gadget side goes through the same probe: "dfu" and "ums" on usb0,
the latter with the stick behind usb1 as its storage, enumerate on a
Windows host, which reads the first MiB of the stick through usb0 with
the same CRC32 as "usb read" in U-Boot, and "usb start" works after
both; on the host state of the OTG device trees, and with an unknown or
a missing dr_mode, "dfu" fails with -ENODEV instead. v2026.07, whose
ehci-vf driver is the one on main, hangs in "dfu".
The five ARCH_VF610 boards build at every patch, and "ut dm" on sandbox
gives the same result as on main, plus the test of patch 1 on the live
and the flat tree.

Mehmet Fide (9):
  fdtdec: match an alias to its stem only when the number follows it
  usb: ehci-vf: take the controller index from the device tree
  usb: ehci-vf: remove the code path for a build without DM_USB
  usb: ehci-vf: drop the empty bind hook
  usb: ehci-vf: use usb_get_dr_mode()
  usb: ehci-vf: request the ID detect gpio through the device
  usb: ehci-vf: take the register bases from the device tree
  usb: ehci-vf: sort the includes
  usb: ehci-vf: enable the vbus supply of the port

 drivers/usb/host/ehci-vf.c | 322 +++++++++++++++++++------------------
 lib/fdtdec.c               |  43 +++--
 test/dm/fdtdec.c           |  35 ++++
 3 files changed, 229 insertions(+), 171 deletions(-)


base-commit: 903c9578eeb36d72f087082da494c605ddaed3b2
-- 
2.55.0


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-11-23  9:31 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-23 11:15 [PATCH v9 0/9] usb: ehci-vf: make the USB host port usable Mehmet Fide
2026-10-23 11:15 ` [PATCH v9 1/9] fdtdec: match an alias to its stem only when the number follows it Mehmet Fide
2026-11-22 19:53   ` [REGRESSION] " Francesco Dolcini
2026-11-22 20:51     ` [PATCH] usb: ehci-mx6: look up the port number with the usbphy alias Mehmet Fide
2026-11-23  9:31       ` Emanuele Ghidoli
2026-11-22 20:52     ` [REGRESSION] [PATCH v9 1/9] fdtdec: match an alias to its stem only when the number follows it Mehmet Fide
2026-10-23 11:15 ` [PATCH v9 2/9] usb: ehci-vf: take the controller index from the device tree Mehmet Fide
2026-10-23 11:15 ` [PATCH v9 3/9] usb: ehci-vf: remove the code path for a build without DM_USB Mehmet Fide
2026-10-23 11:15 ` [PATCH v9 4/9] usb: ehci-vf: drop the empty bind hook Mehmet Fide
2026-10-23 11:15 ` [PATCH v9 5/9] usb: ehci-vf: use usb_get_dr_mode() Mehmet Fide
2026-10-23 11:15 ` [PATCH v9 6/9] usb: ehci-vf: request the ID detect gpio through the device Mehmet Fide
2026-10-23 11:15 ` [PATCH v9 7/9] usb: ehci-vf: take the register bases from the device tree Mehmet Fide
2026-10-23 14:23   ` Marek Vasut
2026-10-23 14:35     ` Mehmet Fide
2026-10-23 19:34       ` Marek Vasut
2026-10-23 11:15 ` [PATCH v9 8/9] usb: ehci-vf: sort the includes Mehmet Fide
2026-10-23 13:49   ` Marek Vasut
2026-10-23 11:15 ` [PATCH v9 9/9] usb: ehci-vf: enable the vbus supply of the port Mehmet Fide
2026-11-14 15:24 ` [PATCH v9 0/9] usb: ehci-vf: make the USB host port usable Mehmet Fide
2026-11-15 14:21   ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox