From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796486623; b=QTEpUmlvHzI8jzdUoysZRM06bdOMdcNMVN0Q/cZhW3vAdcpBRb5BMgVRFYDHQYtRNyr/ dd8cvFLPplP+bYPsHB1XHwmZ1H8fcRiIv4kZsmGpalhOK2mQ7B5+t9lAQSvG9nOsBVM7D smY12xM7CTlVBs0gckOZOXKl+Mi/HOC+x7izPORF3nJ9kZy0wwb8MsjCQFzfpobIIUeNh wp/NUumXsrImvvKCri0zjabUTID4+pCmz5Bw7BudiA+8CeqaohFqZEe6WXn1CTEzrQd2m D13mZ0UDB/lTN0+gfBPScVu5N4B/2Sl/ADGyfMJykT50WY7whJf8GKKKAkldYGaL5uw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796486623; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=B0pB0pcXmDNs/n8/oDlmXgKKJ175xy388bv4PeAraOc=; b=minsL9jPFnBUuN5igkLscqAi14KFmpWXDFIxTpUpCNKzrnAsgtzO93YewbxW1mqheC5l lAI2JAEt7ZTRxQybecHTeH4BYajyHP8t6parf1Dd/ZTMX2d48fOAgsdJNF5WNPZLTCRnD zHfpO0+xwf3oKphGLY70skIHdT0b6lTfjV09p7Gjs6UzouX7ur5Q0T2i1FRojmvUqdlUx A+w9xNdo2nmjcrvZ4icCesxBeQk9xbPJ+dbj/W2Upjkg9RevoWpp+Tlkc5lY0FqaEZ4+E hGnyhvUx4SHKn9sqAE2PZZdk8qeoXCgNt/wNCSGQRtsK4XzZ0F7Si9mSvgnEVA9cOxA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q+f4ojTI; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F265606A33D; Sat, 5 Dec 2026 16:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q+f4ojTI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36E671F0092B; Sat, 5 Dec 2026 16:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796486623; bh=B0pB0pcXmDNs/n8/oDlmXgKKJ175xy388bv4PeAraOc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Q+f4ojTI04hSzCiZfJo33mKTE0jRZrK5V7f2pEE6pUQOzOmCovq6v1G9L+7tcgXlv XDPlTnGsN9pYzczcDzW279oFVGnVUhaaSDPx5b8wtHpFeBum0gWruYhIwvQE9kD7ut 9rGYDhnNYIl4NRnZWqVs+9fFzmwyPQ6PFfeAyipI4DO0jYsOhU1fc0k82L3LChaEk6 4c5+e5q1KaZYZBLNYTEvjmVoqSHUiNDWK/doBc+x5BsRI1PmCOwu5XWwFguz3f2ZS0 BlgnH07fny4OUCw2QHZIqok8kdvvrNRSmWGalN8Zn/IZLICCaTWqRQVjXi3wzmamER rbW8uTpewSnPw== Subject: Re: [PATCH net-next v5 2/2] net: stmmac: Add glue layer for Synaptics SL2610 SoC 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 Date: Sat, 05 Dec 2026 16:03:41 +0000 Message-ID: <179648662180.3146.5110527824140503520@kernel.org> In-Reply-To: <20261204152836.31432-3-jszhang@kernel.org> References: <20261204152836.31432-3-jszhang@kernel.org> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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