From: Chen-Yu Tsai <wenst@chromium.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: "Chen-Yu Tsai" <wenst@chromium.org>,
"Alan Stern" <stern@rowland.harvard.edu>,
linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
"Matthias Kaehlcke" <mka@chromium.org>,
"Stephen Boyd" <swboyd@chromium.org>,
"Rafał Miłecki" <rafal@milecki.pl>,
"Johan Hovold" <johan@kernel.org>,
"Mathias Nyman" <mathias.nyman@linux.intel.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Bjorn Andersson" <andersson@kernel.org>
Subject: [PATCH 0/4] usb: of: Fix root-hub raw port lookups and graph handling
Date: Fri, 4 Dec 2026 10:52:38 +0800 [thread overview]
Message-ID: <20261204025243.807657-1-wenst@chromium.org> (raw)
Hi folks,
This series is targeted at usb-next (v7.5). Note two -next dependencies:
- During auditing for patch 2, a port-numbering mismatch on
qcs6490-rb3gen2.dts was found and applied to qcom's -next branch
(arm64-for-7.5, commit eba979cb2d94, [4]). Since that fix is queued
for v7.5 rather than v7.4 fixes, this series should go through
usb-next rather than usb-linus (and stable backports of patch 2 also
require eba979cb2d94).
- Patch 4's hunk in drivers/usb/core/usb.h relies on context from
commit f7a3812c85c4 ("USB: hub: call ACPI _PRR reset during port
power-cycle on enumeration failure") in usb-next, so it does not
apply cleanly to usb-linus.
On xHCI controllers, HighSpeed and SuperSpeed downstream ports are split
across two logical root hubs (primary and secondary HCDs) that share a
single device tree node. As a result, a root hub's logical 1-based port
index does not always match the controller's raw port number used by
device tree child nodes (reg = <N>) and 1-based OF graph ports (port@N).
These issues came up while working on M.2 E-key USB power sequencing
support [1] and downstream port OF graph bindings for USB host
controllers and dwc3 [2]:
- Patch 1 ignores OF graphs with port@0 or an unnumbered "port" node in
usb_of_get_connect_type(), avoiding false USB_PORT_NOT_USED markings
on legacy dual-role and 0-based snps,dwc3 device trees (as discussed
with Neil Armstrong [3]).
- Patch 2 adds usb_of_find_raw_port() and uses it in both
usb_of_get_device_node() and usb_of_get_connect_type() so all root
hub OF lookups use raw port numbers.
- Patch 3 stops skipping secondary root hubs in
onboard_dev_create_pdevs(), allowing standalone USB 3.x onboard
devices without a peer-hub to be created while keeping dual-speed
hubs deduplicated on the primary HCD.
- Patch 4 checks that a newly enumerated USB device's VID/PID matches
its device tree node's compatible string and warns on mismatch
(which will intentionally flag a few pre-existing mismatched device
trees, such as verdin-dahlia, mt8390-grinn-genio-sbc, helios64, and
meson-libretech-cottonwood).
Patch 1, patch 3, and the OF graph raw-port lookup in patch 2 were
flagged during reviews by an AI coding agent (Antigravity). Patches 1
and 3, as well as this cover letter, were drafted by the agent and
reviewed by me; patches 2 and 4 were written by me.
The series was compile-tested with W=1 across arm64 (USB=y/m,
USB_ONBOARD_DEV=y/m/n, USB_LEDS_TRIGGER_USBPORT=y/m/n) and i386
(OF=y/n, USB=y/m, per-commit), and runtime-tested on an MT8195 Cherry
Dojo Chromebook (with pending driver and device tree patches from [1]
and pending USB hub / Type-A connector device tree patches):
- On xhci0 (SS raw port 1, HS raw port 2), onboard-usb-dev created a
single platform device on usb-hub@2 (parent usb1, usb5e3,610) with
both 1-1 and 2-1 bound and no duplicate on usb2.
- 1-1 and 2-1 matched usb-hub@2 and usb-hub@1 with no compatible
mismatch warnings and connect_type=hardwired (removable=fixed).
- External hub ports (port@3) and xhci3's M.2 port (port@1) reported
connect_type=hotplug (removable=removable) with expected port
of_nodes; unpopulated hub ports reported "not used" and xhci2
reported "unknown".
- The port0 != NULL ignore path in patch 1 and the standalone USB 3.x
onboard device (without peer-hub) path in patch 3 remain
compile-tested only.
Thanks
ChenYu
[1] https://lore.kernel.org/all/20260916075745.3549953-1-wenst@chromium.org/
[2] https://lore.kernel.org/all/20261014082037.1774672-1-wenst@chromium.org/
[3] https://lore.kernel.org/all/03375a31-0ac6-47a4-b0dc-6327080e1622@linaro.org/
[4] https://lore.kernel.org/all/20261130113021.611298-1-wenst@chromium.org/
Chen-Yu Tsai (4):
usb: of: Ignore 0-based or unnumbered OF graphs in
usb_of_get_connect_type()
usb: of: Use raw port numbers for root hub OF lookups
usb: misc: onboard_usb_dev: Create pdevs for secondary root hubs
usb: of: Check compatible string of device node
drivers/usb/core/hub.c | 3 +
drivers/usb/core/of.c | 123 +++++++++++++++++++----
drivers/usb/core/usb.c | 8 +-
drivers/usb/core/usb.h | 8 ++
drivers/usb/misc/onboard_usb_dev_pdevs.c | 26 ++---
5 files changed, 124 insertions(+), 44 deletions(-)
--
2.56.1.915.g69d5ec7298-goog
next reply other threads:[~2026-12-04 2:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 2:52 Chen-Yu Tsai [this message]
2026-12-04 2:52 ` [PATCH 1/4] usb: of: Ignore 0-based or unnumbered OF graphs in usb_of_get_connect_type() Chen-Yu Tsai
2026-12-04 2:52 ` [PATCH 2/4] usb: of: Use raw port numbers for root hub OF lookups Chen-Yu Tsai
2026-12-04 3:10 ` sashiko-bot
2026-12-04 2:52 ` [PATCH 3/4] usb: misc: onboard_usb_dev: Create pdevs for secondary root hubs Chen-Yu Tsai
2026-12-04 2:52 ` [PATCH 4/4] usb: of: Check compatible string of device node Chen-Yu Tsai
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=20261204025243.807657-1-wenst@chromium.org \
--to=wenst@chromium.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=mka@chromium.org \
--cc=neil.armstrong@linaro.org \
--cc=rafal@milecki.pl \
--cc=robh@kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=swboyd@chromium.org \
/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