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

Krzysztof Kozlowski krzk at kernel.org
Sat Nov 21 08:16:58 PST 2026


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!

No, instead improve the driver instead of doing bunch of significant
changes like:

> -#define MAX_NUM_LANES		4
> +#define MAX_NUM_LANES		8


mixed up with things like:

>  	/* voltage swing 3, pre-emphasis 0->3 */
> -	{	{.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000,
> -		 .cpost_mult = 0x0000},
> -		{.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF,
> -		 .cpost_mult = 0xFFFF},
> -		{.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF,
> -		 .cpost_mult = 0xFFFF},
> -		{.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF,
> -		 .cpost_mult = 0xFFFF}
> +	{
> +		{ .mgnfs_mult = 0x0000, .cpost_mult = 0x0000 },
> +		{ .mgnfs_mult = 0xFFFF, .cpost_mult = 0xFFFF },
> +		{ .mgnfs_mult = 0xFFFF, .cpost_mult = 0xFFFF },
> +		{ .mgnfs_mult = 0xFFFF, .cpost_mult = 0xFFFF },
>  	}

and with:

> -static int cdns_torrent_dp_configure(struct phy *phy,
> -				     union phy_configure_opts *opts)
> +static int tp_phy_configure(struct phy *phy, union phy_configure_opts *opts)
>  {

...

> -static int cdns_torrent_phy_on(struct phy *phy)
> +static int tp_phy_on(struct phy *phy)

This is absolutely unreviewable.

>  };

Best regards,
Krzysztof




More information about the linux-phy mailing list