Re: [PATCH net-next v5 2/2] net: stmmac: Add glue layer for Synaptics SL2610 SoC
From: netdev-bot+sashiko
Date: Sat Dec 05 2026 - 11:03:55 EST
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