Devicetree
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: jszhang@kernel.org
Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, sebastian.hesselbarth@gmail.com,
	maxime.chevallier@bootlin.com, mcoquelin.stm32@gmail.com,
	alexandre.torgue@foss.st.com, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, richard.genoud@bootlin.com
Subject: Re: [PATCH net-next v5 2/2] net: stmmac: Add glue layer for Synaptics SL2610 SoC
Date: Sat, 05 Dec 2026 16:03:41 +0000	[thread overview]
Message-ID: <179648662180.3146.5110527824140503520@kernel.org> (raw)
In-Reply-To: <20261204152836.31432-3-jszhang@kernel.org>

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 2

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] net: stmmac: dwmac-syna: legacy MDIO fallback bypasses shared
  MDIO guard
- [Low] The new driver dwmac-syna.c adds a devicetree ABI that nothing in
  the tree documents.
- [Low] The driver does more than the commit message and Kconfig help
  describe, and the extra behaviour is not obvious.

--

net: stmmac: Add glue layer for Synaptics SL2610 SoC

This commit adds a dwmac glue driver for the DesignWare GMAC controllers
in the Synaptics SL2610 SoC. The driver gets a syscon regmap and a
per-MAC interface control register offset from the device tree. It uses
them to set the PHY interface and to select the master of the shared
MDIO bus.

> 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 0000000000000..b2cb47c0d39e4
> --- /dev/null
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c

[ ... ]

> +/* Only one MAC can provide the shared external MDIO bus. */
> +static unsigned long syna_mdio_claimed;
> +
> +static void syna_dwmac_release_mdio(void *data)
> +{
> +	clear_bit(0, &syna_mdio_claimed);
> +}
> +
> +static int syna_dwmac_claim_mdio(struct syna_dwmac *dwmac)
> +{
> +	if (!dwmac->plat->mdio_node ||
> +	    !of_device_is_available(dwmac->plat->mdio_node))
> +		return 0;
> +
> +	if (test_and_set_bit(0, &syna_mdio_claimed))
> +		return dev_err_probe(dwmac->dev, -EINVAL,
> +				     "Shared MDIO bus already claimed\n");

[Severity: Medium]
Does this guard cover the case where stmmac falls back to the legacy
MDIO bus?

devm_stmmac_probe_config_dt() calls stmmac_mdio_setup(). When the MAC
node has no mdio child, no phy-handle and no fixed-link, legacy_mdio is
set and plat->mdio_bus_data is allocated, but plat->mdio_node stays
NULL.

In that case both syna_dwmac_claim_mdio() and syna_dwmac_init() return
0 early. syna_mdio_claimed is never set, and SYNA_MDIO_MASTER_SEL in
SYNA_TW_PORT_CTRL is never written. stmmac_mdio_register() only checks
plat->mdio_bus_data, though. It calls of_mdiobus_register() with a
NULL node, which registers and scans a live bus on that MAC.

Suppose MAC0 takes the legacy path. It scans the shared external MDIO
bus without claiming it. When MAC1 later probes with an available mdio
child, the claim succeeds and syna_dwmac_init() switches
SYNA_MDIO_MASTER_SEL to MAC1 underneath MAC0's registered bus. MAC0's
PHY accesses would then go out through the other MAC. If MAC1 takes
the legacy path instead, it scans the bus without selecting itself as
master at all.

If the legacy auto-probe isn't supported on SL2610, should the driver
clear plat->mdio_bus_data when there is no available mdio node? Or
should the claim and the master select key off plat->mdio_bus_data,
which is the condition stmmac_mdio_register() uses?

[Severity: Low]
The commit message only says this adds glue for the SL2610 GMACs. The
Kconfig help says "This configures the PHY interface through the system
controller." Could the changelog also describe the shared MDIO handling?

The two MACs appear to share one external MDIO bus. syna_dwmac_init()
picks the master by writing SYNA_MDIO_MASTER_SEL in SYNA_TW_PORT_CTRL,
and the value depends on which RGMIIx_CTRL offset the DT supplied.

syna_mdio_claimed is module-global. If a second MAC instance has an
available mdio child node, its whole probe fails here with -EINVAL. That
Ethernet port is then lost, not just its MDIO bus.

The syscon offset is only checked against SYNA_RGMII0_CTRL and
SYNA_RGMII1_CTRL on the MAC that owns the MDIO bus. On the other MAC,
syna_dwmac_set_phy_intf_sel() writes to whatever offset the DT provides,
with no check.

These rules decide how board DTs have to be written. Only one MAC may
carry an mdio child, and the other has to use a phy-handle into that
bus. Would it make sense to state them in the commit message, and to
explain there why the cross-instance global state is needed?

> +
> +	return devm_add_action_or_reset(dwmac->dev, syna_dwmac_release_mdio, NULL);
> +}

[ ... ]

> +	dwmac->regmap = syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node,
> +							     "syna,syscon", 1,
> +							     &dwmac->rgmii_ctl);
> +	if (IS_ERR(dwmac->regmap))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(dwmac->regmap),
> +				     "Failed to get syscon regmap\n");

[ ... ]

> +static const struct of_device_id syna_dwmac_match[] = {
> +	{ .compatible = "syna,sl2610-dwmac" },
> +	{ /* sentinel */ }
> +};

[Severity: Low]
This adds the "syna,sl2610-dwmac" compatible. syna_dwmac_probe() also
requires the "syna,syscon" property: a phandle plus one argument cell,
which is used as the RGMIIx_CTRL offset. Is there a devicetree binding
for these?

I couldn't find a schema for syna,sl2610-dwmac under
Documentation/devicetree/bindings/net/, and snps,dwmac.yaml doesn't list
it. The only sl2610 bindings in the tree seem to be syna,sl2610-uart and
syna,sl2610-spi.

Without a binding, dtbs_check can't validate board DTs, and checkpatch
will warn about an undocumented compatible. Nothing states that the
syscon argument cell must be 0xa18 or 0xa3c, as syna_dwmac_init()
expects.

Should a binding patch be posted before or alongside this driver?

> +MODULE_DEVICE_TABLE(of, syna_dwmac_match);

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204152836.31432-1-jszhang%40kernel.org

      parent reply	other threads:[~2026-12-05 16:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 15:28 [PATCH net-next v5 0/2] net: stmmac: add SL2610 ethernet support Jisheng Zhang
2026-12-04 15:28 ` [PATCH net-next v5 1/2] dt-bindings: net: Add Synaptics SL2610 DWMAC Jisheng Zhang
2026-12-05 16:03   ` netdev-bot+sashiko
2026-12-04 15:28 ` [PATCH net-next v5 2/2] net: stmmac: Add glue layer for Synaptics SL2610 SoC Jisheng Zhang
2026-12-04 17:16   ` Maxime Chevallier
2026-12-04 19:01   ` Andrew Lunn
2026-12-05 15:49   ` sashiko-bot
2026-12-05 16:03   ` netdev-bot+sashiko [this message]

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=179648662180.3146.5110527824140503520@kernel.org \
    --to=netdev-bot+sashiko@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=jszhang@kernel.org \
    --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=richard.genoud@bootlin.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