Skip to content

Conversation

@kasimling
Copy link

@kasimling kasimling commented Jan 14, 2026

Description

Enable the USB Type-C port on station-m3

How Has This Been Tested?

  1. Connect a USB device to the type-C port
  2. Check lsusb output
  3. Verify the USB device functionality
  4. Disconnect USB device
  5. Check lsusb output again

Summary by CodeRabbit

  • New Features
    • USB Type-C port enabled with Power Delivery for improved charging and power negotiation.
    • USB On-The-Go (OTG) and dynamic host/device role switching activated.
    • Automatic connector orientation detection and DisplayPort alt-mode support for video over USB-C.
    • Added hardware-level controls for VBUS/5V host enable and SBU signal handling to improve interoperability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

Adds a complete USB Type-C port topology to the RK3588S ROC‑PC device tree: a FUSB302 TCPM node, Type‑C connector and ports, DP PHY with orientation/alt‑mode endpoints, GPIO interrupt and SBU routing, and xHCI role‑switch/OTG wiring. All changes are additive to the DTS.

Changes

Cohort / File(s) Summary
Device tree patches
patch/kernel/archive/rockchip64-6.18/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch, patch/kernel/archive/rockchip64-6.19/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch
Add usbc0: fusb302@22 TCPM node with connector and three ports/endpoints; add usbc0_int, usbc_sbu_dc, and vcc5v0_host_en GPIO/pinctrl nodes; add &usbdp_phy0 DP PHY node with orientation/altmode endpoints; enable and wire &usb_host0_xhci with usb-role-switch/port endpoint.

Sequence Diagram(s)

sequenceDiagram
  participant Cable as "USB-C Cable"
  participant TCPM as "FUSB302 (usbc0)"
  participant PHY as "usbdp_phy0 (DP PHY)"
  participant XHCI as "usb_host0_xhci"
  participant Reg as "vcc5v0_host_en (5V regulator)"
  Cable->>TCPM: Plug-in / CC negotiation
  TCPM->>PHY: orientation / SBU detect
  TCPM->>XHCI: request role switch (usb-role-switch)
  alt Host role granted
    XHCI->>Reg: enable VBUS
    Reg-->>XHCI: VBUS present
  else Device role
    XHCI-->>TCPM: enter device mode
  end
  TCPM->>PHY: signal DP alt‑mode mux
  PHY->>XHCI: route SuperSpeed / DP lanes via endpoints
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • paolosabatino
  • rpardini
  • JohnTheCoolingFan
  • SuperKali
  • ColorfulRhino
  • prahal
  • krachlatte
  • lanefu
  • Tonymac32
  • TheSnowfield

Poem

🐇 Hop, I wired a Type‑C port today,

VBUS wakes and roles can sway.
PHY and TCPM join the dance,
Endpoints paired for every chance.
Hooray — the connector finds its way! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title references 'station-m3' board, but the actual changes apply to 'rk3588s-roc-pc' device tree files for both 6.18 and 6.19 kernel versions. Update the PR title to accurately reflect the target board: 'rockchip64: rk3588s-roc-pc: Enable USB type-C port' or verify that station-m3 and rk3588s-roc-pc are the same board.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added 02 Milestone: First quarter release size/large PR with 250 lines or more Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Jan 14, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In
`@patch/kernel/archive/rockchip64-6.18/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch`:
- Around line 83-96: The DT node &usb_host0_xhci contains a duplicated property
"status = \"okay\""; remove the redundant one so only a single status = "okay"
remains, ensuring dr_mode = "otg", usb-role-switch, and the
port/usb_host0_xhci_drd_sw endpoint (remote-endpoint = <&usbc0_hs>) stay intact;
apply the same fix to the corresponding 6.19 patch that shares this content.

In
`@patch/kernel/archive/rockchip64-6.19/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch`:
- Around line 83-96: The &usb_host0_xhci node contains a duplicated status =
"okay"; property; remove the redundant one so the node only has a single status
property (keep the existing status line and delete the duplicate), ensuring
dr_mode = "otg", usb-role-switch, and the port/endpoint block
(usb_host0_xhci_drd_sw -> remote-endpoint = <&usbc0_hs>;) remain unchanged and
inside the &usb_host0_xhci node.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c0e8ba8 and e6e98f6.

📒 Files selected for processing (2)
  • patch/kernel/archive/rockchip64-6.18/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch
  • patch/kernel/archive/rockchip64-6.19/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: iav
Repo: armbian/build PR: 9158
File: patch/kernel/archive/rockchip64-6.18/add-board-helios64.patch:598-600
Timestamp: 2026-01-03T07:27:45.955Z
Learning: In Rockchip vendor kernel branches (e.g., rockchip64-6.18), the FUSB302 device tree binding accepts usb-role-switch as a phandle reference to a USB role switch provider (e.g., typec_extcon_bridge), not just as a boolean flag as in mainline kernel bindings. The vendor implementation allows usb-role-switch = <&typec_extcon_bridge>; to work correctly.
Learnt from: EvilOlaf
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:64-70
Timestamp: 2025-09-14T06:10:25.610Z
Learning: In the Armbian build system, rk32xx and rk33xx Rockchip SoCs no longer have BSP-based (vendor) kernel branches. The rk3506 is the first 32-bit Rockchip SoC to use the vendor branch in the current codebase.
Learnt from: igorpecovnik
Repo: armbian/build PR: 8789
File: config/kernel/linux-sunxi64-edge.config:839-839
Timestamp: 2025-10-22T07:51:53.015Z
Learning: In Armbian's wireless driver configuration, CONFIG_RK_WIFI_DEVICE_* options are Rockchip-specific device registration settings, while CONFIG_WLAN_UWE* are the actual cross-platform driver modules for UWE5622 wireless chips. The UWE5622 chip (manufactured by Unisoc/Spreadtrum) is used on multiple Allwinner boards including Orange Pi Zero 2/2W/3 and Orange Pi 3 LTS, so CONFIG_WLAN_UWE5621/5622 along with Unisoc infrastructure options (CONFIG_SPARD_WLAN_SUPPORT, CONFIG_SC23XX, CONFIG_UNISOC_WIFI_PS, CONFIG_WCN_BSP_DRIVER_BUILDIN) are correct in sunxi64 kernel configs.
Learnt from: HackingGate
Repo: armbian/build PR: 8665
File: config/boards/photonicat2.csc:4-4
Timestamp: 2025-10-26T10:41:35.118Z
Learning: In the Armbian build system, rk3576 boards consistently use BOARDFAMILY="rk35xx" for both vendor and edge kernel targets. The rk35xx family configuration sources rockchip64_common.inc, which provides edge and current kernel branch definitions, making these branches available even though they're not defined directly in rk35xx.conf.
Learnt from: EvilOlaf
Repo: armbian/build PR: 8886
File: patch/kernel/rk35xx-vendor-6.1/dt/rk3528-nanopi-rev01.dts:9-9
Timestamp: 2025-11-08T06:39:24.527Z
Learning: In Armbian's Rockchip vendor kernel branches (rk35xx-vendor), device tree files may not require the same headers as mainline Linux. For example, input key definitions like KEY_BACK and KEY_VOLUMEUP may be handled differently in BSP kernels and don't necessarily need explicit includes like <dt-bindings/input/input.h> that would be required in mainline kernel device trees.
Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:64-70
Timestamp: 2025-09-14T06:29:18.958Z
Learning: In the Armbian build system, vendor branch configurations in family files are designed to be shared across multiple SoCs within the same family that use the same vendor kernel tree. For example, rk35xx and rockchip-rk3588 families both use identical vendor branch settings (same KERNELSOURCE, KERNELBRANCH, and KERNELPATCHDIR), demonstrating that vendor branches are intentionally generic rather than SoC-specific.
📚 Learning: 2026-01-03T07:27:45.955Z
Learnt from: iav
Repo: armbian/build PR: 9158
File: patch/kernel/archive/rockchip64-6.18/add-board-helios64.patch:598-600
Timestamp: 2026-01-03T07:27:45.955Z
Learning: In Rockchip vendor kernel branches (e.g., rockchip64-6.18), the FUSB302 device tree binding accepts usb-role-switch as a phandle reference to a USB role switch provider (e.g., typec_extcon_bridge), not just as a boolean flag as in mainline kernel bindings. The vendor implementation allows usb-role-switch = <&typec_extcon_bridge>; to work correctly.

Applied to files:

  • patch/kernel/archive/rockchip64-6.19/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch
📚 Learning: 2026-01-10T04:28:58.758Z
Learnt from: kasimling
Repo: armbian/build PR: 9177
File: patch/kernel/archive/rockchip64-6.18/rk3588-1212-arm64-dts-Automatic-fan-speed-and-USB-3.0-Type-A-por.patch:37-41
Timestamp: 2026-01-10T04:28:58.758Z
Learning: When reviewing Linux kernel device-tree bindings involving thermal cooling devices, THERMAL_NO_LIMIT can be used for both min_state (lower) and max_state (upper). If used as lower/min_state, the framework converts it to 0; if used as upper/max_state, it converts to the cooling device's max_state. Verify patch entries like: cooling-device = <&fan THERMAL_NO_LIMIT 1> are valid and correctly reflect the intended bounds. Ensure consistent interpretation of NO_LIMIT in both min and max contexts and that the resulting values align with the device's actual limits.

Applied to files:

  • patch/kernel/archive/rockchip64-6.19/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch
  • patch/kernel/archive/rockchip64-6.18/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch
📚 Learning: 2026-01-03T07:27:40.951Z
Learnt from: iav
Repo: armbian/build PR: 9158
File: patch/kernel/archive/rockchip64-6.18/add-board-helios64.patch:598-600
Timestamp: 2026-01-03T07:27:40.951Z
Learning: In vendor Rockchip kernel patches (e.g., rockchip64-6.18), verify that the FUSB302 device tree binding uses a phandle reference for usb-role-switch (e.g., usb-role-switch = <&typec_extcon_bridge>;), not a bare boolean flag as in mainline. Ensure patches reflect the vendor implementation that supports phandles to a USB role switch provider, and adjust bindings accordingly to avoid regressions in USB role switching.

Applied to files:

  • patch/kernel/archive/rockchip64-6.18/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch
🔇 Additional comments (5)
patch/kernel/archive/rockchip64-6.19/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch (3)

20-68: FUSB302 and USB-C connector configuration looks correct.

The FUSB302 node is properly configured with:

  • Correct compatible string "fcs,fusb302"
  • Level-low interrupt with matching pull-up pinctrl
  • USB-C connector with dual data/power roles
  • Proper endpoint wiring to xhci DRD, PHY SS, and SBU ports

The PD configuration (sink 5V/1A, source 5V/3A) is reasonable for this board.


76-78: Pinctrl configuration is correct.

The interrupt pin matches the FUSB302 interrupt definition (GPIO0 RK_PC4) with appropriate pull-up configuration for active-low signaling.


103-123: USBDP PHY configuration looks good.

The PHY node properly enables orientation switching and configures SBU DC GPIOs. The endpoint connections correctly pair with the connector's SS and SBU ports, completing the bidirectional endpoint graph.

patch/kernel/archive/rockchip64-6.18/rk3588-1213-arm64-dts-rk3588s-roc-pc-Enable-USB-type-C-port.patch (2)

20-68: FUSB302 and connector configuration is correct.

Same as the 6.19 patch - properly configured FUSB302 with USB-C connector, PD settings, and endpoint wiring.


103-123: USBDP PHY configuration is correct.

Endpoint graph properly connects the PHY to the USB-C connector for SuperSpeed and SBU lanes.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Copy link
Member

@igorpecovnik igorpecovnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address Rabbitt's suggestions.

@kasimling kasimling marked this pull request as draft January 15, 2026 00:55
Signed-off-by: Alex Ling <ling_kasim@hotmail.com>
@kasimling kasimling marked this pull request as ready for review January 17, 2026 04:34
@kasimling
Copy link
Author

Resolved review comments and fixed USB 3.0 support

@github-actions github-actions bot added the Ready to merge Reviewed, tested and ready for merge label Jan 17, 2026
@github-actions
Copy link
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions bot removed the Needs review Seeking for review label Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

02 Milestone: First quarter release Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

2 participants