Netdev List
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@kernel.org>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4/8] net: stmmac: Add glue layer for Synaptics SL2610 SoC
Date: Mon, 23 Nov 2026 21:03:41 +0800	[thread overview]
Message-ID: <awQ5raWYlMBpCqIl@xhacker> (raw)
In-Reply-To: <4f1c4180-3a00-4b17-a27b-e61b307d3e5f@bootlin.com>

On Mon, Nov 23, 2026 at 12:57:06PM +0100, Maxime Chevallier wrote:
> Hi,
> 
> On 11/16/26 14:54, Jisheng Zhang wrote:
> > Add dwmac glue driver to support the DesignWare-based GMAC controllers
> > in the Synaptics SL2610 SoC.
> > 
> > Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> > ---
> >  MAINTAINERS                                   |   2 +
> >  drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 ++
> >  drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
> >  .../net/ethernet/stmicro/stmmac/dwmac-syna.c  | 116 ++++++++++++++++++
> >  4 files changed, 130 insertions(+)
> >  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 430758242906..dba0288bf4da 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -3808,12 +3808,14 @@ M:	Jisheng Zhang <jszhang@kernel.org>
> >  M:	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> >  L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
> >  S:	Maintained
> > +F:	Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml
> >  F:	Documentation/devicetree/bindings/soc/synaptics/
> >  F:	arch/arm/boot/dts/synaptics/
> >  F:	arch/arm/mach-berlin/
> >  F:	arch/arm64/boot/dts/synaptics/
> >  F:	drivers/clk/berlin/*sl2610*
> >  F:	drivers/clk/berlin/sl-*
> > +F:	drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c
> >  F:	drivers/pinctrl/berlin/pinctrl-sl2610.c
> >  F:	drivers/reset/reset-sl2610.c
> >  F:	drivers/soc/synaptics/
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> > index c6559e749c0c..79ffebcaba0e 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
> > +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> > @@ -310,6 +310,17 @@ config DWMAC_SUN55I
> >  	  stmmac device driver. This driver is used for A523/T527
> >  	  GMAC200 ethernet controller.
> >  
> > +config DWMAC_SYNA
> > +	tristate "Synaptics SL2610 DWMAC support"
> > +	depends on OF && HAS_DMA && (ARCH_BERLIN || COMPILE_TEST)
> > +	select MFD_SYSCON
> > +	help
> > +	  Support for the Synaptics SL2610 DesignWare Ethernet MAC glue.
> > +	  This configures the PHY interface through the system controller.
> > +
> > +	  To compile this driver as a module, choose M here. The module
> > +	  will be called dwmac-syna.
> > +
> >  config DWMAC_THEAD
> >  	tristate "T-HEAD dwmac support"
> >  	depends on OF && (ARCH_THEAD || COMPILE_TEST)
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
> > index b16a456b730e..d132353e9403 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/Makefile
> > +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
> > @@ -35,6 +35,7 @@ obj-$(CONFIG_DWMAC_STM32)	+= dwmac-stm32.o
> >  obj-$(CONFIG_DWMAC_SUNXI)	+= dwmac-sunxi.o
> >  obj-$(CONFIG_DWMAC_SUN8I)	+= dwmac-sun8i.o
> >  obj-$(CONFIG_DWMAC_SUN55I)	+= dwmac-sun55i.o
> > +obj-$(CONFIG_DWMAC_SYNA)	+= dwmac-syna.o
> >  obj-$(CONFIG_DWMAC_THEAD)	+= dwmac-thead.o
> >  obj-$(CONFIG_DWMAC_ULTRARISC)	+= dwmac-ultrarisc.o
> >  obj-$(CONFIG_DWMAC_DWC_QOS_ETH)	+= dwmac-dwc-qos-eth.o
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c
> > new file mode 100644
> > index 000000000000..c4bc895b29da
> > --- /dev/null
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c
> > @@ -0,0 +1,116 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Synaptics DWMAC platform driver
> > + *
> > + * Copyright (C) 2026 Jisheng Zhang <jszhang@kernel.org>
> > + *
> > + */
> > +
> > +#include <linux/bitfield.h>
> > +#include <linux/module.h>
> > +#include <linux/mfd/syscon.h>
> > +#include <linux/of.h>
> > +#include <linux/of_device.h>
> > +#include <linux/of_net.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/regmap.h>
> > +
> > +#include "stmmac_platform.h"
> > +
> > +#define CTL_PHY_INTF_SEL	GENMASK(4, 1)
> > +#define CTL_PHY_INTF_RGMII	FIELD_PREP(CTL_PHY_INTF_SEL, 1)
> > +#define CTL_PHY_INTF_RMII	FIELD_PREP(CTL_PHY_INTF_SEL, 4)
> 
> Please use PHY_INTF_SEL_RGMII and PHY_INTF_SEL_RMII from "common.h"

I read this as "use SYNA_PHY_INTF_SEL_RGMII and SYNA_PHY_INTF_SEL_RMII",
correct me if there's misunderstanding.

> 
> > +
> > +struct syna_dwmac {
> > +	struct plat_stmmacenet_data *plat;
> > +	struct regmap *regmap;
> > +	u32 rgmii_ctl;
> > +	struct device *dev;
> > +};
> > +
> > +static int syna_dwmac_set_phy_if(struct plat_stmmacenet_data *plat)
> > +{
> > +	struct syna_dwmac *dwmac = plat->bsp_priv;
> > +	u32 phyif;
> > +
> > +	switch (plat->phy_interface) {
> > +	case PHY_INTERFACE_MODE_RMII:
> > +		phyif = CTL_PHY_INTF_RMII;
> > +		break;
> > +	case PHY_INTERFACE_MODE_RGMII:
> > +	case PHY_INTERFACE_MODE_RGMII_ID:
> > +	case PHY_INTERFACE_MODE_RGMII_TXID:
> > +	case PHY_INTERFACE_MODE_RGMII_RXID:
> > +		phyif = CTL_PHY_INTF_RGMII;
> > +		break;
> > +	default:
> > +		dev_err(dwmac->dev, "unsupported phy interface %s\n",
> > +			phy_modes(plat->phy_interface));
> > +		return -EINVAL;
> > +	}
> > +
> > +	return regmap_update_bits(dwmac->regmap, dwmac->rgmii_ctl, CTL_PHY_INTF_SEL, phyif);
> > +}
> > +
> > +static int syna_dwmac_init(struct device *dev, void *priv)
> > +{
> > +	struct syna_dwmac *dwmac = priv;
> > +
> > +	return syna_dwmac_set_phy_if(dwmac->plat);
> > +}
> 
> Can you implement .set_phy_intf_sel() instead ? that should simplify that quite a lot.
> 

Good idea. Thanks for the suggestion

  reply	other threads:[~2026-11-23 13:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 13:54 [PATCH 0/8] net: stmmac: add SL2610 ethernet support Jisheng Zhang
2026-11-16 13:54 ` [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer Jisheng Zhang
2026-11-16 15:06   ` Andrew Lunn
2026-11-17  5:06     ` Jisheng Zhang
2026-11-17 13:24       ` Andrew Lunn
2026-11-17 14:13         ` Jisheng Zhang
2026-11-17 14:59           ` Andrew Lunn
2026-11-17 15:55             ` Jisheng Zhang
2026-11-17 16:20               ` Andrew Lunn
2026-11-17 16:18                 ` Jisheng Zhang
2026-11-17 17:02                   ` Andrew Lunn
2026-11-16 13:54 ` [PATCH 2/8] net: mdio: Add MDIO demultiplexer driver Jisheng Zhang
2026-11-16 13:54 ` [PATCH 3/8] dt-bindings: net: Add Synaptics SL2610 DWMAC Jisheng Zhang
2026-11-23 11:22   ` Krzysztof Kozlowski
2026-11-16 13:54 ` [PATCH 4/8] net: stmmac: Add glue layer for Synaptics SL2610 SoC Jisheng Zhang
2026-11-23 11:57   ` Maxime Chevallier
2026-11-23 13:03     ` Jisheng Zhang [this message]
2026-11-16 13:54 ` [PATCH 5/8] dt-bindings: soc: synaptics: Allow SL2610 mux controller children Jisheng Zhang
2026-11-23 11:20   ` Krzysztof Kozlowski
2026-11-16 13:54 ` [PATCH 6/8] soc: synaptics: Populate SL2610 system controller DT children Jisheng Zhang
2026-11-16 13:54 ` [PATCH 7/8] arm64: dts: synaptics: Add SL2610 Ethernet nodes Jisheng Zhang
2026-11-16 13:54 ` [PATCH 8/8] arm64: dts: synaptics: Enable Ethernet on SL2619 RDK Jisheng Zhang

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=awQ5raWYlMBpCqIl@xhacker \
    --to=jszhang@kernel.org \
    --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=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=sebastian.hesselbarth@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