[PATCH v4 phy-next 0/9] RCW override for 10G Lynx dynamic protocol reconfiguration

Vladimir Oltean posted 9 patches 3 days ago
.../bindings/soc/fsl/fsl,layerscape-dcfg.yaml |  15 +-
drivers/phy/freescale/Kconfig                 |   1 +
drivers/phy/freescale/phy-fsl-lynx-10g.c      |  23 +-
drivers/soc/fsl/guts.c                        | 528 ++++++++++++++++--
include/linux/fsl/guts.h                      |  18 +-
5 files changed, 532 insertions(+), 53 deletions(-)
[PATCH v4 phy-next 0/9] RCW override for 10G Lynx dynamic protocol reconfiguration
Posted by Vladimir Oltean 3 days ago
Previous set "New Generic PHY driver for Lynx 10G SerDes":
https://lore.kernel.org/linux-phy/20260610151952.2141019-1-vladimir.oltean@nxp.com/
introduced the 10G Lynx SerDes driver with a reduced functionality set.
Namely, only minor protocol changes are supported (1GbE <-> 2.5GbE).
The major protocol changes need a procedure named RCW override,
explained in more detail in commits 6/8 and 7/8.

This series adds kernel and device tree binding support for RCW
override, completing the SerDes PHY driver functionality.

Two components are involved:
- drivers/soc/fsl/guts.c (binding is fsl,layerscape-dcfg.yaml) - Device
  Configuration Unit, this is API provider for the SerDes driver to
  request RCW override depending on SoC
- drivers/phy/freescale/phy-fsl-lynx-10g.c - SerDes PHY driver, this is
  API consumer

The guts driver probes on DCFG blocks from multiple Freescale SoC
generations:
- MPC85xx, BSC and QorIQ (PowerPC) are all covered by the
  Documentation/devicetree/bindings/soc/fsl/guts.txt schema
- Layerscape (Arm) is covered by
  Documentation/devicetree/bindings/soc/fsl/fsl,layerscape-dcfg.yaml

It is ultimately the same hardware block, just that (from what I can
tell) the Layerscape nodes are also compatible with syscon, and PowerPC
aren't.

RCW override has only been validated on select Layerscape SoCs, so
converting guts.txt to a PowerPC schema is out of scope for this
series - we don't even touch that (just in case it gets asked).

Using syscon to map the DCFG_DCSR register block in the Lynx SerDes
driver instead of creating this guts <-> lynx API was considered, but
because the RCW procedure is SoC-specific, it was ruled out for
polluting the SerDes driver. The guts driver is all about SoC awareness
anyway, and it offers some abstraction of all the gory details.

Changes since v3:
- new patch (1/9) to improve the fsl_guts_init() error path. The entire
  patch set is adapted to use the new convention.
- patch 8/9: avoid accessing an invalid soc.rcwcr_lock if
  fsl_guts_lane_set_mode() would be called too early
- patch 8/9: fix serdes block and lane count bounds
- patch 8/9 and 9/9: reimplement LS2088A RCW override in a way that is
  self-contained within the guts driver (based on reading and decoding
  RCWSR29[SRDS_PRTCL_S1]). Only a subset of SRDS_PRTCL_S1 values is
  supported for RCW override, due to availabilty of hardware to test on
  my side. Notably, protocols with XAUI and QSGMII are deliberately
  omitted from the SerDes table because only testing can show whether
  these protocols require RCWSR30_SRDS_CLK_SEL set to GMII or XGMII.
  This new method completely replaces fsl_guts_lane_init(), and has the
  advantage of also figuring out the initial protocol of unmanaged lanes,
  thereby not breaking them on RCW overrides.

v3 at:
https://lore.kernel.org/linux-phy/20260720133642.136324-1-vladimir.oltean@nxp.com/

Changes since v2:
- fix error handling in fsl_guts_init() and make sure that all newly
  introduced RCW override API functions fail if fsl_guts_init() failed.
- replace __bf_shf() use with __ffs()
- use read_poll_timeout_atomic() in fsl_guts_rcw_rmw() to clarify that
  DCFG_DCSR writes are supposed to reflect back in DCFG_CCSR
- only operate on lanes on which fsl_guts_lane_init() was called in
  ls2088a_serdes_init_rcwcr()
- put parentheses around (lane) in LS1088A_RCWSR29_SRDS_PRTCL_S1_LNn()
  and LS1088A_RCWSR30_SRDS_PRTCL_S2_LNn() macro expressions

v2 at:
https://lore.kernel.org/linux-phy/20260612210859.266759-8-vladimir.oltean@nxp.com/

Changes since v1:
- add Conor's review tag on 6/8
- update email addresses of DT maintainers
- drop DT maintainers from explicit CC on patch 7/8
- keep devicetree@vger.kernel.org CCed on entire series
- include missing <linux/bitfield.h> in patch 7/8
- namespace SRDS_PRTCL values for LS1046A and LS1088A, even if they are
  the same. For LS1028A (not covered here) they are not.
- prefix SRDS_CLK_SEL_{GMII,XGMII} with LS2088A_
- reorder alphanumerically (LS1046A should come before LS1088A)

Change logs also in individual patches.

v1 at:
https://lore.kernel.org/linux-phy/20260611193940.44416-1-vladimir.oltean@nxp.com/

Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Rob Herring <robh@kernel.org>

Ioana Ciornei (4):
  soc: fsl: guts: use a macro to encode the DCFG CCSR space
  soc: fsl: guts: add a global structure to hold state
  soc: fsl: guts: add a central fsl_guts_read() function
  soc: fsl: guts: make it easier to determine on which SoC we are
    running

Vladimir Oltean (5):
  soc: fsl: guts: perform fsl_guts_init() error teardown in reverse
    order of setup
  soc: fsl: guts: make fsl_soc_data available after fsl_guts_init()
  dt-bindings: fsl: layerscape-dcfg: define DCFG_DCSR region
  soc: fsl: guts: implement the RCW override procedure
  phy: lynx-10g: use RCW override procedure for dynamic protocol change

 .../bindings/soc/fsl/fsl,layerscape-dcfg.yaml |  15 +-
 drivers/phy/freescale/Kconfig                 |   1 +
 drivers/phy/freescale/phy-fsl-lynx-10g.c      |  23 +-
 drivers/soc/fsl/guts.c                        | 528 ++++++++++++++++--
 include/linux/fsl/guts.h                      |  18 +-
 5 files changed, 532 insertions(+), 53 deletions(-)

-- 
2.34.1
Re: [PATCH v4 phy-next 0/9] RCW override for 10G Lynx dynamic protocol reconfiguration
Posted by Vladimir Oltean 1 day, 8 hours ago
On Wed, Jul 22, 2026 at 02:15:54AM +0300, Vladimir Oltean wrote:
> Ioana Ciornei (4):
>   soc: fsl: guts: use a macro to encode the DCFG CCSR space
>   soc: fsl: guts: add a global structure to hold state
>   soc: fsl: guts: add a central fsl_guts_read() function
>   soc: fsl: guts: make it easier to determine on which SoC we are
>     running
> 
> Vladimir Oltean (5):
>   soc: fsl: guts: perform fsl_guts_init() error teardown in reverse
>     order of setup
>   soc: fsl: guts: make fsl_soc_data available after fsl_guts_init()
>   dt-bindings: fsl: layerscape-dcfg: define DCFG_DCSR region
>   soc: fsl: guts: implement the RCW override procedure
>   phy: lynx-10g: use RCW override procedure for dynamic protocol change

Even though I intended these changes for linux-phy (they are also
build-tested there), I'm fine either with these changes taken through
Vinod's tree with Christophe's ACK for patches 1-8, or through
Christophe's tree with Vinod's ACK for patch 9, really.

I see on Patchwork there's a minor issue in the commit message of patch 3/9:
https://patchwork.kernel.org/project/linux-phy/patch/20260721231603.67865-4-vladimir.oltean@nxp.com/
"WARNING: 'struture' may be misspelled - perhaps 'structure'?"

Could this be fixed up while applying, if there is no other feedback?