arm64: dts: mediatek: mt8390-genio-common: USB fixes
Subsystems (2)
cover arm64: dts: mediatek: mt8390-genio-common: USB fixes
Hi,
Here are a couple fixes that came out of the MTK XHCI binding fix [1].
Patch 1 corrects the USB type C operating mode (host mode only) and graph connections.
Patch 2 moves the pin mux for the USB hub supply enable pin to the regulator.
I don't have the actual board to test this on. The changes were only compile tested.
ChenYu
[1] https://lore.kernel.org/all/[email protected]/
Chen-Yu Tsai (2):
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
.../dts/mediatek/mt8390-genio-common.dtsi | 57 ++++++++++++------- 1 file changed, 37 insertions(+), 20 deletions(-)
Signature · 1 line
2.56.0.385.gac671c819a-goog
PATCH 1/2 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".
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, as shown in the block diagram. Change the data-role on the type C port to "host".
---
Compile tested only.
Unfortunately I don't have a board or the schematics to check which of the USB hub downstream ports the type C port is connected to.
Also, the order of the USB hubs might be reversed. In my previous experience, port 1 on the XHCI is SuperSpeed, and port 2 is HighSpeed.
--- .../dts/mediatek/mt8390-genio-common.dtsi | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-)
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +28 -15
@@ -512,7 +512,7 @@ rt1715@4e { connector { compatible = "usb-c-connector"; label = "USB-C"; - data-role = "dual"; + data-role = "host"; op-sink-microwatt = <10000000>; power-role = "dual"; try-power-role = "sink";
@@ -539,14 +539,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 +1528,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 +1548,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_2_0_p2: endpoint { + remote-endpoint = <&typec_con_hs>; + }; + }; + }; }; hub_3_0: hub@2 {
@@ -1563,11 +1569,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_3_0_p2: endpoint { + remote-endpoint = <&typec_con_ss>; + }; + }; }; }; };
Signature · 1 line
2.56.0.385.gac671c819a-goog
PATCH 2/2 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>;
@@ -1256,16 +1258,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.385.gac671c819a-goog
[email protected]
AI reviewRe: [PATCH 1/2] arm64: dts: mediatek: mt8390-genio-common: Fix type C port mode and connection
In reply to Chen-Yu TsaiThank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [Medium] arm64: dts: mediatek: mt8390-genio: swapped HS and SS USB-C hub endpoints - [Medium] arm64: dts…
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Medium] arm64: dts: mediatek: mt8390-genio: swapped HS and SS USB-C hub endpoints
- [Medium] arm64: dts: mediatek: mt8390-genio: host data-role breaks TCPM sink and PDOs
- [Medium] arm64: dts: mediatek: mt8390-genio: partial hub ports graph marks port 1 unused
- [Low] arm64: dts: mediatek: mt8390-genio: hub ports nodes violate ti,usb8020b schema --
commit ef02f781783f3c2d23b3aa255937ed902c67f777
Author: Chen-Yu Tsai <[email protected]>
arm64: dts: mediatek: mt8390-genio-common: Fix type C port mode and connection
This commit changes the ssusb1 controller's operating mode to "host", drops its usb-role-switch property, updates the Type-C connector's data-role to "host", and routes the Type-C port data endpoints through the onboard USB hub nodes under xhci1.
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi rt1715@4e { · line 518
Quoted 13 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +1
-1@@ -512,7 +512,7 @@ rt1715@4e { connector { compatible = "usb-c-connector"; label = "USB-C"; - data-role = "dual"; + data-role = "host"; op-sink-microwatt = <10000000>; power-role = "dual"; try-power-role = "sink";
[Severity: Medium]
When data-role is changed to "host" (setting port->typec_caps.data to TYPEC_PORT_DFP) while power-role = "dual", try-power-role = "sink", and PDO_FIXED_DATA_SWAP in sink-pdos and source-pdos remain set, won't this cause a data role mismatch and PD capability inconsistency when attaching to a USB PD power source?
When the port attaches as a Sink in tcpm_snk_attach(), it initializes the roles using tcpm_data_role_for_sink():
drivers/usb/typec/tcpm/tcpm.c:
#define tcpm_data_role_for_sink(port) \ ((port)->typec_caps.data == TYPEC_PORT_DFP ? \ TYPEC_HOST : TYPEC_DEVICE)
Because port->typec_caps.data is TYPEC_PORT_DFP, tcpm_snk_attach() -> tcpm_set_roles() sets port->data_role = TYPEC_HOST and programs the TCPC message header data role to DFP while attached as a Sink. When the remote PD Source (which also starts as DFP/host per the USB PD specification) sends its initial Source_Capabilities message with PD_HEADER_DATA_ROLE = 1, tcpm_pd_rx_handler() sees both sides as DFP:
drivers/usb/typec/tcpm/tcpm.c:tcpm_pd_rx_handler() {
...
if (!!(le16_to_cpu(msg->header) & PD_HEADER_DATA_ROLE) ==
(port->data_role == TYPEC_HOST) && rx_sop_type == TCPC_TX_SOP) {
tcpm_log(port,
"Data role mismatch, initiating error recovery");
tcpm_set_state(port, ERROR_RECOVERY, 0);
...
}In addition, sink-pdos and source-pdos in this connector node still include PDO_FIXED_DATA_SWAP, which advertises DR_Swap support to the partner via tcpm_pd_send_sink_caps() / tcpm_pd_send_source_caps() and exposes dual_role_data = 1 in sysfs, even though tcpm_pd_ctrl_request() rejects incoming PD_CTRL_DR_SWAP requests when port->typec_caps.data != TYPEC_PORT_DRD.
[ ... ]
Quoted 33 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +17
-4@@ -1555,6 +1548,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_2_0_p2: endpoint { + remote-endpoint = <&typec_con_hs>; + }; + }; + }; }; hub_3_0: hub@2 {@@ -1563,11 +1569,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 1586
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +7
-0+ port@2 { + reg = <2>; + + usb_3_0_p2: endpoint { + remote-endpoint = <&typec_con_ss>; + }; + }; }; }; };
[Severity: Medium]
Are the High-Speed and SuperSpeed endpoints connected to the wrong hubs here?
In drivers/usb/misc/onboard_usb_dev.c (onboard_dev_id_table) and Documentation/devicetree/bindings/usb/ti,usb8020b.yaml, TI USB8020B product ID 0x8025 (compatible "usb451,8025") is the USB 3.0 SuperSpeed hub and product ID 0x8027 (compatible "usb451,8027") is the USB 2.0 High-Speed hub:
drivers/usb/misc/onboard_usb_dev.c:
{ USB_DEVICE(VENDOR_ID_TI, 0x8025) }, /* TI USB8020B 3.0 HUB */
{ USB_DEVICE(VENDOR_ID_TI, 0x8027) }, /* TI USB8020B 2.0 HUB */In mt8390-genio-common.dtsi, hub@1 has compatible = "usb451,8025" (the 3.0 hub) and hub@2 has compatible = "usb451,8027" (the 2.0 hub), even though their pre-existing DT labels hub_2_0 and hub_3_0 are reversed. Placing usb_2_0_p2 (linked to typec_con_hs, port@0) under hub@1 and usb_3_0_p2 (linked to typec_con_ss, port@1) under hub@2 connects the High-Speed Type-C endpoint to the SuperSpeed hub and the SuperSpeed Type-C endpoint to the High-Speed hub.
[Severity: Medium]
Does adding a ports node containing only port@2 to hub@1 and hub@2 cause downstream port 1 of the TI USB8020B hub to be marked as USB_PORT_NOT_USED and non-removable?
When a USB hub is enumerated, usb_hub_create_port_device() calls usb_of_get_connect_type() for each downstream port:
drivers/usb/core/of.c:usb_of_get_connect_type() {
...
/* Only set connect_type if binding has ports/hardwired devices. */
if (!usb_of_has_devices_or_graph(hub))
return USB_PORT_CONNECT_TYPE_UNKNOWN;
/* Assume port is unused if there's a graph or a child node. */
connect_type = USB_PORT_NOT_USED;
...
}Previously, hub@1 and hub@2 had no child nodes or OF graph, so all downstream ports defaulted to USB_PORT_CONNECT_TYPE_UNKNOWN. Once ports is added with only port@2 defined, usb_of_has_devices_or_graph(hub) returns true and downstream port 1 (which has neither a port@1 graph node nor a child device node) returns USB_PORT_NOT_USED, causing set_usb_port_removable() in drivers/usb/core/hub.c to mark any device plugged into downstream port 1 as DEVICE_FIXED.
[Severity: Low]
Also, does adding ports child nodes to hub@1 ("usb451,8025") and hub@2 ("usb451,8027") fail dtbs_check against Documentation/devicetree/bindings/usb/ti,usb8020b.yaml?
Unlike ti,usb8041.yaml (which references usb-hub.yaml# and uses
unevaluatedProperties: false), ti,usb8020b.yaml only references usb-device.yaml# and sets additionalProperties: false without defining a ports property.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH 1/2] arm64: dts: mediatek: mt8390-genio-common: Fix type C port mode and connection
Quoted 30 lines · On Tue, Nov 3, 2026 at 4:54 PM <[email protected]> wrote:
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Medium] arm64: dts: mediatek: mt8390-genio: swapped HS and SS USB-C hub endpoints
- [Medium] arm64: dts: mediatek: mt8390-genio: host data-role breaks TCPM sink and PDOs
- [Medium] arm64: dts: mediatek: mt8390-genio: partial hub ports graph marks port 1 unused
- [Low] arm64: dts: mediatek: mt8390-genio: hub ports nodes violate ti,usb8020b schema --commit
ef02f781783f3c2d23b3aa255937ed902c67f777
Author: Chen-Yu Tsai <[email protected]>arm64: dts: mediatek: mt8390-genio-common: Fix type C port mode and connection
This commit changes the ssusb1 controller's operating mode to "host", drops its usb-role-switch property, updates the Type-C connector's data-role to "host", and routes the Type-C port data endpoints through the onboard USB hub nodes under xhci1.
Quoted 12 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +1
-1@@ -512,7 +512,7 @@ rt1715@4e { connector { compatible = "usb-c-connector"; label = "USB-C"; - data-role = "dual"; + data-role = "host"; op-sink-microwatt = <10000000>; power-role = "dual";
Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi rt1715@4e { · line 518
Quoted 1 line
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +0
-0try-power-role = "sink";[Severity: Medium]
When data-role is changed to "host" (settingport->typec_caps.datatoTYPEC_PORT_DFP) while power-role = "dual", try-power-role = "sink", andPDO_FIXED_DATA_SWAPin sink-pdos and source-pdos remain set, won't this cause a data role mismatch and PD capability inconsistency when attaching to a USB PD power source?
Rechecked the public documents [1], and it only shows this port supplying power at 5V/1A. This port is marked as "USB 3.1 PD" on the board, and as "USB-C 3.1 Host & DisplayPort". The sink / charging type C port is a different port altogether, marked as "USB-C (charger)".
So the PD description for this port is completely wrong.
[1] https://genio.mediatek.com/doc/iot-yocto/latest/hw/g700-evk.html
Quoted 90 lines
When the port attaches as a Sink in
tcpm_snk_attach(), it initializes the roles usingtcpm_data_role_for_sink():
drivers/usb/typec/tcpm/tcpm.c:
#definetcpm_data_role_for_sink(port)\
((port)->typec_caps.data ==TYPEC_PORT_DFP? \
TYPEC_HOST:TYPEC_DEVICE)Because
port->typec_caps.dataisTYPEC_PORT_DFP,tcpm_snk_attach()->tcpm_set_roles()setsport->data_role=TYPEC_HOSTand programs the TCPC message header data role to DFP while attached as a Sink. When the remote PD Source (which also starts as DFP/host per the USB PD specification) sends its initialSource_Capabilitiesmessage withPD_HEADER_DATA_ROLE= 1,tcpm_pd_rx_handler()sees both sides as DFP:drivers/usb/typec/tcpm/tcpm.c:tcpm_pd_rx_handler() { ... if (!!(le16_to_cpu(msg->header) & PD_HEADER_DATA_ROLE) == (port->data_role == TYPEC_HOST) && rx_sop_type == TCPC_TX_SOP) { tcpm_log(port, "Data role mismatch, initiating error recovery"); tcpm_set_state(port, ERROR_RECOVERY, 0); ... }In addition, sink-pdos and source-pdos in this connector node still include
PDO_FIXED_DATA_SWAP, which advertisesDR_Swapsupport to the partner viatcpm_pd_send_sink_caps()/tcpm_pd_send_source_caps()and exposesdual_role_data= 1 in sysfs, even thoughtcpm_pd_ctrl_request()rejects incomingPD_CTRL_DR_SWAPrequests whenport->typec_caps.data!=TYPEC_PORT_DRD.[ ... ]
Quoted 33 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +17
-4@@ -1555,6 +1548,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_2_0_p2: endpoint { + remote-endpoint = <&typec_con_hs>; + }; + }; + }; }; hub_3_0: hub@2 {@@ -1563,11 +1569,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 1586
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi +7
-0+ port@2 { + reg = <2>; + + usb_3_0_p2: endpoint { + remote-endpoint = <&typec_con_ss>; + }; + }; }; }; };[Severity: Medium]
Are the High-Speed and SuperSpeed endpoints connected to the wrong hubs here?In
drivers/usb/misc/onboard_usb_dev.c(onboard_dev_id_table) andDocumentation/devicetree/bindings/usb/ti,usb8020b.yaml, TI USB8020B product ID0x8025(compatible "usb451,8025") is the USB 3.0 SuperSpeed hub and product ID0x8027(compatible "usb451,8027") is the USB 2.0 High-Speed hub:
drivers/usb/misc/onboard_usb_dev.c:{ USB_DEVICE(VENDOR_ID_TI, 0x8025) }, /* TI USB8020B 3.0 HUB */ { USB_DEVICE(VENDOR_ID_TI, 0x8027) }, /* TI USB8020B 2.0 HUB */
Quoted 7 lines
In
mt8390-genio-common.dtsi, hub@1 has compatible = "usb451,8025" (the 3.0 hub) and hub@2 has compatible = "usb451,8027" (the 2.0 hub), even though their pre-existing DT labelshub_2_0andhub_3_0are reversed. Placingusb_2_0_p2(linked totypec_con_hs, port@0) under hub@1 andusb_3_0_p2(linked totypec_con_ss, port@1) under hub@2 connects the High-Speed Type-C endpoint to the SuperSpeed hub and the SuperSpeed Type-C endpoint to the High-Speed hub.
Yeah, they are definitely swapped. 0x8025 is the default PID for USB 3.0 while the default PID for USB 2.0 is the 3.0 one XOR 0x2.
Quoted 19 lines
[Severity: Medium]
Does adding a ports node containing only port@2 to hub@1 and hub@2 cause downstream port 1 of the TI USB8020B hub to be marked asUSB_PORT_NOT_USEDand non-removable?When a USB hub is enumerated,
usb_hub_create_port_device()callsusb_of_get_connect_type()for each downstream port:drivers/usb/core/of.c:usb_of_get_connect_type() { ... /* Only set connect_type if binding has ports/hardwired devices. */ if (!usb_of_has_devices_or_graph(hub)) return USB_PORT_CONNECT_TYPE_UNKNOWN; /* Assume port is unused if there's a graph or a child node. */ connect_type = USB_PORT_NOT_USED; ... }
Quoted 7 lines
Previously, hub@1 and hub@2 had no child nodes or OF graph, so all downstream ports defaulted to
USB_PORT_CONNECT_TYPE_UNKNOWN. Once ports is added with only port@2 defined,usb_of_has_devices_or_graph(hub)returns true and downstream port 1 (which has neither a port@1 graph node nor a child device node) returnsUSB_PORT_NOT_USED, causingset_usb_port_removable()indrivers/usb/core/hub.cto mark any device plugged into downstream port 1 asDEVICE_FIXED.
The other port seems to be tied to a M.2 B-key slot on the reverse side of the board. Currently, we still lack proper M.2 slot USB integration, so this is going to be a slight problem.
Quoted 9 lines
[Severity: Low]
Also, does adding ports child nodes to hub@1 ("usb451,8025") and hub@2 ("usb451,8027") faildtbs_checkagainstDocumentation/devicetree/bindings/usb/ti,usb8020b.yaml?Unlike ti,usb8041.yaml (which references usb-hub.yaml# and uses
unevaluatedProperties: false), ti,usb8020b.yaml only references usb-device.yaml# and sets additionalProperties: false without defining a ports property.
I sent a separate patch to address this by merging ti,usb8020b into ti,usb8041.
The AI review is certainly digging up more problems with the DT.
ChenYu