Re: [PATCH 4/8] net: stmmac: Add glue layer for Synaptics SL2610 SoC
From: Jisheng Zhang
Date: Mon Nov 23 2026 - 08:24:15 EST
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@xxxxxxxxxx>
> > ---
> > 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@xxxxxxxxxx>
> > M: Sebastian Hesselbarth <sebastian.hesselbarth@xxxxxxxxx>
> > L: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx (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@xxxxxxxxxx>
> > + *
> > + */
> > +
> > +#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