🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17203

Re: [PATCH net-next v6 5/7] net: ftgmac100: Require phy-mode for AST2700

#17203
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 13:54
189 lines
14745 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

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

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).

- [High] The new AST2700 check in ftgmac100_mii_probe()
  (drivers/net/ethernet/faraday/ftgmac100.c, lines 1529-1535) can never…
- [High] The commit says it makes phy-mode required for AST2700 and fails
  probe when it is missing.
- [Low] In the series' binding change (commit "dt-bindings: net:
  ftgmac100: Add AST2700 compatible"), phy-mode is required for every…

--

net: ftgmac100: Require phy-mode for AST2700

This commit makes ftgmac100_mii_probe() fail with -EINVAL on AST2700 when
the phy-mode property is missing, instead of falling back to RGMII. The
stated goal is to make phy-mode a required property for AST2700, since
that SoC also supports RMII.

> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 9b7becb017262..5a578a62df673 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -1526,8 +1526,13 @@ static int ftgmac100_mii_probe(struct net_device *netdev)
>  
>  	/* Default to RGMII. It's a gigabit part after all */
>  	err = of_get_phy_mode(np, &phy_intf);
> -	if (err)
> +	if (err) {
> +		if (priv->mac_id == FTGMAC100_AST2700) {
> +			dev_err(priv->dev, "phy-mode is required for this SoC\n");
> +			return -EINVAL;
> +		}
>  		phy_intf = PHY_INTERFACE_MODE_RGMII;
> +	}

[Severity: High]
Can this new branch ever be reached on AST2700?

priv->mii_bus is only set by ftgmac100_setup_mdio(), and ftgmac100_probe()
only calls that for the Faraday, AST2400 and AST2500 variants:

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_probe() {
    ...
	if (priv->mac_id == FTGMAC100_FARADAY ||
	    priv->mac_id == FTGMAC100_AST2400 ||
	    priv->mac_id == FTGMAC100_AST2500) {
		err = ftgmac100_setup_mdio(netdev);
    ...
}

So on AST2700 priv->mii_bus is always NULL, and ftgmac100_mii_probe()
returns before it gets to the new check:

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_mii_probe() {
    ...
	if (!priv->mii_bus) {
		dev_err(priv->dev, "No MDIO bus available\n");
		return -ENODEV;
	}
    ...
}

That would mean the "phy-mode is required for this SoC" message is never
printed, and the patch has no effect at runtime.

The commit message also says:

  The driver currently defaults to RGMII when the "phy-mode" property
  is missing from the device tree.

Is that accurate for AST2700? These are the probe paths in
ftgmac100_probe_dt():

  - use-ncsi: ftgmac100_probe_ncsi() hard-codes PHY_INTERFACE_MODE_RMII.
  - phy-handle / fixed-link: of_phy_get_and_connect() calls
    of_get_phy_mode() itself and returns NULL if phy-mode is missing, so
    probe already fails with "Failed to connect to phy".
  - no "mdio" child: stops at the mii_bus check above.

None of these paths reach the RGMII fallback.

The binding patch in this series ("dt-bindings: net: ftgmac100: Add
AST2700 compatible") says its required phy-mode matches the driver's
probe-time requirement, but this check doesn't seem to provide that.

The later patches in the series ("net: ftgmac100: Add AST2700 upper DMA
address support", "net: ftgmac100: Allow building on ARM64") don't touch
ftgmac100_mii_probe() or ftgmac100_probe_dt(). The check would still be
unreachable at the end of the series.

Would it make more sense to put this check on a path AST2700 actually
takes, for example at the top of ftgmac100_probe_dt()?

[Severity: High]
Apart from the reachability question above, some AST2700 probe paths
still succeed without phy-mode and never read it.

If the node has an "mdio" child but no phy-handle, fixed-link or
use-ncsi, ftgmac100_probe_dt() skips the legacy block and returns 0 with
no PHY attached:

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_probe_dt() {
    ...
	if (!ftgmac100_has_child_node(np, "mdio")) {
		...
		err = ftgmac100_mii_probe(netdev);
		...
	}

	return 0;
}

The use-ncsi path also connects the fixed PHY with a hard-coded
PHY_INTERFACE_MODE_RMII and ignores phy-mode.

In the mdio-child case, netdev->phydev is still NULL after a successful
probe. Could opening the interface then oops in
ftgmac100_reset_and_config_mac()?

drivers/net/ethernet/faraday/ftgmac100.c:ftgmac100_reset_and_config_mac() {
    ...
	if (priv->is_aspeed && priv->netdev->phydev->interface == PHY_INTERFACE_MODE_RMII) {
    ...
}

ftgmac100_start_hw() has the same kind of unchecked dereference through
the RMII quirk:

	if ((priv->quirks & FTGMAC100_QUIRK_RMII_ENABLE) &&
	    phydev->interface == PHY_INTERFACE_MODE_RMII) {

This would happen through ftgmac100_open()->ftgmac100_reset_and_config_mac(),
whether or not the DT has phy-mode. It also contradicts the claim in
"net: ftgmac100: Enable AST2700 RMII support" that ftgmac100_probe_dt()
always attaches a phy_device.

The dereference in ftgmac100_reset_and_config_mac() already existed for
AST2600 (since af350ee72e9dda). Earlier patches in this series make it
reachable on AST2700.

Should the phy-mode check go at the top of ftgmac100_probe_dt() (or in
ftgmac100_probe()), before the branching, instead of in the legacy
MDIO-scan helper?

[Severity: Low]
This isn't a bug, but the binding and the driver disagree on the NC-SI
path. "dt-bindings: net: ftgmac100: Add AST2700 compatible" requires
phy-mode for every aspeed,ast2700-mac node, including use-ncsi nodes:

  - if:
      properties:
        compatible:
          contains:
            const: aspeed,ast2700-mac
    then:
      required:
        - phy-mode

ftgmac100_probe_dt() hands off to ftgmac100_probe_ncsi() as soon as
use-ncsi is present, and that path connects with a fixed RMII mode:

	err = phy_connect_direct(netdev, phydev, ftgmac100_adjust_link,
				 PHY_INTERFACE_MODE_RMII);

An NC-SI node with phy-mode = "rgmii" would pass schema validation, but
the value is silently ignored. ftgmac100_start_hw() would still set
FTGMAC100_MACCR_RMII_ENABLE.

Should the binding exempt use-ncsi nodes, or should the driver check
phy-mode against RMII on that path?

>  
>  	/* Aspeed only supports these. I don't know about other IP
>  	 * block vendors so I'm going to just let them through for

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-support_ast2700-v6-0-238020bf46cf%40aspeedtech.com
Technical Details
Message-ID: <179483726032.3136.17044396273720911557@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364371-linux-kernel-netdev=dewy.ru
References: <20261112-support_ast2700-v6-5-238020bf46cf@aspeedtech.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364371-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v6 5/7] net: ftgmac100: Require phy-mode for AST2700
Date: Mon, 16 Nov 2026 13:54:20 +0000
Organization: Usenet Network
Message-ID: <179483726032.3136.17044396273720911557@kernel.org>
References: <20261112-support_ast2700-v6-5-238020bf46cf@aspeedtech.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2077977"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nFSofg5KIrhF2uqbx+bfakhMEPE= sha256:EVZhwBolDcJd9IFHbNWWCwNC+H+9SjVDFjN11rSInec=
	sha1:sk+uwLxet+EZhGkL3shMj6/arms= sha256:2WTiEq/SY0sd+tU24wQBy2TCa9xDd186OZO6pbRfe/Y=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 645A3114C3F; Mon, 16 Nov 2026 16:55:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.3
X-Spam-Status: No, score=-2.3 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001,
	DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id LgQF3yM8apir;
	Mon, 16 Nov 2026 16:55:00 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364371-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 5B5B9114C44; Mon, 16 Nov 2026 16:54:51 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 1F86233112; Mon, 16 Nov 2026 13:54:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794837262;
	b=lvMUvCmoBoBoObRNUuI05dYW5LwoXS6+Hsce/QGMAgjaHt7orrCVUedS+C3N4jukn7A2
	 54Of7R5q6+/xhGemT7d2N5a1U9H3ax4Cuo3egKAIR4sSbp+0qgVQ4G1jpLcHNom8w1nNP
	 DpmZhb26csBXTRTXowPkrL+ItEZMn8z7r0AAbiW0fBJe97E0QdNc2bpq9DdlAzEkbUsg7
	 pTH6gZ72c5A9gCQSQgDXzgxUdXzouY+3oc0Pr72QXDDg4HAep+9yM9K4aDG1GkAogxdl1
	 iPt3HG491t07eINVYpu2cj0RL/aQdcE1YtTKf+OLL12/JA3C25WrOSc+iLRIderd/Yg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794837262;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=P+N7AP+jMXptUY2cqeMwvnQE+TWjN2dvZ/FJTtPhFl8=;
	b=IXKrSvhntMYhlQCJ+5LDGRes74JcI2AITxHOKQvjklSY7XSx0BN0niZJaAYbmvMIDgCS
	 pB+bJDMn4VEMaI0HfUroRdVLE+q2KESOtTSizkMgpjOmu0EReZKGCTg3NTZH0jPCPI4qA
	 ej1mIWAY40NPRLIu/yvjiTfpd/yYIpLPLwS+n9Z9Sar1our6KpjGGE6sX8bJ2ld+2pEEs
	 PC8OkPZfSFoW4gwNemYt6RyLamQ7Bw07opM4RymiLaPj/qNK3QYRBUyvguy+yOF/uWRdZ
	 UkXtB0EKdBZrAmWZZNV3KQx7p80+p6g45APHC1YNCdMID82hB5Yu4Z3ef2sp5j88gxg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bv7f9cJL;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A72B2606A889;
	Mon, 16 Nov 2026 13:54:22 +0000 (UTC)
X-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=bv7f9cJL
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794837261;
	b=23iQkpgcWBzP4bJ0GNHsnlk8Y5Em3VddgDBba/0kKlRhGdZjjyl1+CiRBtKPnWOj10Ya
	 xL5htOkg6eLkpDaDNMlg1zC+gNdGJIKkpA5qGz2cBlaoiTRFtAeswBP0e4wwvOoLz7WWQ
	 QNjh1ntw3HBQ0KGN4bby1iiqAkuGE0tZEMtGqU3UxGK6GSIjvNOtbPJMsnEa5v/eJ2GH1
	 9AXPrP0HZOMMB8KBwS5JrHtZkCwyIlCywHJRahAOEMvyVK2XrKaCctsLyVRclcTwCv2Xa
	 dnzXapSnCDYCePffInIYG1xIrZtLBvZ8DMpUHNFPfbZ/HfLlK+aBLVeLWB0QamLxa3Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794837261;
	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=P+N7AP+jMXptUY2cqeMwvnQE+TWjN2dvZ/FJTtPhFl8=;
	b=zA3aFzV1f2/zZZdKQC6qABCxJ7mjDcphZ4Ui6YJGYuByqPdnMJX4TSFESEhseT6NZ3DY
	 6Cbi23NDacUKqZ0WI00UvUDthf83jJEFePvBmhOPWtbD73kZ6Iuk2lFh5xSB0ZgQuqt+k
	 DbuIpDVaetJsdHFedqoYR+XdjMG40vcRM37Nd9hHG+p9LFKyaIOnfz5yAl9rA14waVQeH
	 iNpbV/Q6w1uT0RlbPCCkreCHS0ajNlABkwkR0O16zxgL3RNgnmMiklqbjHs/l4oSrNsw3
	 uXX8SZMcaX+fYCE+MK9KXvkohVg3UfzfzS/1z2wo8VY/HT4qVThcNX9vmt48ZUlO13w==
X-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=bv7f9cJL;
	arc=none smtp.remote-ip=100.103.45.18
X-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 C620F606A8A8;
	Mon, 16 Nov 2026 13:54:21 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFE761F000C6;
	Mon, 16 Nov 2026 13:54:20 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794837261;
	bh=P+N7AP+jMXptUY2cqeMwvnQE+TWjN2dvZ/FJTtPhFl8=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=bv7f9cJLbc/hytJRaPq6I/D24euOPIzMAZSDCd5fWteFagDQk8Ni6wriGFkmMURC+
	 2HUPpSz0C0AMi1xAvPIKo+pdTTMSnXsLbfEbNVuxuVMZM6C85z+osPL8ewbkK/17n9
	 o58q6X4FoP7AUASRT+BISCNVQl1AnxJcq/J+lSkQ/XIlSn+MnTwXMznQsjlviY47Ul
	 34qqvWG60S39OdHMa917c2D3JWWQZdU5imfBElaKCUvELg6QE6vftuSaPScdhlbUSW
	 vKWNHGUtCRgS/V7fiNho9w28ROWscGbohzIngE0RcDDQy7xF4201zcrGf+aDWACqdi
	 VpNjLOxoQNdDA==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org,
 pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
 ratbert@faraday-tech.com, edumazet@kernel.org, hkallweit1@gmail.com,
 linux@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org,
 linux-kernel@vger.kernel.org, andrew@lunn.ch
X-In-Reply-To: <20261112-support_ast2700-v6-5-238020bf46cf@aspeedtech.com>
X-sashiko-severity: High
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list