arm64: dts: mediatek: mt8390-genio-common: USB fixes
Subsystems (2)
v2 cover arm64: dts: mediatek: mt8390-genio-common: USB fixes
Hi,
This is v2 of the Genio 510 / 700 EVK USB fixes that came out of the MTK XHCI binding fix [1].
Changes since v1:
- Patch 1 now also switches the type C port to a source-only port, and limits the source PDO to 5V 1A, matching the hardware (Sashiko)
- Patch 1 now connects the SuperSpeed and HighSpeed lines to the
correct USB hubs
- New patch 3 fixing swapped USB hub labels
- Link to v1: https://lore.kernel.org/all/[email protected]/
Patch 1 corrects the USB type C port: the controller operates in host mode only, the data lines go through the onboard USB hub, and the port can only source power (5V 1A). The block diagrams for both the Genio 700 EVK and Genio 510 EVK were used as reference.
Patch 1 depends on "dt-bindings: usb: ti,usb8041: Fold in TI USB8020B" [2] to allow graph ports under the TI USB8020B hub nodes. Without it, dtbs_check will complain about the new "ports" nodes.
Patch 2 moves the pin mux for the USB hub supply enable pin to the regulator.
Patch 3 fixes the swapped labels for the USB 2.0 and USB 3.0 hub nodes.
I don't have the actual board to test this on. The changes were only compile tested.
This v2 patch series was partially put together using LLM. v1 was done by hand. Sashiko review comments were fed to the LLM, as well as the datasheet for TI USB8020B. I manually checked the PIDs in the datasheet before giving the datasheet to the LLM. Same goes for the board block diagrams. The changelogs in each patch and in the cover letter were also put together using LLM.
Also, the LLM seems to do a decent job at mimicking my writing style, even though it's a bit more verbose than what I'd go for.
ChenYu
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Chen-Yu Tsai (3):
arm64: dts: mediatek: mt8390-genio-common: Fix type C port mode and
connection
arm64: dts: mediatek: mt8390-genio-common: Split out USB hub enable
pin mux
arm64: dts: mediatek: mt8390-genio-common: Fix swapped USB hub labels
.../dts/mediatek/mt8390-genio-common.dtsi | 76 +++++++++++-------- 1 file changed, 43 insertions(+), 33 deletions(-)
Signature · 1 line
2.56.0.455.g6c5a503b38-goog
PATCH v2 1/3 arm64: dts: mediatek: mt8390-genio-common: Fix type C port mode and connection
The USB controller complex ssusb1 and xhci1 operate in host mode only, as it is immediately connected to a USB hub. The user manual has a block diagram showing this, and a USB usage table showing port 1 as "host only".
The block diagrams for both the Genio 700 EVK and the Genio 510 EVK show that the type C port's USB 2.0 data lines are connected to the USB hub's second downstream port directly, while its USB 3.x data lines go through the USB 3.1 / DP mux to the same hub port. The type C port's VBUS is supplied by a 5V 1A boost converter and current limiter. The port cannot sink power; the charger input is on a separate type C connector.
Change the controller's operating mode to "host", and drop the USB role switch property. Fix the USB type C port data line connections to go through the USB hub. The TI TUSB8020B's USB 3.0 hub uses PID 0x8025, and the USB 2.0 hub uses PID 0x8027, so the SuperSpeed lines connect to the former and the HighSpeed lines to the latter.
Change the type C port to a source-only, host-only port. Drop the sink related properties, and limit the source PDO to 5V 1A, matching the hardware. Also drop the dual role and data swap flags from the source PDO, since the port supports neither.
---
Changes since v1:
- Switched type C port to source-only, and dropped sink related properties (Sashiko)
- Limited source PDO to 5V 1A, matching the hardware, and dropped dual role and data swap flags
- Fixed swapped SuperSpeed / HighSpeed connections to the USB hubs
- Expanded commit message with details from the Genio 700 / 510 EVK block diagrams
Compile tested only.
The v2 changes were done with the help of an LLM coding assistant:
the source-only connector and PDO changes, the swapped hub endpoint fix, most of the expanded commit message, and these notes. The input was Sashiko's review, the TI USB8020B datasheet and the Genio 510 / 700 EVK block diagrams. The PIDs in the datasheet and the block diagrams were checked by hand.
This patch depends on "dt-bindings: usb: ti,usb8041: Fold in TI USB8020B" [1] to allow graph ports under the TI USB8020B hub nodes.
The downstream port number of the USB hub is based on the order shown in the block diagram. I don't have a board or the schematics to confirm this.
The hub_2_0 and hub_3_0 labels are swapped relative to the actual hubs (usb451,8025 is the USB 3.0 hub). This is fixed in a separate patch.
[1] https://lore.kernel.org/all/[email protected]/
--- .../dts/mediatek/mt8390-genio-common.dtsi | 54 ++++++++++--------- 1 file changed, 30 insertions(+), 24 deletions(-)
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +30 -24
@@ -512,18 +512,11 @@ rt1715@4e { connector { compatible = "usb-c-connector"; label = "USB-C"; - data-role = "dual"; - op-sink-microwatt = <10000000>; - power-role = "dual"; - try-power-role = "sink"; + data-role = "host"; + power-role = "source"; pd-revision = /bits/ 8 <0x03 0x00 0x01 0x08>; - sink-pdos = <PDO_FIXED(5000, 2000, - PDO_FIXED_DUAL_ROLE | - PDO_FIXED_DATA_SWAP)>; - source-pdos = <PDO_FIXED(5000, 2000, - PDO_FIXED_DUAL_ROLE | - PDO_FIXED_DATA_SWAP)>; + source-pdos = <PDO_FIXED(5000, 1000, 0)>; altmodes { displayport {
@@ -539,14 +532,14 @@ ports { port@0 { reg = <0>; typec_con_hs: endpoint { - remote-endpoint = <&mtu3_hs1_role_sw>; + remote-endpoint = <&usb_2_0_p2>; }; }; port@1 { reg = <1>; typec_con_ss: endpoint { - remote-endpoint = <&xhci_ss_ep>; + remote-endpoint = <&usb_3_0_p2>; }; };
@@ -1528,19 +1521,12 @@ &xhci0 { }; &ssusb1 { - dr_mode = "otg"; - usb-role-switch; + dr_mode = "host"; wakeup-source; vusb33-supply = <&mt6359_vusb_ldo_reg>; pinctrl-0 = <&usb1_default_pins>; pinctrl-names = "default"; status = "okay"; - - port { - mtu3_hs1_role_sw: endpoint { - remote-endpoint = <&typec_con_hs>; - }; - }; }; &xhci1 {
@@ -1555,6 +1541,19 @@ hub_2_0: hub@1 { peer-hub = <&hub_3_0>; reset-gpios = <&pio 7 GPIO_ACTIVE_HIGH>; vdd-supply = <&usb_hub_fixed_3v3>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@2 { + reg = <2>; + + usb_3_0_p2: endpoint { + remote-endpoint = <&typec_con_ss>; + }; + }; + }; }; hub_3_0: hub@2 {
@@ -1563,11 +1562,18 @@ hub_3_0: hub@2 { peer-hub = <&hub_2_0>; reset-gpios = <&pio 7 GPIO_ACTIVE_HIGH>; vdd-supply = <&usb_hub_fixed_3v3>; - }; - port { - xhci_ss_ep: endpoint { - remote-endpoint = <&typec_con_ss>; + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@2 { + reg = <2>; + + usb_2_0_p2: endpoint { + remote-endpoint = <&typec_con_hs>; + }; + }; }; }; };
Signature · 1 line
2.56.0.455.g6c5a503b38-goog
[email protected]
AI reviewRe: [PATCH v2 1/3] arm64: dts: mediatek: mt8390-genio-common: Fix type C port mode and connection
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] arm64: dts: mediatek: missing PDO_FIXED_USB_COMM in mt8390 source-pdos - [Low] arm64: dts: mediatek…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Low] arm64: dts: mediatek: missing PDO_FIXED_USB_COMM in mt8390 source-pdos
- [Low] arm64: dts: mediatek: mt8390-genio: hub ports nodes violate ti,usb8020b schema
--
commit b958daa221ebf8e15b905e203df3fc6aa4fbfaae
Author: Chen-Yu Tsai <[email protected]>
arm64: dts: mediatek: mt8390-genio-common: Fix type C port mode and connection
This commit updates the USB controller and Type-C connector on MT8390 Genio boards to host-only and source-only mode, routing the connector's High-Speed and SuperSpeed endpoints through the onboard TI TUSB8020B hub.
Quoted 13 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +1
-4@@ -512,18 +512,11 @@ rt1715@4e { connector { compatible = "usb-c-connector"; label = "USB-C"; - data-role = "dual"; - op-sink-microwatt = <10000000>; - power-role = "dual"; - try-power-role = "sink"; + data-role = "host";
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi rt1715@4e { · line 519
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +2
-6+ power-role = "source"; pd-revision = /bits/ 8 <0x03 0x00 0x01 0x08>; - sink-pdos = <PDO_FIXED(5000, 2000, - PDO_FIXED_DUAL_ROLE | - PDO_FIXED_DATA_SWAP)>; - source-pdos = <PDO_FIXED(5000, 2000, - PDO_FIXED_DUAL_ROLE | - PDO_FIXED_DATA_SWAP)>; + source-pdos = <PDO_FIXED(5000, 1000, 0)>;
[Severity: Low]
Should source-pdos pass PDO_FIXED_USB_COMM instead of 0? This connector routes High-Speed and SuperSpeed data lines to the onboard USB hub, so passing 0 causes tcpm_pd_send_source_caps() and usb_communication_capable_show() to advertise the port as incapable of USB data communication.
[ ... ]
Quoted 33 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +17
-4@@ -1555,6 +1541,19 @@ hub_2_0: hub@1 { peer-hub = <&hub_3_0>; reset-gpios = <&pio 7 GPIO_ACTIVE_HIGH>; vdd-supply = <&usb_hub_fixed_3v3>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@2 { + reg = <2>; + + usb_3_0_p2: endpoint { + remote-endpoint = <&typec_con_ss>; + }; + }; + }; }; hub_3_0: hub@2 {@@ -1563,11 +1562,18 @@ hub_3_0: hub@2 { peer-hub = <&hub_2_0>; reset-gpios = <&pio 7 GPIO_ACTIVE_HIGH>; vdd-supply = <&usb_hub_fixed_3v3>; - }; - port { - xhci_ss_ep: endpoint { - remote-endpoint = <&typec_con_ss>; + ports { + #address-cells = <1>; + #size-cells = <0>; +
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi hub_3_0: hub@2 { · line 1579
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +7
-0+ port@2 { + reg = <2>; + + usb_2_0_p2: endpoint { + remote-endpoint = <&typec_con_hs>; + }; + }; }; }; };
[Severity: Low]
Do the new ports child nodes under hub@1 (usb451,8025) and hub@2 (usb451,8027) cause dtbs_check to fail against Documentation/devicetree/bindings/usb/ti,usb8020b.yaml? That schema only references usb-device.yaml# with additionalProperties: false, and the prerequisite commit "dt-bindings: usb: ti,usb8041: Fold in TI USB8020B" noted in the patch commentary is not present in the tree yet.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 2/3 arm64: dts: mediatek: mt8390-genio-common: Split out USB hub enable pin mux
In reply to Chen-Yu Tsai"pins-usb-hub-3v3-en" listed in "usb1-default-pins" is actually the enable pin for the USB hub's supply regulator.
Split it out as a separate pinmux node attached to the regulator instead.
---
Compile tested only.
--- .../boot/dts/mediatek/mt8390-genio-common.dtsi | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +9 -5
@@ -216,6 +216,8 @@ touch0_fixed_3v3: regulator-5 { usb_hub_fixed_3v3: regulator-6 { compatible = "regulator-fixed"; + pinctrl-names = "default"; + pinctrl-0 = <&usb_hub_3v3_pins>; regulator-name = "vhub_3v3"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>;
@@ -1249,16 +1251,18 @@ pins-vbus { }; + usb_hub_3v3_pins: usb-hub-3v3-pins { + pins-usb-hub-3v3-en { + pinmux = <PINMUX_GPIO112__FUNC_B_GPIO112>; + output-high; + }; + }; + usb1_default_pins: usb1-default-pins { pins-valid { pinmux = <PINMUX_GPIO88__FUNC_I0_VBUSVALID_1P>; input-enable; }; - - pins-usb-hub-3v3-en { - pinmux = <PINMUX_GPIO112__FUNC_B_GPIO112>; - output-high; - }; }; usb2_default_pins: usb2-default-pins {
Signature · 1 line
2.56.0.455.g6c5a503b38-goog
PATCH v2 3/3 arm64: dts: mediatek: mt8390-genio-common: Fix swapped USB hub labels
In reply to Chen-Yu TsaiThe TI TUSB8020B USB 3.0 hub on the Genio 510 / 700 EVKs presents itself as two USB hubs, a USB 3.0 hub with the default PID 0x8025 and a USB 2.0 hub with PID 0x8027 (the USB 3.0 PID XOR 0x2), as described in the datasheet.
The hub nodes have the correct compatible strings, and are attached to the correct XHCI ports (port 1 being SuperSpeed and port 2 being HighSpeed), but the labels are swapped: the USB 3.0 hub (usb451,8025) is labeled "hub_2_0", and the USB 2.0 hub (usb451,8027) is labeled "hub_3_0".
Swap the labels so they match the hubs they are attached to. This change has no functional impact.
---
Changes since v1:
- New patch
Compile tested only.
This patch, including the commit message, was written by an LLM coding assistant at my request, based on the PID scheme described in the TI USB8020B datasheet. The PIDs in the datasheet were checked by hand.
--- arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +4 -4
@@ -1539,10 +1539,10 @@ &xhci1 { #address-cells = <1>; #size-cells = <0>; - hub_2_0: hub@1 { + hub_3_0: hub@1 { compatible = "usb451,8025"; reg = <1>; - peer-hub = <&hub_3_0>; + peer-hub = <&hub_2_0>; reset-gpios = <&pio 7 GPIO_ACTIVE_HIGH>; vdd-supply = <&usb_hub_fixed_3v3>;
@@ -1560,10 +1560,10 @@ usb_3_0_p2: endpoint { }; }; - hub_3_0: hub@2 { + hub_2_0: hub@2 { compatible = "usb451,8027"; reg = <2>; - peer-hub = <&hub_2_0>; + peer-hub = <&hub_3_0>; reset-gpios = <&pio 7 GPIO_ACTIVE_HIGH>; vdd-supply = <&usb_hub_fixed_3v3>;
Signature · 1 line
2.56.0.455.g6c5a503b38-goog
Quoted 11 lines · Chen-Yu Tsai
This is v2 of the Genio 510 / 700 EVK USB fixes that came out of the MTK XHCI binding fix [1].
Changes since v1:
- Patch 1 now also switches the type C port to a source-only port, and limits the source PDO to 5V 1A, matching the hardware (Sashiko)
- Patch 1 now connects the SuperSpeed and HighSpeed lines to the
correct USB hubs
- New patch 3 fixing swapped USB hub labels
- Link to v1: https://lore.kernel.org/all/[email protected]/
Quoted 1 line
[...]
Applied to v7.4-next/dts64, thanks!
[1/3] arm64: dts: mediatek: mt8390-genio-common: Fix type C port mode and connection
commit: 1e821a4fb9e852d027a3167facce169f124f4dda
[2/3] arm64: dts: mediatek: mt8390-genio-common: Split out USB hub enable pin mux
commit: 7c5f621c2bae8b84f24460e83e73e46cfd9e315a
[3/3] arm64: dts: mediatek: mt8390-genio-common: Fix swapped USB hub labels
commit: 272559211b361a38789223a0ac75875b37f55d7aCheers,
Angelo