netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Serge Semin <fancer.lancer@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Jose Abreu <Jose.Abreu@synopsys.com>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Tomer Maimon <tmaimon77@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>
Cc: Serge Semin <fancer.lancer@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	openbmc@lists.ozlabs.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next 00/16] net: pcs: xpcs: Add memory-based management iface support
Date: Tue,  5 Dec 2023 13:35:21 +0300	[thread overview]
Message-ID: <20231205103559.9605-1-fancer.lancer@gmail.com> (raw)

The main goal of this series is to extend the DW XPCS device support in
the kernel. Particularly the patchset adds the DW XPCS MCI/APB3 management
interface support to the MDIO subsystem (basically it's a way to access
the memory-mapped DW XPCS devices), modifies the DW XPCS PCS-driver to
being registered as a standard MDIO-device driver and finally extends the
STMMAC MDIO sub-module functionality so one would be able to support both
SMA- and MI-based ways to communicate with the XPCS-device. The later way
will implies to have an XPCS-device passed to the DW MAC node via the
generic "pcs-handle" property.

The series traditionally starts with the cleanup patches, which can be
also considered as preparations. First redundant sentinel entry and the
header files are removed. Then two errno cleanups are introduced: return
EINVAL from the soft-reset method and make sure that the validate method
returns EINVAL straight away if the requested interface isn't supported by
the XPCS device instance.

Afterwards three preparation patches are introduced. First one just moves
the generic DW XPCS IDs macro-based declarations from the internal header
file to the external one where some other IDs also reside. Second patch
updates the XPCS registration procedure to avoid dummy MDIO-device
creation if it is already available in the framework of the specified
MDIO-bus. Finally third patch splits up the xpcs_create() method to a set
of the coherent sub-function for the sake of the further easier updates
and to have it looking less complicated.

The next three patches add the DW XPCS Management Interface driver to the
MDIO subsystem, update the DW XPCS driver to support a PCS-device
registered on a MDIO-bus and add the DT-bindings for both of these
objects.  Note the hierarchical design (having a DW XPCS device defined as
a sub-node of the DW XPCS management interface node) has been chosen for
several reasons. First Synopsys calls the MCI/APB3 interface as Management
Interface with two possible ways of the MMD CSRs access (direct and
indirect), which is basically a bus between the system and the PCS-device
with a possibility to have more than just one device attached. So the
chosen design looks more correct from the HW representation point of view.
Second the drivers for the SMA/MDIO-capable controllers (STMMAC and it's
glue layers for example) will still be able to manually register an
MDIO-bus but from now with custom XPCS-device identifiers. So the DW XPCS
driver will get to be attached to that device activating respective
internal functionality (see patches 10, 13 and 16). Thus if there is no
way to auto-identify the XPCS device capabilities it can be done based on
the custom device IDs or DT-node compatible string (see patch 10). But if
it's, then the device IDs will be auto-detected by the MDIO-subsystem and
the DW XPCS driver will still get attached to the device on the MDIO-bus.
All of that AFAICS would have been impossible (or much harder) to
implement should the Management Interface MDIO-bus be just internally
created in the DW XPCS driver.

Afterwards two patches add the "pcs-handle" DT-property support to the DW
XPCS driver. The first one of them is a preparation patch, which just
converts the name of the currently available XPCS device registration
method to having "_byaddr" suffix. It better identifies the method and
will make it more distinguishable from the method being added in the next
patch. The second patch introduces a new function which responsibility is
to create the DW XPCS descriptor based on the "pcs-handle" property and
PCS-PHY interface. The prototype is specifically selected to be looking
similar to another XPCS device registration method and to the phylink
fwnode-based connect interface function.

Finally after two small preparations the STMMAC driver is finally updated
to support the DW XPCS devices specified via the "pcs-handle" firmware
node. Thus the STMMAC driver from now will be able to handle the cases
with the DW XPCS devices accessible over the memory-based management
interface or over the external MDIO-buses.

That's it for now. Thanks for review in advance. Any tests are very
welcome. After this series is merged in, I'll submit another one which
adds the generic 10GBase-R and 10GBase-X interfaces support to the STMMAC
and DW XPCS driver with proper CSRs re-initialization, PMA initialization
and reference clock selection as it's defined by the Synopsys DW XPCS HW
manual.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: openbmc@lists.ozlabs.org
Cc: netdev@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Serge Semin (16):
  net: pcs: xpcs: Drop sentinel entry from 2500basex ifaces list
  net: pcs: xpcs: Drop redundant workqueue.h include directive
  net: pcs: xpcs: Return EINVAL in the internal methods
  net: pcs: xpcs: Explicitly return error on caps validation
  net: pcs: xpcs: Move native device ID macro to linux/pcs/pcs-xpcs.h
  net: pcs: xpcs: Avoid creating dummy XPCS MDIO device
  net: pcs: xpcs: Split up xpcs_create() content to sub-functions
  dt-bindings: net: Add Synopsys DW xPCS bindings
  net: mdio: Add Synopsys DW XPCS management interface support
  net: pcs: xpcs: Add generic DW XPCS MDIO-device support
  net: pcs: xpcs: Change xpcs_create_mdiodev() suffix to "byaddr"
  net: pcs: xpcs: Add xpcs_create_bynode() method
  net: stmmac: intel: Register generic MDIO device
  net: stmmac: Pass netdev to XPCS setup function
  net: stmmac: Add dedicated XPCS cleanup method
  net: stmmac: Add externally detected DW XPCS support

 .../bindings/net/pcs/snps,dw-xpcs.yaml        |  88 ++++
 .../bindings/net/snps,dw-xpcs-mi.yaml         |  88 ++++
 drivers/net/dsa/sja1105/sja1105_mdio.c        |   2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-intel.c |  31 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |   3 +-
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  14 +-
 .../net/ethernet/stmicro/stmmac/stmmac_mdio.c |  51 ++-
 drivers/net/mdio/Kconfig                      |   8 +
 drivers/net/mdio/Makefile                     |   1 +
 drivers/net/mdio/mdio-dw-xpcs.c               | 384 ++++++++++++++++++
 drivers/net/pcs/Kconfig                       |   6 +-
 drivers/net/pcs/pcs-xpcs.c                    | 285 ++++++++++---
 drivers/net/pcs/pcs-xpcs.h                    |   7 +-
 include/linux/pcs/pcs-xpcs.h                  |  36 +-
 14 files changed, 908 insertions(+), 96 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/pcs/snps,dw-xpcs.yaml
 create mode 100644 Documentation/devicetree/bindings/net/snps,dw-xpcs-mi.yaml
 create mode 100644 drivers/net/mdio/mdio-dw-xpcs.c

-- 
2.42.1


             reply	other threads:[~2023-12-05 10:36 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 10:35 Serge Semin [this message]
2023-12-05 10:35 ` [PATCH net-next 01/16] net: pcs: xpcs: Drop sentinel entry from 2500basex ifaces list Serge Semin
2023-12-05 11:24   ` Vladimir Oltean
2023-12-05 11:39     ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 02/16] net: pcs: xpcs: Drop redundant workqueue.h include directive Serge Semin
2023-12-05 13:34   ` Andrew Lunn
2023-12-05 10:35 ` [PATCH net-next 03/16] net: pcs: xpcs: Return EINVAL in the internal methods Serge Semin
2023-12-05 13:34   ` Andrew Lunn
2023-12-05 10:35 ` [PATCH net-next 04/16] net: pcs: xpcs: Explicitly return error on caps validation Serge Semin
2023-12-05 10:35 ` [PATCH net-next 05/16] net: pcs: xpcs: Move native device ID macro to linux/pcs/pcs-xpcs.h Serge Semin
2023-12-05 10:45   ` Russell King (Oracle)
2023-12-05 11:14     ` Serge Semin
2023-12-05 11:22       ` Russell King (Oracle)
2023-12-05 11:48         ` Serge Semin
2023-12-05 11:27   ` Vladimir Oltean
2023-12-05 11:49     ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 06/16] net: pcs: xpcs: Avoid creating dummy XPCS MDIO device Serge Semin
2023-12-05 10:49   ` Russell King (Oracle)
2023-12-05 11:31     ` Serge Semin
2023-12-05 13:31       ` Russell King (Oracle)
2023-12-05 13:52       ` Andrew Lunn
2023-12-05 14:50         ` Russell King (Oracle)
2023-12-12 13:52           ` Serge Semin
2023-12-05 11:52   ` Vladimir Oltean
2023-12-13 15:27     ` Serge Semin
2023-12-19 15:48       ` Serge Semin
2023-12-19 16:28         ` Vladimir Oltean
2023-12-19 21:48           ` Serge Semin
2023-12-05 13:46   ` Russell King (Oracle)
2023-12-05 14:54     ` Russell King (Oracle)
2023-12-12 15:26       ` Serge Semin
2023-12-12 19:06         ` Russell King (Oracle)
2023-12-13 15:47           ` Serge Semin
2023-12-13  0:01     ` Serge Semin
2023-12-13 16:32       ` Russell King (Oracle)
2023-12-14 14:19         ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 07/16] net: pcs: xpcs: Split up xpcs_create() content to sub-functions Serge Semin
2023-12-05 10:35 ` [PATCH net-next 08/16] dt-bindings: net: Add Synopsys DW xPCS bindings Serge Semin
2023-12-14 17:40   ` Rob Herring
2023-12-14 21:27     ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 09/16] net: mdio: Add Synopsys DW XPCS management interface support Serge Semin
2023-12-05 12:32   ` Maxime Chevallier
2023-12-06 16:48     ` Serge Semin
2023-12-06 17:01       ` Andrew Lunn
2023-12-07 13:35         ` Serge Semin
2023-12-07 14:02           ` Russell King (Oracle)
2023-12-07 14:54           ` Andrew Lunn
2023-12-08 16:07             ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 10/16] net: pcs: xpcs: Add generic DW XPCS MDIO-device support Serge Semin
2023-12-05 11:13   ` Vladimir Oltean
2023-12-05 11:35     ` Serge Semin
2023-12-05 12:23       ` Vladimir Oltean
2023-12-08 14:11         ` Serge Semin
2023-12-08 16:33           ` Vladimir Oltean
2023-12-14 11:54             ` Serge Semin
2023-12-14 12:00               ` Vladimir Oltean
2023-12-14 12:28                 ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 11/16] net: pcs: xpcs: Change xpcs_create_mdiodev() suffix to "byaddr" Serge Semin
2023-12-05 23:03   ` kernel test robot
2023-12-07 14:37     ` Serge Semin
2023-12-06  0:29   ` kernel test robot
2023-12-05 10:35 ` [PATCH net-next 12/16] net: pcs: xpcs: Add xpcs_create_bynode() method Serge Semin
2023-12-05 10:35 ` [PATCH net-next 13/16] net: stmmac: intel: Register generic MDIO device Serge Semin
2023-12-06  0:19   ` kernel test robot
2023-12-07 14:47     ` Serge Semin
2023-12-05 10:35 ` [PATCH net-next 14/16] net: stmmac: Pass netdev to XPCS setup function Serge Semin
2023-12-05 10:35 ` [PATCH net-next 15/16] net: stmmac: Add dedicated XPCS cleanup method Serge Semin
2023-12-05 10:35 ` [PATCH net-next 16/16] net: stmmac: Add externally detected DW XPCS support Serge Semin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231205103559.9605-1-fancer.lancer@gmail.com \
    --to=fancer.lancer@gmail.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    --cc=tmaimon77@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).