lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251118190530.580267-1-vladimir.oltean@nxp.com>
Date: Tue, 18 Nov 2025 21:05:15 +0200
From: Vladimir Oltean <vladimir.oltean@....com>
To: netdev@...r.kernel.org
Cc: Andrew Lunn <andrew@...n.ch>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	linux-kernel@...r.kernel.org,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Herve Codina <herve.codina@...tlin.com>,
	Mark Brown <broonie@...nel.org>,
	Serge Semin <fancer.lancer@...il.com>,
	Maxime Chevallier <maxime.chevallier@...tlin.com>,
	Lee Jones <lee@...nel.org>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	devicetree@...r.kernel.org
Subject: [PATCH net-next 00/15] Probe SJA1105 DSA children using MFD and dynamic OF nodes

This series prepares the SJA1105 driver for a goal covered in upcoming
patches: customize the XPCS with extra device tree properties for board
specific settings (specifically lane polarity).

The XPCS handles conversion of internal parallel Ethernet MAC data onto
a SGMII serial interface. This block can be memory-mapped or it can be
accessed over MDIO. Its driver (drivers/net/pcs/pcs-xpcs.c) always
expects it to be on an MDIO bus, so if memory-mapped, the code creates a
fake MDIO bus whose reads and writes go to the memory addresses. Note
that in the case of the SPI-controlled SJA1105 switches, memory-mapped
means accessible through the same device-specific SPI transfer protocol
that reads and writes any other switch register.

The status at present date in this DSA driver is that the XPCS is
implicitly created and used by the driver despite not described in the
device tree at all. The code which creates a fake MDIO bus for the XPCS
is itself a subset of the more general logic implemented in
drivers/net/pcs/pcs-xpcs-plat.c, and the latter already has DT bindings.

So we have to modify SJA1105's DT schema to allow XPCS children, and
modify the XPCS schema to allow SJA1105 compatibles (patch 12/15).

To retain compatibility with XPCS not being described in the device, we
use the dynamic OF API to create implicit XPCS nodes based on resources
hardcoded in the driver, when those nodes are missing (patch 13/15).

To probe the XPCS platform driver using its standard bindings but
adapted to sitting behind a SPI bus, the former needs to be converted
to regmap, as done in patch 11/15, and also needs to be aware of its
specific compatible string (patch 10/15). The SJA1105 also has to
provide a regmap for its child, in patch 05/15.

We use the MFD framework to probe the XPCS children. Actually, the XPCS
bindings want "reg" to denote the base address in the switch address
space, and the DSA ethernet-switch root node is not structured to be
able to provide that (other children need #address-cells = <0>). So we
create an intermediary "regs" node between the top-level ethernet-switch
node and the new ethernet-pcs node. This solves the device tree
hierarchy issue but results in the need for patch 07/15.

To use the MFD framework for XPCS, the SJA1105 driver must be decoupled
with it, interacting only through standard interfaces rather than
accessing it directly. Patch 01/15 replaces sja1105_static_config_reload()
interaction with generic phylink helpers for replaying link events after
a reset. Patch 10/15 and 15/15 obtain a simple phylink_pcs reference in
the SJA1105 driver based on the standard 'pcs-handle' device tree
property (phandle).

The work to use MFD for XPCS triggered a chain reaction where the other
MDIO buses implemented in the SJA1105 driver were also migrated to
standalone drivers and probed using MFD. This is the topic of patches
03/15, 04/15 and 08/15. This helps increase the separation of concerns
and makes the SJA1105 DSA driver more focused on switching stuff.

The rest (patches 02/15, 06/15, 09/15) are minor "glue" changes.

Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Herve Codina <herve.codina@...tlin.com>
Cc: Mark Brown <broonie@...nel.org>
Cc: Serge Semin <fancer.lancer@...il.com>
Cc: Maxime Chevallier <maxime.chevallier@...tlin.com>
Cc: Lee Jones <lee@...nel.org>
Cc: Rob Herring <robh@...nel.org>
Cc: Krzysztof Kozlowski <krzk+dt@...nel.org>
Cc: Conor Dooley <conor+dt@...nel.org>
Cc: devicetree@...r.kernel.org

Vladimir Oltean (15):
  net: dsa: sja1105: let phylink help with the replay of link callbacks
  net: mdio-regmap: permit working with non-MMIO regmaps
  net: mdio: add driver for NXP SJA1110 100BASE-T1 embedded PHYs
  net: mdio: add generic driver for NXP SJA1110 100BASE-TX embedded PHYs
  net: dsa: sja1105: prepare regmap for passing to child devices
  net: dsa: sja1105: include spi.h from sja1105.h
  mfd: core: add ability for cells to probe on a custom parent OF node
  net: dsa: sja1105: transition OF-based MDIO drivers to standalone
  net: dsa: sja1105: remove sja1105_mdio_private
  net: pcs: xpcs: introduce xpcs_create_pcs_fwnode()
  net: pcs: xpcs-plat: convert to regmap
  dt-bindings: net: dsa: sja1105: document the PCS nodes
  net: pcs: xpcs-plat: add NXP SJA1105/SJA1110 support
  net: dsa: sja1105: replace mdiobus-pcs with xpcs-plat driver
  net: dsa: sja1105: permit finding the XPCS via pcs-handle

 .../bindings/net/dsa/nxp,sja1105.yaml         |  28 +
 .../bindings/net/pcs/snps,dw-xpcs.yaml        |   8 +
 MAINTAINERS                                   |   2 +
 drivers/mfd/mfd-core.c                        |  11 +-
 drivers/net/dsa/sja1105/Kconfig               |   2 +
 drivers/net/dsa/sja1105/Makefile              |   2 +-
 drivers/net/dsa/sja1105/sja1105.h             |  42 +-
 drivers/net/dsa/sja1105/sja1105_main.c        | 169 +++---
 drivers/net/dsa/sja1105/sja1105_mdio.c        | 507 ------------------
 drivers/net/dsa/sja1105/sja1105_mfd.c         | 293 ++++++++++
 drivers/net/dsa/sja1105/sja1105_mfd.h         |  11 +
 drivers/net/dsa/sja1105/sja1105_spi.c         | 113 +++-
 drivers/net/mdio/Kconfig                      |  21 +-
 drivers/net/mdio/Makefile                     |   2 +
 drivers/net/mdio/mdio-regmap-simple.c         |  77 +++
 drivers/net/mdio/mdio-regmap.c                |   7 +-
 drivers/net/mdio/mdio-sja1110-cbt1.c          | 173 ++++++
 drivers/net/pcs/pcs-xpcs-plat.c               | 146 +++--
 drivers/net/pcs/pcs-xpcs.c                    |  12 +
 drivers/net/phy/phylink.c                     |  75 ++-
 include/linux/mdio/mdio-regmap.h              |   2 +
 include/linux/mfd/core.h                      |   7 +
 include/linux/pcs/pcs-xpcs.h                  |   1 +
 include/linux/phylink.h                       |   5 +
 24 files changed, 1033 insertions(+), 683 deletions(-)
 delete mode 100644 drivers/net/dsa/sja1105/sja1105_mdio.c
 create mode 100644 drivers/net/dsa/sja1105/sja1105_mfd.c
 create mode 100644 drivers/net/dsa/sja1105/sja1105_mfd.h
 create mode 100644 drivers/net/mdio/mdio-regmap-simple.c
 create mode 100644 drivers/net/mdio/mdio-sja1110-cbt1.c

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ