From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31976606A32F for ; Sat, 5 Dec 2026 16:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=0AW5EK1S; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q+f4ojTI DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Message-ID:Date :Cc:To:From:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=B0pB0pcXmDNs/n8/oDlmXgKKJ175xy388bv4PeAraOc=; b=0AW5EK1S/MzQcpnl9P+De/Lwe+ aSDqXfCgVy8iYPENr9/xv2Msmqq1i7M86SRiWGQl0NoAcg02wXElpNMFSJzhgKvo1I9UShNnarGdt FsgX+b+XEiB9s93WmmbyyN5pD/zHQck90lwaDLlU/o3cdJQntw/UirjRHFvWROZm8Tb355q7xnHAL clu7uDDoOgxIZuiTwEp77svtJoPuHw6z+OqqlsQwD6QHTY7qBTskCN2d7c3jyqZEGzQ5hiWLSSXrv 2K6NxEMK4g+jX4xGEcrORB6P4gziMans32EJpSEHfTqi7jYM4A0xwUnAFSxUgb0CjRl2ma0cn7+o8 1O43Bzew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZsEk-00000002dlr-0oVv; Sat, 05 Dec 2026 16:03:46 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZsEi-00000002dlG-1Hac for linux-arm-kernel@lists.infradead.org; Sat, 05 Dec 2026 16:03:44 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 7563761242; Sat, 5 Dec 2026 16:03:43 +0000 (UTC) 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-Archived-By: MIME-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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