From: Mehmet Fide <[email protected]>

"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,
  add ofnode_get_alias_seq(), take dr_mode through usb_get_dr_mode()
  and the PHY, usbmisc and anatop bases from the device tree instead
  of the tables
- patch 8 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 usbphy alias of the PHY node.

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

v5 of this series:
https://lore.kernel.org/u-boot/[email protected]/
v4 of this series:
https://lore.kernel.org/u-boot/[email protected]/
v2 of the register base series:
https://lore.kernel.org/u-boot/[email protected]/
v3 of the vbus series:
https://lore.kernel.org/u-boot/[email protected]/
the data abort fix on its own:
https://lore.kernel.org/u-boot/[email protected]/

Tested on a Colibri VF50 V1.2A and a Colibri VF61 V1.2B on the Iris
carrier, colibri_vf_defconfig on main (0a55b098d6f): "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" on both boards. The five
ARCH_VF610 boards build at every patch, and "ut dm" on sandbox gives
the same result as on main, plus the three tests of patches 1 and 5 on
the live and the flat tree.

Mehmet Fide (8):
  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
  dm: core: add ofnode_get_alias_seq()
  usb: ehci-vf: use usb_get_dr_mode()
  usb: ehci-vf: take the register bases from the device tree
  usb: ehci-vf: enable the vbus supply of the port

 arch/sandbox/dts/other.dts |   5 +
 drivers/core/of_access.c   |  42 ++++++
 drivers/core/ofnode.c      |  20 +++
 drivers/core/read.c        |  20 +--
 drivers/usb/host/ehci-vf.c | 261 ++++++++++++++++---------------------
 include/dm/of_access.h     |   7 +-
 include/dm/ofnode.h        |  16 +++
 include/dm/read.h          |   8 +-
 lib/fdtdec.c               |  43 ++++--
 test/dm/fdtdec.c           |  35 +++++
 test/dm/ofnode.c           |  49 +++++++
 11 files changed, 315 insertions(+), 191 deletions(-)


base-commit: 0a55b098d6f5f6bafa84fc2f18b433dd167bf729
-- 
2.55.0

Reply via email to