[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260116-ftgmac-cleanup-v2-9-81f41f01f2a8@aspeedtech.com>
Date: Fri, 16 Jan 2026 10:09:20 +0800
From: Jacky Chou <jacky_chou@...eedtech.com>
To: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Andrew Lunn
<andrew@...n.ch>, Jacky Chou <jacky_chou@...eedtech.com>, Simon Horman
<horms@...nel.org>
Subject: [PATCH net-next v2 09/15] net: ftgmac100: Always register the MDIO
bus when it exists
From: Andrew Lunn <andrew@...n.ch>
Both the Aspeed 2400 and 2500 and the original faraday version of the
MAC have MDIO bus controllers as part of the MAC. Since it exists,
always registering it makes the code simpler, and causes no harm. If
there is no mdio node in device tree, of_mdiobus_register() will fall
back to mdiobus_register(), making it safe.
Signed-off-by: Andrew Lunn <andrew@...n.ch>
Reviewed-by: Simon Horman <horms@...nel.org>
Signed-off-by: Jacky Chou <jacky_chou@...eedtech.com>
---
drivers/net/ethernet/faraday/ftgmac100.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index f1cb5dc37919..931fdf3d07d1 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1957,6 +1957,14 @@ static int ftgmac100_probe(struct platform_device *pdev)
priv->txdes0_edotr_mask = BIT(15);
}
+ if (priv->mac_id == FTGMAC100_FARADAY ||
+ priv->mac_id == FTGMAC100_AST2400 ||
+ priv->mac_id == FTGMAC100_AST2500) {
+ err = ftgmac100_setup_mdio(netdev);
+ if (err)
+ goto err_phy_connect;
+ }
+
if (np && of_get_property(np, "use-ncsi", NULL)) {
err = ftgmac100_probe_ncsi(netdev, priv, pdev);
if (err)
@@ -1965,18 +1973,6 @@ static int ftgmac100_probe(struct platform_device *pdev)
of_get_property(np, "phy-handle", NULL))) {
struct phy_device *phy;
- /* Support "mdio"/"phy" child nodes for ast2400/2500 with
- * an embedded MDIO controller. Automatically scan the DTS for
- * available PHYs and register them.
- */
- if (of_get_property(np, "phy-handle", NULL) &&
- (priv->mac_id == FTGMAC100_AST2400 ||
- priv->mac_id == FTGMAC100_AST2500)) {
- err = ftgmac100_setup_mdio(netdev);
- if (err)
- goto err_setup_mdio;
- }
-
phy = of_phy_get_and_connect(priv->netdev, np,
&ftgmac100_adjust_link);
if (!phy) {
@@ -1999,9 +1995,6 @@ static int ftgmac100_probe(struct platform_device *pdev)
* PHYs.
*/
priv->use_ncsi = false;
- err = ftgmac100_setup_mdio(netdev);
- if (err)
- goto err_setup_mdio;
err = ftgmac100_mii_probe(netdev);
if (err) {
--
2.34.1
Powered by blists - more mailing lists