[PATCH v2 0/2] usb: Set connect_type of hub ports based on DT

From: Stephen Boyd
Date: Thu Feb 22 2024 - 19:58:42 EST


This is split off of a larger series[1] that describes the USB and DP
topology of ARM chromebooks such as Trogdor (sc7180-trogdor.dtsi). These
patches can land at any time, so I'm sending them split out to hopefully
focus review and land them earlier.

The first patch updates the realtek binding to describe the downstream
facing ports (it has 4 ports). Child devices can also be hard-wired to
the hub, in which case the binding allows those devices to only have reg
properties with the valid port numbers (1 through 4).

The second patch sets the connect_type member of the usb port to reflect
what the DT binding indicates. More details are in the patch, but the
general goal is to set the connect_type based on DT so that it can be
queried by userspace in sysfs. ChromeOS wants to know if a usb device is
hard-wired or not so it can apply more or less security to the device.

Changes from v1 (https://lore.kernel.org/r/20240210070934.2549994-4-swboyd@xxxxxxxxxxxx):
* Moved the code to of.c to keep it tidy
* Updated the check for child nodes to only be for usb devices or graph
binding in case of things like HSIC where a child node 'ulpi' could
exist
* Fixed the binding to have #size-cells and #address-cells

Stephen Boyd (2):
dt-bindings: usb: Add downstream facing ports to realtek binding
usb: core: Set connect_type of ports based on DT node

.../bindings/usb/realtek,rts5411.yaml | 55 ++++++++++++++
drivers/usb/core/of.c | 71 +++++++++++++++++++
drivers/usb/core/port.c | 2 +
include/linux/usb/of.h | 7 ++
4 files changed, 135 insertions(+)

Cc: Conor Dooley <conor+dt@xxxxxxxxxx>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@xxxxxxxxxx>
Cc: <linux-usb@xxxxxxxxxxxxxxx>
Cc: maciek swiech <drmasquatch@xxxxxxxxxx>
Cc: Matthias Kaehlcke <mka@xxxxxxxxxxxx>

[1] https://lore.kernel.org/r/20240210070934.2549994-1-swboyd@xxxxxxxxxxxx

base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
--
https://chromeos.dev