[PATCH 0/4] phy: cadence-torrent: rewrite Torrent PHY driver
From: Benjamin Robin
Date: Fri Nov 20 2026 - 07:56:20 EST
This series rewrites the driver for the Cadence Torrent multi-protocol
PHY (sd0801).
Motivation
----------
The existing phy-cadence-torrent driver hard-codes, for each supported
configuration, the register values to program. The configuration space
is large: protocol and associated PLL frequency, DisplayPort bit rate,
reference clock frequency, spread-spectrum clocking (SSC), number of
lanes, PHY revision and technology. As a result, every new board or
standard combination requires a full extra table of opaque register
values, which is inflexible and hard to maintain.
The rewrite aims to:
- simplify the addition of support for a new board;
- support every reference clock frequencies supported by the Cadence
Torrent PHY;
- support multiple links per standard without restriction (the previous
driver, for instance, was limited to two PCIe links);
- allow, in the future, the dynamic reconfiguration of the SerDes link
rate (for example, to switch between SGMII and 2500BASE-X).
Because this is a complete rewrite, the diff is large and not well suited
to a line-by-line review. The rewritten driver can be fetched from the
`phy-cadence-torrent` branch at https://github.com/benjarobin/linux
Design
------
The new driver computes the register values instead of hard-coding them:
- registers that depend on the reference clock frequency or on a PLL
frequency are computed at run time, from the reference clock
obtained through the clock framework and from the PLL frequency
derived from the selected standard;
- the remaining registers, which only depend on the standard type, the
PHY revision and the technology, are written through one function per
register, with an internal table selected by a
standard/revision/technology key.
The PHY revision and technology are detected from the PHY identification
registers, and the DisplayPort link initialization and rate-change
sequence were rewritten.
Validation
----------
Because the rewritten driver computes register values instead of
hard-coding them, its output was validated against two independent
references:
- The Cadence "Torrent Programmers Guide" spreadsheet, for the
registers that depend on the reference clock and on the PLL
frequencies. The spreadsheet generates (as a CSV) the expected value
of every register to write; the values computed by the driver were
compared with these expected values over a large number of
combinations of reference clock, PLL frequency.
To make this comparison feasible, the reference-clock and PLL
computation code was extracted into small userspace harnesses,
so that many combinations can be swept without booting the hardware,
and the results are fed to a comparison tool that checks them against
the spreadsheet CSV.
- The existing driver, for the complete set of programmed registers.
Every supported configuration of the old driver was extracted as a
test case. Two userspace harnesses were generated:
- tp-full-old, mirroring the old cdns_torrent_phy_init() /
cdns_torrent_phy_configure_multilink() path;
- tp-full-new, mirroring the new tp_configure_links() path.
These 2 userspace harnesses run the same test cases (single
standards, standard pairs, PCIe-Multilink and internal-SSC variants)
and then compare, register by register, the writes performed by each
driver for the same configuration. The registers written by both
drivers match, with a small number of remaining differences that are
all explained (for example, values that were fixed in a later
revision of the spreadsheet, or obsolete/unused registers);
The last patch of the series adds a debug trace on every register read
or write, so the same comparison can also be performed on real hardware
by capturing the driver logs.
The tooling used for the validation described above is available at:
https://github.com/benjarobin/cadence-torrent-phy-tooling
Status / testing
----------------
The driver has so far been validated on two TI boards:
- J784S4XEVM: two PCIe links (x2, x4), one DisplayPort link (display
output working) and one USB-C port (configured as host);
- J721EXCPXEVM: two PCIe links (x2, x1) and a J721EXENETXPANEVM
daughter card exposing four Ethernet ports over a single QSGMII
link (~1 Gbps per port).
Comments on the overall approach are welcome, as is testing on additional
hardware, for which Tested-by tags would be appreciated.
Dependency
----------
This series should be applied on top of v7.4-rc3. This was done this way
since the commit "treewide: Convert devm_kmalloc() family to the
devm_kmalloc_obj() family" introduced conflicts.
The driver depends on the following series:
- [1]: needed since the driver requires the consumers to call
phy_power_on() and phy_power_off();
- [2]: needed otherwise the QSGMII SerDes link is never powered ON.
The series [2] is included in this one.
[1] https://lore.kernel.org/all/20260601095041.3042950-1-a-kumar2@xxxxxx/
[2] https://lore.kernel.org/all/20260326134929.1696750-1-c-vankar@xxxxxx/
Signed-off-by: Benjamin Robin <benjamin.robin@xxxxxxxxxxx>
---
Benjamin Robin (3):
dt-bindings: phy: cadence-torrent: drop cdns,num-lanes default value
dt-bindings: phy: cadence-torrent: add phy-mode constants
phy: cadence-torrent: rewrite Torrent PHY driver
Chintan Vankar (1):
arm64: dts: ti: k3-j7200: Fix QSGMII overlay by adding SERDES PHY
.../bindings/phy/phy-cadence-torrent.yaml | 10 +-
.../dts/ti/k3-j7200-evm-quad-port-eth-exp.dtso | 3 +-
drivers/phy/cadence/phy-cadence-torrent.c | 9417 +++++++++-----------
include/dt-bindings/phy/phy-cadence.h | 8 +
4 files changed, 4376 insertions(+), 5062 deletions(-)
---
base-commit: 6515d69692fb374d01e3dc95eef53047ca8f947c
change-id: 20261103-phy-cadence-torrent-ng-8d497bd05f48
Best regards,
--
Benjamin Robin <benjamin.robin@xxxxxxxxxxx>