Re: [PATCH 4/4] phy: cadence-torrent: rewrite Torrent PHY driver

From: Benjamin Robin

Date: Tue Nov 24 2026 - 12:18:55 EST


On Saturday, November 21, 2026 at 5:16 PM, Krzysztof Kozlowski wrote:
> On Fri, Nov 20, 2026 at 01:55:52PM +0100, Benjamin Robin wrote:
> > The Cadence Torrent PHY (sd0801) is a multi-protocol SerDes used in
> > several SoCs, among them the Texas Instruments J72xx family. Its
> > programming depends on many parameters: the selected protocol (each
> > associated PLL has to be set to a different frequency), the DisplayPort
> > bit rate, the reference clock frequency, whether spread-spectrum
> > clocking (SSC) is enabled, the number of lanes, and the PHY revision
> > and technology (process node).
> >
> > The current phy-cadence-torrent driver hard-codes, for every supported
> > configuration, the set of register values to program. Because this
> > configuration space is large, adding a new board or a new combination
> > of standards requires duplicating dozens of opaque register values,
> > which is inflexible and hard to maintain.
> >
> > This new driver version computes the register values instead:
> >
> > - 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 other registers, which only depend on the standard type, the
> > PHY revision and the technology, are handled by one function per
> > register, using an internal table selected through a
> > standard/revision/technology key.
> >
> > The PHY revision and technology are detected automatically from the
> > PHY identification registers, and the DisplayPort link initialization
> > and rate reconfiguration have been rewritten.
> >
> > Compared with the existing driver, this rewrite provides:
>
> 10k lines patch!

I was expecting this kind of feedback, which is why the cover letter says:

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

To give more context: the new driver was written from scratch, in a new
empty file, although a very small part of the old driver was copied over.
I initially considered adding the new driver to staging, but after internal
discussion we decided against it.

>
> No, instead improve the driver instead of doing bunch of significant
> changes like:
>
> > -#define MAX_NUM_LANES 4
> > +#define MAX_NUM_LANES 8

Regarding incremental changes: I could try to build a series of smaller
steps from the old driver towards the new one. That comes at an
additional "cost", since intermediate patches would fix functions or
how there are called, that a later patch then removes or replaces.

However, even with such a series, the core transformation remains: one
patch replacing all the tables with per-register functions computing the
values. That patch alone removes roughly 3k lines and adds 2.5k lines,
which cannot really be split further.

So, I am going to try to create an incremental series: many "small" patches
converging towards the new implementation, with one unavoidable large patch.

With this additional context, could you confirm whether you would
prefer the series split into smaller patches?

>
> This is absolutely unreviewable.


--
Benjamin Robin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com