All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/22] phy: cadence-torrent: rewrite Torrent PHY driver
@ 2026-12-02 15:08 ` Benjamin Robin
  0 siblings, 0 replies; 61+ messages in thread
From: Benjamin Robin @ 2026-12-02 15:08 UTC (permalink / raw)
  To: Nishanth Menon, Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Siddharth Vadapalli,
	Andrew Davis, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Vinod Koul, Manivannan Sadhasivam, Swapnil Jakhade,
	Yuti Amonkar, Philipp Zabel
  Cc: thomas.petazzoni, Chintan Vankar, Abhash Kumar Jha,
	Thomas Richard, Gregory CLEMENT, Théo Lebrun, Tawfik Bayouk,
	Vladimir Kondratiev, linux-arm-kernel, devicetree, linux-kernel,
	dri-devel, linux-phy, Benjamin Robin, Tomi Valkeinen, stable,
	Dmitry Guzman

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.

To be able to test this driver, it 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.

Both series [1] and [2] are included in this one.

[1] https://lore.kernel.org/all/20261124101747.2432344-1-a-kumar2@ti.com/
[2] https://lore.kernel.org/all/20260326134929.1696750-1-c-vankar@ti.com/

Signed-off-by: Benjamin Robin <benjamin.robin@bootlin.com>
---
Changes in v2:
- Split the series into a series of "smaller" patches
- Addressed the sashiko comments
- Link to v1: https://patch.msgid.link/20261120-phy-cadence-torrent-ng-v1-0-da2db7125cd7@bootlin.com

---
Abhash Kumar Jha (1):
      drm/bridge: cdns-mhdp8546: Power on/off the PHY in probe/remove

Benjamin Robin (19):
      dt-bindings: phy: cadence-torrent: make cdns,num-lanes optional again
      dt-bindings: phy: cadence-torrent: add phy-mode constants
      phy: cadence-torrent: make cdns,num-lanes optional again
      phy: cadence-torrent: rename symbols to prepare for rewrite
      phy: cadence-torrent: replace regmap with readw/writew
      phy: cadence-torrent: move refclk clk_init_data to the stack
      phy: cadence-torrent: drop diag_tx_drv from DP voltage coeff
      phy: cadence-torrent: use link lane count and mlane for DP config
      phy: cadence-torrent: use devm_of_clk_add_hw_provider()
      phy: cadence-torrent: rework subnode parsing and lane validation
      phy: cadence-torrent: rework ref clock init and probe cleanup
      phy: cadence-torrent: factor out DP PLL frequency update
      phy: cadence-torrent: store clock and reset handles only on success
      phy: cadence-torrent: unify link configuration in the probe
      phy: cadence-torrent: allow config on an already-configured DP link
      phy: cadence-torrent: track current DP link bit rate
      phy: cadence-torrent: rework suspend/resume to restore link config
      phy: cadence-torrent: rewrite Torrent PHY driver
      phy: cadence-torrent: support 8 lanes on the sd0801 PHY

Chintan Vankar (1):
      arm64: dts: ti: k3-j7200: Fix QSGMII overlay by adding SERDES PHY

Dmitry Guzman (1):
      phy: torrent: fix `RX_DIAG_NQST_CTRL` register address

 .../bindings/phy/phy-cadence-torrent.yaml          |    9 +-
 .../dts/ti/k3-j7200-evm-quad-port-eth-exp.dtso     |    3 +-
 .../gpu/drm/bridge/cadence/cdns-mhdp8546-core.c    |   11 +-
 drivers/phy/cadence/phy-cadence-torrent.c          | 9411 +++++++++-----------
 include/dt-bindings/phy/phy-cadence.h              |    7 +
 5 files changed, 4438 insertions(+), 5003 deletions(-)
---
base-commit: 6515d69692fb374d01e3dc95eef53047ca8f947c
change-id: 20261103-phy-cadence-torrent-ng-8d497bd05f48

Best regards,
--  
Benjamin Robin <benjamin.robin@bootlin.com>


^ permalink raw reply	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2026-12-02 17:59 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 15:08 [PATCH v2 00/22] phy: cadence-torrent: rewrite Torrent PHY driver Benjamin Robin
2026-12-02 15:08 ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 01/22] arm64: dts: ti: k3-j7200: Fix QSGMII overlay by adding SERDES PHY Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:24   ` sashiko-bot
2026-12-02 15:24     ` sashiko-bot
2026-12-02 15:08 ` [PATCH v2 02/22] drm/bridge: cdns-mhdp8546: Power on/off the PHY in probe/remove Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 03/22] dt-bindings: phy: cadence-torrent: make cdns,num-lanes optional again Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 04/22] dt-bindings: phy: cadence-torrent: add phy-mode constants Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 05/22] phy: cadence-torrent: make cdns,num-lanes optional again Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 06/22] phy: torrent: fix `RX_DIAG_NQST_CTRL` register address Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 07/22] phy: cadence-torrent: rename symbols to prepare for rewrite Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 08/22] phy: cadence-torrent: replace regmap with readw/writew Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 09/22] phy: cadence-torrent: move refclk clk_init_data to the stack Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 10/22] phy: cadence-torrent: drop diag_tx_drv from DP voltage coeff Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 11/22] phy: cadence-torrent: use link lane count and mlane for DP config Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:28   ` sashiko-bot
2026-12-02 15:28     ` sashiko-bot
2026-12-02 15:08 ` [PATCH v2 12/22] phy: cadence-torrent: use devm_of_clk_add_hw_provider() Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 13/22] phy: cadence-torrent: rework subnode parsing and lane validation Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 14/22] phy: cadence-torrent: rework ref clock init and probe cleanup Benjamin Robin
2026-12-02 15:08   ` Benjamin Robin
2026-12-02 15:24   ` sashiko-bot
2026-12-02 15:24     ` sashiko-bot
2026-12-02 15:09 ` [PATCH v2 15/22] phy: cadence-torrent: factor out DP PLL frequency update Benjamin Robin
2026-12-02 15:09   ` Benjamin Robin
2026-12-02 15:09 ` [PATCH v2 16/22] phy: cadence-torrent: store clock and reset handles only on success Benjamin Robin
2026-12-02 15:09   ` Benjamin Robin
2026-12-02 15:09 ` [PATCH v2 17/22] phy: cadence-torrent: unify link configuration in the probe Benjamin Robin
2026-12-02 15:09   ` Benjamin Robin
2026-12-02 15:37   ` sashiko-bot
2026-12-02 15:37     ` sashiko-bot
2026-12-02 15:09 ` [PATCH v2 18/22] phy: cadence-torrent: allow config on an already-configured DP link Benjamin Robin
2026-12-02 15:09   ` Benjamin Robin
2026-12-02 15:31   ` sashiko-bot
2026-12-02 15:31     ` sashiko-bot
2026-12-02 15:09 ` [PATCH v2 19/22] phy: cadence-torrent: track current DP link bit rate Benjamin Robin
2026-12-02 15:09   ` Benjamin Robin
2026-12-02 15:09 ` [PATCH v2 20/22] phy: cadence-torrent: rework suspend/resume to restore link config Benjamin Robin
2026-12-02 15:34   ` sashiko-bot
2026-12-02 15:34     ` sashiko-bot
2026-12-02 15:09 ` [PATCH v2 21/22] phy: cadence-torrent: rewrite Torrent PHY driver Benjamin Robin
2026-12-02 15:38   ` sashiko-bot
2026-12-02 15:38     ` sashiko-bot
2026-12-02 17:18     ` Benjamin Robin
2026-12-02 17:18       ` Benjamin Robin
2026-12-02 15:09 ` [PATCH v2 22/22] phy: cadence-torrent: support 8 lanes on the sd0801 PHY Benjamin Robin
2026-12-02 15:09   ` Benjamin Robin
2026-12-02 15:30   ` sashiko-bot
2026-12-02 15:30     ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.