rk_typec_phy: add USB-C DisplayPort altmode bring-up for RK3399#2225
Open
b1nc0d3x wants to merge 1 commit into
Open
rk_typec_phy: add USB-C DisplayPort altmode bring-up for RK3399#2225b1nc0d3x wants to merge 1 commit into
b1nc0d3x wants to merge 1 commit into
Conversation
The existing sys/arm64/rockchip/rk_typec_phy.c (Vadot, 2019) brings the
RK3399 Type-C combo PHY up in USB 3.0 SuperSpeed mode only. The PHY is
a 4-lane combo block that can also be muxed for DisplayPort in any of
the standard Type-C pin assignments (C, D, E, F), with two or four
lanes of DP signaling alongside zero or two lanes of USB3. DP altmode
is the prerequisite for the Cadence MHDP DPTX driver to drive a USB-C
DisplayPort sink on RockPro64, Pinebook Pro, and other RK3399 boards.
Added on top of the existing driver:
- DP altmode phynode operations (set_mode(DP), set_mode(USB),
set_mode(USB+DP) for 2+2 pin assignments).
- Lane swap selection driven by CC orientation, routed through the
rk3399 fusb302 helper.
- Pin-assignment table: C_E (4-lane DP), D_F (2-lane DP + 2-lane
USB3). The consumer driver selects the assignment from the DP
partner's VDM Discover_Modes response.
- Combo PHY PLL reprogram for HBR (2.7 Gbps) and RBR (1.62 Gbps)
link rates. HBR2 (5.4 Gbps) is reserved for follow-up — the PLL
recipe is not in the Rockchip 4.4 BSP.
- Link training state hand-off API exposed to the cdn-dp consumer:
enter DP altmode, wait for PHY A0_READY, signal lane status to
DPTX firmware.
- Sysctl tunables (force pin assignment, lane swap, AUX polarity)
for bring-up; default is autodetect.
- Per-instance debug flag dev.rk_typec_phy.<N>.debug, default 0 —
working boards stay quiet on dmesg.
Existing USB-only path is preserved. -7 lines are minor cleanups in
the existing path: hoisted forward declarations and one sysctl-tree
node rename that conflicted with the new DP tree.
The original copyright header for the USB scaffold is preserved
verbatim; a second copyright line is added for the new contribution.
Tested on RockPro64 v2.1 + XYM W156F1 portable USB-C monitor:
- PHY transitions from A3 (off) to A0 (ready) within ~100 ms of
phynode_set_mode(DP).
- Lane swap follows CC orientation (cable in either slot yields a
working DP link).
- Pin assignment C (4-lane DP) and D (2-lane DP + USB3) both reach
A0_READY.
- HBR (2.7 Gbps) achieves CR+EQ on both DP lanes; verified via
cdn-dp DPCD readback after link training.
- USB-only mode (no DP partner) stays in SuperSpeed; no regression
versus the upstream Vadot driver.
- kldload/kldunload cycle through DP-attached and USB-only modes:
PLL registers return to reset values on unload.
Depends on the fusb302 / rk3399_fusb302_helper work in the D4 review.
A follow-up will introduce the MHDP DPTX driver that consumes this
PHY-side API.
Signed-off-by: Kyle Crenshaw <B1nc0d3x@gmail.com>
|
Thank you for taking the time to contribute to FreeBSD! Some of files have special handling: Important @evadot wants to review changes to sys/arm64/rockchip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sys/arm64/rockchip/rk_typec_phy.c(Vadot, 2019) brings the RK3399Type-C combo PHY up in USB 3.0 SuperSpeed mode only. The PHY is a
4-lane combo block that can also be muxed for DisplayPort in any of
the standard Type-C pin assignments (C, D, E, F), with two or four
lanes of DP signaling alongside zero or two lanes of USB3. Adding
DP-altmode support here is the prerequisite for the Cadence MHDP
DPTX driver (next review) to drive a USB-C DisplayPort sink on
RockPro64, Pinebook Pro, and other RK3399 boards.
What this patch adds
phynodeoperations (set_mode(DP),set_mode(USB),set_mode(USB+DP)for 2+2 pin assignments).detection, routed through the rk3399 fusb302 helper.
USB3). Selected by the consumer driver based on the DP
partner's VDM Discover_Modes response.
HBR2 (5.4 Gbps) reserved for follow-up — the PLL recipe is not
in the Rockchip 4.4 BSP.
enter DP altmode, wait for PHY A0_READY, signal lane status to
DPTX firmware.
polarity — bring-up only; default is autodetect.
dev.rk_typec_phy.<N>.debug, default 0.What this patch does NOT add
DPTX firmware boot + link training is the next review.
Authorship
The original
rk_typec_phy.cUSB-only path (2019) is by Emmanuel Vadotmanu@FreeBSD.org. The DP-altmode additions in this patch were
written by Kyle Crenshaw on top of Manu's USB scaffold and the
Rockchip 4.4 BSP for PHY register sequencing. Manu's BSD-2
copyright header is preserved verbatim; a second copyright line is
added for the new contribution.
Dependencies
Depends on the fusb302 / rk3399_fusb302_helper work currently in
PR #2211 (D3 / D4). Reviewers can build this branch in isolation
(the helper symbols resolve at runtime), but a working DP link
requires the fusb302-side patches.
Test plan
phynode_set_mode(DP).reach A0_READY.
verified via cdn-dp DPCD readback after link training.
regression versus the upstream Vadot driver.
kldload rk_typec_phy ; kldunload rk_typec_phycycle in bothDP-attached and USB-only modes: all PLL registers return to
reset values on unload, no leaks.
dev.rk_typec_phy.0.force_pin_assign=C: link still trains atHBR; verifies the assignment is actually selected (not just
autodetect winning the same way).
Suggested reviewers
Per recent committers to
sys/arm64/rockchip/:rk_typec_phy.cauthor, most active in this dir)Subscribers: freebsd-arm, freebsd-x11