From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC19A275114; Mon, 5 Jan 2026 07:09:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596944; cv=none; b=StgDdUcsCbdv1eEtkzrZGgl5oShriZdpI0C1N2mIF1q87805BrZajVxfN/ORGTZ9+V2JIpHVeS/5scWHfYv4VPtUdk/q9IA4bFsomsksUWwBhvTWZE4cK79/E4hR40Apl/grQKV7gzYfbau7QyVulUu5+fFYR/w7UiIag2AP2x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596944; c=relaxed/simple; bh=mJ//JkS8YYCrioy41HdvvrSy2ueQUViG0J+y0omw7Rc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=MZGUPNFOYZxKudU6txlZpNMoDWV3taFdlt0yDYMeJEVNi5lnlNXMuq12SEDHEdKEsafAf7QJGyR1a1+zXhAtdc0nmhb/3JtE1mdnFaLx0N/4hYF1fOyFwxQuUIo2BsnpfhOtfdSzS07ILPgSnbL3ZE4hmvJkHATAIz+zMpQU1pc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:51 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:51 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:47 +0800 Subject: [PATCH 01/15] net: ftgmac100: List all compatibles Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-1-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=866; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=XvDL98JqW5k7R/sE+lXeDV1NIQS3w8ImXfoQEwHpsEo=; b=G68c3LYLm/ThUu2PXWfijPICrdeIGYVpW4SU6VGM6l9bLWEhZc8Cdkbl8Vm6ox+5n9K2OwQDP wV/swGZPoGcCTUSE9ukGa1ceoUt+cjGIdGBUPAbbG1z52VDlVqLWup8 X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn As a step towards cleanup the probe function, list each compatible the driver supports. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index a863f7841210..bd768a93b9e6 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2091,6 +2091,9 @@ static void ftgmac100_remove(struct platform_device *= pdev) } =20 static const struct of_device_id ftgmac100_of_match[] =3D { + { .compatible =3D "aspeed,ast2400-mac" }, + { .compatible =3D "aspeed,ast2500-mac" }, + { .compatible =3D "aspeed,ast2600-mac" }, { .compatible =3D "faraday,ftgmac100" }, { } }; --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02AAA2773C3; Mon, 5 Jan 2026 07:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596946; cv=none; b=cIcy11oJ0RCD6Tg4oN8vuaGfqrcUKMhSE/mRJK7Oxk/aXKeUGIWeyHaaduDx1LZLa9WBRZ34tWS2B3TMfiEXJ1623dn7mOBHeVW7wBV+vO4M/xKFALjywTqm5fC7SANL01Krxzoxc9wuAFMyQM6L3OvSZXgpt1RHh09cpP2O5VA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596946; c=relaxed/simple; bh=TFwDYAPellY1IpTmI7p0DLVaTHvIQ4B25wHhn88l9XE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=e1joB9IiL56206DsUKIDkChRPYTc5yqg24hXzxSeY56wWlAbtgwo85kEqDDWBkfRyxklYt9KKIA5DxGMBNY7JVIccqgAPbUQZ4X0UOPPwpwrx6iC3w3Qm/UtKBDhYS2iKIWG1cFHtKCETuKGkdMORrG3PbtsuC2hq/fJudO7M5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:51 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:51 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:48 +0800 Subject: [PATCH 02/15] net: ftgmac100: Add match data containing MAC ID Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-2-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=3947; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=3BeU7vbBnZkj5kypQgD6Ipnbbn98fDpR9l9IcTIQnYU=; b=R00kfzB57mavd/YCIX2m88ezbA4IPLoDwa6JYyOy+FH5ng2RPVqtcETZ4uVbajspyl93xXA2E b/zqeRbmqW4BPUG4bBLRxPjvMVKiWwUzQraW5JYOTEPwzxPYPcUkTaq X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn The driver supports 4 different versions of the FTGMAC core. Extend the compatible matching to include match data, which indicates the version of the MAC. Default to the initial Faraday device if DT is not being used. Lookup the match data early in probe to keep error handing simple. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 55 ++++++++++++++++++++++++++++= +--- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index bd768a93b9e6..104eb7b1f5bb 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -33,6 +33,17 @@ =20 #define DRV_NAME "ftgmac100" =20 +enum ftgmac100_mac_id { + FTGMAC100_FARADAY =3D 1, + FTGMAC100_AST2400, + FTGMAC100_AST2500, + FTGMAC100_AST2600 +}; + +struct ftgmac100_match_data { + enum ftgmac100_mac_id mac_id; +}; + /* Arbitrary values, I am not sure the HW has limits */ #define MAX_RX_QUEUE_ENTRIES 1024 #define MAX_TX_QUEUE_ENTRIES 1024 @@ -66,6 +77,8 @@ struct ftgmac100 { struct resource *res; void __iomem *base; =20 + enum ftgmac100_mac_id mac_id; + /* Rx ring */ unsigned int rx_q_entries; struct ftgmac100_rxdes *rxdes; @@ -1835,6 +1848,8 @@ static bool ftgmac100_has_child_node(struct device_no= de *np, const char *name) =20 static int ftgmac100_probe(struct platform_device *pdev) { + const struct ftgmac100_match_data *match_data; + enum ftgmac100_mac_id mac_id; struct resource *res; int irq; struct net_device *netdev; @@ -1843,6 +1858,16 @@ static int ftgmac100_probe(struct platform_device *p= dev) struct device_node *np; int err =3D 0; =20 + np =3D pdev->dev.of_node; + if (np) { + match_data =3D of_device_get_match_data(&pdev->dev); + if (!match_data) + return -EINVAL; + mac_id =3D match_data->mac_id; + } else { + mac_id =3D FTGMAC100_FARADAY; + } + res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENXIO; @@ -1870,6 +1895,7 @@ static int ftgmac100_probe(struct platform_device *pd= ev) priv =3D netdev_priv(netdev); priv->netdev =3D netdev; priv->dev =3D &pdev->dev; + priv->mac_id =3D mac_id; INIT_WORK(&priv->reset_task, ftgmac100_reset_task); =20 /* map io memory */ @@ -1900,7 +1926,6 @@ static int ftgmac100_probe(struct platform_device *pd= ev) if (err) goto err_phy_connect; =20 - np =3D pdev->dev.of_node; if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac") || of_device_is_compatible(np, "aspeed,ast2500-mac") || of_device_is_compatible(np, "aspeed,ast2600-mac"))) { @@ -2090,11 +2115,31 @@ static void ftgmac100_remove(struct platform_device= *pdev) free_netdev(netdev); } =20 +static const struct ftgmac100_match_data ftgmac100_match_data_ast2400 =3D { + .mac_id =3D FTGMAC100_AST2400 +}; + +static const struct ftgmac100_match_data ftgmac100_match_data_ast2500 =3D { + .mac_id =3D FTGMAC100_AST2500 +}; + +static const struct ftgmac100_match_data ftgmac100_match_data_ast2600 =3D { + .mac_id =3D FTGMAC100_AST2600 +}; + +static const struct ftgmac100_match_data ftgmac100_match_data_faraday =3D { + .mac_id =3D FTGMAC100_FARADAY +}; + static const struct of_device_id ftgmac100_of_match[] =3D { - { .compatible =3D "aspeed,ast2400-mac" }, - { .compatible =3D "aspeed,ast2500-mac" }, - { .compatible =3D "aspeed,ast2600-mac" }, - { .compatible =3D "faraday,ftgmac100" }, + { .compatible =3D "aspeed,ast2400-mac", + .data =3D &ftgmac100_match_data_ast2400}, + { .compatible =3D "aspeed,ast2500-mac", + .data =3D &ftgmac100_match_data_ast2500 }, + { .compatible =3D "aspeed,ast2600-mac", + .data =3D &ftgmac100_match_data_ast2600 }, + { .compatible =3D "faraday,ftgmac100", + .data =3D &ftgmac100_match_data_faraday }, { } }; MODULE_DEVICE_TABLE(of, ftgmac100_of_match); --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7BDF29D267; Mon, 5 Jan 2026 07:09:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596948; cv=none; b=u9CATXajnT/8mOmqgIyxFLqB6W9sxMG/xe8HSJEwpLlCGFubE+ssKZjyXK9xM8FaP2KnGEy57cxAfTUyE2A7I6SSuTw2YKZmASQ5tYVuITBRo4ygmrodXuwhHXH4aAX0GrSwddJIQ5906JXlr/JVpgK6oPwfC6/7SzqafCBtoN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596948; c=relaxed/simple; bh=aeNbxYQZhKF93/cS/Wo89mQZiV8r+9sEAyrcYYIYDBo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=o82XxhMEIyuoc8zVXIbclKX30vG1zmYKY6szJoktEO/55AZjVyDX7BB24+c2ED5nEa+x817aSV2mjGneAstnNHoiPQG2EZcm4j4X9JT46xestKrh0klJ0mpZUam4V+DEs/+ZC5GBfBdWhQemkA7vkZBAzKWmbYGvenasa/SXjb8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:51 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:51 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:49 +0800 Subject: [PATCH 03/15] net: ftgmac100: Replace all of_device_is_compatible() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-3-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=3084; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=UJLsdwLt7T2hWvC9KboP2Moda6q3Gub6OhFwobFTWb4=; b=fLC8wEYoJOfVzBHWdeJtodj7aHFAF2omdGCrRA8TZoGjs5jWkDPn0Jp9uHMIEUCaCXa3XmHpq y6xZgaU2na7DnollNtTeM4My/NQ/Gce0qhF+9WsMUj8p7HdISG8lD1V X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn Now that the priv structure includes the MAC ID, make use of it instead of the more expensive of_device_is_compatible(). Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 104eb7b1f5bb..f07167cabf39 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1720,8 +1720,8 @@ static int ftgmac100_setup_mdio(struct net_device *ne= tdev) if (!priv->mii_bus) return -EIO; =20 - if (of_device_is_compatible(np, "aspeed,ast2400-mac") || - of_device_is_compatible(np, "aspeed,ast2500-mac")) { + if (priv->mac_id =3D=3D FTGMAC100_AST2400 || + priv->mac_id =3D=3D FTGMAC100_AST2500) { /* The AST2600 has a separate MDIO controller */ =20 /* For the AST2400 and AST2500 this driver only supports the @@ -1926,9 +1926,9 @@ static int ftgmac100_probe(struct platform_device *pd= ev) if (err) goto err_phy_connect; =20 - if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac") || - of_device_is_compatible(np, "aspeed,ast2500-mac") || - of_device_is_compatible(np, "aspeed,ast2600-mac"))) { + if (priv->mac_id =3D=3D FTGMAC100_AST2400 || + priv->mac_id =3D=3D FTGMAC100_AST2500 || + priv->mac_id =3D=3D FTGMAC100_AST2600) { priv->rxdes0_edorr_mask =3D BIT(30); priv->txdes0_edotr_mask =3D BIT(30); priv->is_aspeed =3D true; @@ -1973,8 +1973,8 @@ static int ftgmac100_probe(struct platform_device *pd= ev) * available PHYs and register them. */ if (of_get_property(np, "phy-handle", NULL) && - (of_device_is_compatible(np, "aspeed,ast2400-mac") || - of_device_is_compatible(np, "aspeed,ast2500-mac"))) { + (priv->mac_id =3D=3D FTGMAC100_AST2400 || + priv->mac_id =3D=3D FTGMAC100_AST2500)) { err =3D ftgmac100_setup_mdio(netdev); if (err) goto err_setup_mdio; @@ -2026,7 +2026,7 @@ static int ftgmac100_probe(struct platform_device *pd= ev) goto err_phy_connect; =20 /* Disable ast2600 problematic HW arbitration */ - if (of_device_is_compatible(np, "aspeed,ast2600-mac")) + if (priv->mac_id =3D=3D FTGMAC100_AST2600) iowrite32(FTGMAC100_TM_DEFAULT, priv->base + FTGMAC100_OFFSET_TM); } @@ -2044,11 +2044,11 @@ static int ftgmac100_probe(struct platform_device *= pdev) netdev->hw_features |=3D NETIF_F_HW_VLAN_CTAG_FILTER; =20 /* AST2400 doesn't have working HW checksum generation */ - if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac"))) + if (priv->mac_id =3D=3D FTGMAC100_AST2400) netdev->hw_features &=3D ~NETIF_F_HW_CSUM; =20 /* AST2600 tx checksum with NCSI is broken */ - if (priv->use_ncsi && of_device_is_compatible(np, "aspeed,ast2600-mac")) + if (priv->use_ncsi && priv->mac_id =3D=3D FTGMAC100_AST2600) netdev->hw_features &=3D ~NETIF_F_HW_CSUM; =20 if (np && of_get_property(np, "no-hw-checksum", NULL)) --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08DFD278E63; Mon, 5 Jan 2026 07:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596950; cv=none; b=eXOA8Au1i0KzTmZyNpg5jubLLu5JAkamc/ukMo06HEWo6hD34X0uRaJghoJ00ItGyiFm/XJ4BoDKE5bk2yySpp4/QymwNDCTx4q9C99+jHj52cy8fQTVQtgvl8VMlpWU834PGaFJY0jClwJZPdxuRXBB0dwAvKE3O6aQojefPuo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596950; c=relaxed/simple; bh=63sVwmCH/6GQ2E59FppAMc1NRGFlUBtTRRXIYDSIAA0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=TmRL+UF70tGB0Q2A30F4Nb/DMkZ1YocTFoxkK6rZ2oylEe5jDpxrFmn5pmKQywYworIIUd+4SV2WrEf4afn0dDyUzA4owrSAPTEjRZ2zEPOtH6gWVjvEMbNkGnLu+Siu8rvp/ag4uNVG8mJLZoej11uhLz3CsgzVw/7fux386F8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:52 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:52 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:50 +0800 Subject: [PATCH 04/15] net: ftgmac100: Use devm_alloc_etherdev() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-4-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=1349; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=leJVgbrD0sM0+ZukF10sL2Nm8AnYmSFmz94rAlmrd8k=; b=b0l2jMEabc9Ws6DxQ4tJV5tPalpJBWgaqGEFKWCEM71KRlRpAErGogK7iadUso62eTIpGUFPk UV0GJyUUQVnDvk2a8lh56WbdlyEGO/lCOblpa6pmQj1a0SjHmy6SPe+ X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn Make use of devm_alloc_etherdev() to simplify cleanup. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index f07167cabf39..75c7ab43e7e9 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1877,10 +1877,9 @@ static int ftgmac100_probe(struct platform_device *p= dev) return irq; =20 /* setup net_device */ - netdev =3D alloc_etherdev(sizeof(*priv)); + netdev =3D devm_alloc_etherdev(&pdev->dev, sizeof(*priv)); if (!netdev) { - err =3D -ENOMEM; - goto err_alloc_etherdev; + return -ENOMEM; } =20 SET_NETDEV_DEV(netdev, &pdev->dev); @@ -2080,8 +2079,6 @@ static int ftgmac100_probe(struct platform_device *pd= ev) err_ioremap: release_resource(priv->res); err_req_mem: - free_netdev(netdev); -err_alloc_etherdev: return err; } =20 @@ -2112,7 +2109,6 @@ static void ftgmac100_remove(struct platform_device *= pdev) release_resource(priv->res); =20 netif_napi_del(&priv->napi); - free_netdev(netdev); } =20 static const struct ftgmac100_match_data ftgmac100_match_data_ast2400 =3D { --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20E892D6624; Mon, 5 Jan 2026 07:09:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596953; cv=none; b=ZiuFZ7FHLArGpC+brYiZqLdFaOFyCG6VJkNrdII0FPfnBw7rFGCjhq4jsdKVIk0FecX7DPKV+NKMIAxaU2L2Wmu5d9T/fUEm9wGQmXTXD063/0LJPSMtNhAah9eZLOvJ4NLyA1XxPlO+gb2XMiMMuuNeOZNFB9hjVEVYXm7sSKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596953; c=relaxed/simple; bh=eEr+uM5vvxZ541jxelgE7V5Ie2nLwqMUcKYDSddDAtg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=TKT0NI+iOafTDz165P3SgjDLW7xQYhb4f+SLW9B0EkUh7e/Hxann6JdImjZNK0mMTC5vMqNWUmHr1tf8cz4aGEX6qSEqaAdaBIV098IWlf/+4wSg/4I9kARQLDRTioy8rZQ/H25uP750PeTw+hwitqooUo01NxxctR6DtGZrs4I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:52 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:52 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:51 +0800 Subject: [PATCH 05/15] net: ftgmac100: Use devm_request_memory_region/devm_ioremap Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-5-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=1951; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=X4ifaGbvFBJZb8lE1fJWWlYBPPVj5TIu19iwHqOwH0A=; b=0BLXwbd6NADaT5092oijtRabW2nd6wnVEYEObcVznYBx5C6oSJjWjt8X4bcx0Xd2AzkzdK5xt cce4cDsZiwvCkTEKlzuJl+hQhgdwa6TLYbp9Uy3Au8ggj1sz2cKe7F0 X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn Make use of devm_ methods to request and remap the device memory to simplify cleanup. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 75c7ab43e7e9..c23d5d675c5f 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1898,19 +1898,18 @@ static int ftgmac100_probe(struct platform_device *= pdev) INIT_WORK(&priv->reset_task, ftgmac100_reset_task); =20 /* map io memory */ - priv->res =3D request_mem_region(res->start, resource_size(res), - dev_name(&pdev->dev)); + priv->res =3D devm_request_mem_region(&pdev->dev, + res->start, resource_size(res), + dev_name(&pdev->dev)); if (!priv->res) { dev_err(&pdev->dev, "Could not reserve memory region\n"); - err =3D -ENOMEM; - goto err_req_mem; + return -ENOMEM; } =20 - priv->base =3D ioremap(res->start, resource_size(res)); + priv->base =3D devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (!priv->base) { dev_err(&pdev->dev, "Failed to ioremap ethernet registers\n"); - err =3D -EIO; - goto err_ioremap; + return -EIO; } =20 netdev->irq =3D irq; @@ -2075,10 +2074,6 @@ static int ftgmac100_probe(struct platform_device *p= dev) ncsi_unregister_dev(priv->ndev); ftgmac100_destroy_mdio(netdev); err_setup_mdio: - iounmap(priv->base); -err_ioremap: - release_resource(priv->res); -err_req_mem: return err; } =20 @@ -2105,9 +2100,6 @@ static void ftgmac100_remove(struct platform_device *= pdev) ftgmac100_phy_disconnect(netdev); ftgmac100_destroy_mdio(netdev); =20 - iounmap(priv->base); - release_resource(priv->res); - netif_napi_del(&priv->napi); } =20 --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 624542D6E74; Mon, 5 Jan 2026 07:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596955; cv=none; b=KdrT0HOgh/H892qSEJnn4Mdi+Drm/gXH9im1wJS0Xz7Jk9xMGR2bw1luVJCAYV4MTq1712US154XSTgSsWAiIofphcIzlC3jaj1M8BuBlWxmj610GKRwFOfy4ytU1O5sIFvhG079Tu9pETKfpp6qojgzPsT9wjAKZv+rnclN0AM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596955; c=relaxed/simple; bh=zKiDlGZhvRD4Q58rdnqreaNgsabL/Rc4LTDfiIWKAHk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=cFlKJ1fkl4cAmaKq2+EclTT2GYGY+T4zN0OLNj3W83A+RYTM2Xm2fU9uehcv1Zcoss8neP9QvHYer+a2VewJNezMj/QVyzsqI5a6hO/auBG3E4QSXJFUGU5L12XcGYb/1uKhHObx/LBulol2TC5UoHm4wJp516KtTk2NcqAp56I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:52 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:52 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:52 +0800 Subject: [PATCH 06/15] net: ftgmac100: Use devm_clk_get_enabled Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-6-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=2486; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=ZiFClAo6vNHqEPGbdzZcGUaqYyr6ia0x7kl4IA1ulNI=; b=1Dl9+t2FEvbVoH3Bcg01DilQDw8TKd4Zp5BWWgaKoi/6fpxymvy8SzrNKkmb+68qKRmeT4dhH PcNruC+SkS+AXny1aCaKlKhhSEC8zc18cD/9HYgskDNjDuLuQppCRkc X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn Make use of devm_ methods to request and enable clocks to simplify cleanup. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index c23d5d675c5f..3972076ffcf6 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1801,13 +1801,10 @@ static int ftgmac100_setup_clk(struct ftgmac100 *pr= iv) struct clk *clk; int rc; =20 - clk =3D devm_clk_get(priv->dev, NULL /* MACCLK */); + clk =3D devm_clk_get_enabled(priv->dev, NULL /* MACCLK */); if (IS_ERR(clk)) return PTR_ERR(clk); priv->clk =3D clk; - rc =3D clk_prepare_enable(priv->clk); - if (rc) - return rc; =20 /* Aspeed specifies a 100MHz clock is required for up to * 1000Mbit link speeds. As NCSI is limited to 100Mbit, 25MHz @@ -1816,21 +1813,15 @@ static int ftgmac100_setup_clk(struct ftgmac100 *pr= iv) rc =3D clk_set_rate(priv->clk, priv->use_ncsi ? FTGMAC_25MHZ : FTGMAC_100MHZ); if (rc) - goto cleanup_clk; + return rc; =20 /* RCLK is for RMII, typically used for NCSI. Optional because it's not * necessary if it's the AST2400 MAC, or the MAC is configured for * RGMII, or the controller is not an ASPEED-based controller. */ - priv->rclk =3D devm_clk_get_optional(priv->dev, "RCLK"); - rc =3D clk_prepare_enable(priv->rclk); - if (!rc) - return 0; + priv->rclk =3D devm_clk_get_optional_enabled(priv->dev, "RCLK"); =20 -cleanup_clk: - clk_disable_unprepare(priv->clk); - - return rc; + return 0; } =20 static bool ftgmac100_has_child_node(struct device_node *np, const char *n= ame) @@ -2065,8 +2056,6 @@ static int ftgmac100_probe(struct platform_device *pd= ev) return 0; =20 err_register_netdev: - clk_disable_unprepare(priv->rclk); - clk_disable_unprepare(priv->clk); err_phy_connect: ftgmac100_phy_disconnect(netdev); err_ncsi_dev: @@ -2089,9 +2078,6 @@ static void ftgmac100_remove(struct platform_device *= pdev) ncsi_unregister_dev(priv->ndev); unregister_netdev(netdev); =20 - clk_disable_unprepare(priv->rclk); - clk_disable_unprepare(priv->clk); - /* There's a small chance the reset task will have been re-queued, * during stop, make sure it's gone before we free the structure. */ --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A9042D7DF5; Mon, 5 Jan 2026 07:09:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596957; cv=none; b=akwtoVqkd+5/v8Tw6gSHL3Ynhe2cDLliI/VyFpWKZiPTo0WQWBma3K0i0I7bahaPYi4zL+tP8KsKfxmzf6XI/0nJFRBL6J4p9N4AVUqw3P7M6XSFEnrPo0zny6D9Jeg+x2bBBejBI1SpF6ohynWvb275F7fO6hbw+OC1kzDBQ30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596957; c=relaxed/simple; bh=z//e7dnJwDUefg9plCWZ1BC4LS+uCzdCRIPDrD9AN10=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=e84zwyG+7Qs2lIj46D8ZU0IVXy2ovoZuQGelReNvS88vrqKLA55R6OyRCkJSWT7lJfzx09n7eyp6hkEUMO2ZBj+1XmBdQTHp+nBPvp/vtHjUTfTBFrvXqsH53SNnKhvRxyYBU75iwlaLZ1WdcgYGJUJJRzTtd5H6KHVgyyfKf6A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:52 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:52 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:53 +0800 Subject: [PATCH 07/15] net: ftgmac100: Simplify error handling for ftgmac100_initial_mac Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-7-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=959; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=mJWTzLOf+0tWdMKdPoK0MzjDkxQF4h6Ohksflvry0uo=; b=Cdci9LfWLkkcIr9oTGnOLZCMs20vbUOHxeA53qgd+8/KitN0mJqna2EQJRFBba+ayc0YzecCM qVLeyX/La9TBmCB6eg8ljOjpQJciQlCwIgwHVHp5Sv+S/1PWZdo2xCP X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn ftgmac100_initial_mac() does not allocate any resources. All resources by the probe function up until this call point use devm_ methods. So just return the error code rather than use a goto. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 3972076ffcf6..df030d85b3ce 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1913,7 +1913,7 @@ static int ftgmac100_probe(struct platform_device *pd= ev) /* MAC address from chip or random one */ err =3D ftgmac100_initial_mac(priv); if (err) - goto err_phy_connect; + return err; =20 if (priv->mac_id =3D=3D FTGMAC100_AST2400 || priv->mac_id =3D=3D FTGMAC100_AST2500 || --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DBC12D7DF7; Mon, 5 Jan 2026 07:09:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596959; cv=none; b=uKmrbBUeSj8wFyuQeAfqVzw1kCq8+tlyYljimTxug6RpEQ/ihH2loX0gYjg5Hi//Nk8vft56N9yHYcdDcLak5Iw0mXyn9SJo0HdAn/mgR/NOn4XHAqQ0NrtIB1B9TpsCePbCMRAyB21T2aycUrLxlHjDDeZeUdzcCYXX7yC7hJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596959; c=relaxed/simple; bh=7Ax7bydSHYyy2r/T97GJbQTSAsMABfrHie1jQIFrDv8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=l7o4OM+ZSNwgtvuUnAJ6QF5bc5kGRMy/jXhREyR3BYXsO/Jwqi/Ek3H3IakHEcXChnbryUd3eDHj3kZrD8VOT0zGZg4q0fHcDVC+Blyu/rAEPlIQgLfW81gtWCsIgqJHK/cu2cSlx2GRd6sHxNe4pL5IdHctxp5sBxE5cmRHOWo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:52 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:52 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:54 +0800 Subject: [PATCH 08/15] net: ftgmac100: Move NCSI probe code into a helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-8-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=3185; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=mN7mgBWTZgPILPnT/PGzERdz4wjoZqx2tWvzKp+wPZQ=; b=IrGCbfxJ5aWfKR/7HVVnoOMZYJCwQCEHlSPCtG0SmJHn80SIkPvLxg5nByD9tK78CDyGS9SBE uvn+wkFD81EDncdcV7RjOmk3jpMzzY3WPobudiCcvqEWiaTdzaRuZ2U X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn To help reduce the complexity of the probe function move the NCSI probe code into a help. No functional change intended. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 63 ++++++++++++++++++----------= ---- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index df030d85b3ce..1bdc6793e817 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1837,6 +1837,39 @@ static bool ftgmac100_has_child_node(struct device_n= ode *np, const char *name) return ret; } =20 +static int ftgmac100_probe_ncsi(struct net_device *netdev, + struct ftgmac100 *priv, + struct platform_device *pdev) +{ + struct device_node *np =3D pdev->dev.of_node; + struct phy_device *phydev; + int err; + + if (!IS_ENABLED(CONFIG_NET_NCSI)) { + dev_err(&pdev->dev, "NCSI stack not enabled\n"); + return -EINVAL; + } + + dev_info(&pdev->dev, "Using NCSI interface\n"); + priv->use_ncsi =3D true; + priv->ndev =3D ncsi_register_dev(netdev, ftgmac100_ncsi_handler); + if (!priv->ndev) + return -EINVAL; + + phydev =3D fixed_phy_register(&ncsi_phy_status, np); + if (IS_ERR(phydev)) { + dev_err(&pdev->dev, "failed to register fixed PHY device\n"); + return PTR_ERR(phydev); + } + err =3D phy_connect_direct(netdev, phydev, ftgmac100_adjust_link, + PHY_INTERFACE_MODE_RMII); + if (err) { + dev_err(&pdev->dev, "Connecting PHY failed\n"); + fixed_phy_unregister(phydev); + } + return err; +} + static int ftgmac100_probe(struct platform_device *pdev) { const struct ftgmac100_match_data *match_data; @@ -1844,7 +1877,6 @@ static int ftgmac100_probe(struct platform_device *pd= ev) struct resource *res; int irq; struct net_device *netdev; - struct phy_device *phydev; struct ftgmac100 *priv; struct device_node *np; int err =3D 0; @@ -1927,32 +1959,9 @@ static int ftgmac100_probe(struct platform_device *p= dev) } =20 if (np && of_get_property(np, "use-ncsi", NULL)) { - if (!IS_ENABLED(CONFIG_NET_NCSI)) { - dev_err(&pdev->dev, "NCSI stack not enabled\n"); - err =3D -EINVAL; - goto err_phy_connect; - } - - dev_info(&pdev->dev, "Using NCSI interface\n"); - priv->use_ncsi =3D true; - priv->ndev =3D ncsi_register_dev(netdev, ftgmac100_ncsi_handler); - if (!priv->ndev) { - err =3D -EINVAL; - goto err_phy_connect; - } - - phydev =3D fixed_phy_register(&ncsi_phy_status, np); - if (IS_ERR(phydev)) { - dev_err(&pdev->dev, "failed to register fixed PHY device\n"); - err =3D PTR_ERR(phydev); - goto err_phy_connect; - } - err =3D phy_connect_direct(netdev, phydev, ftgmac100_adjust_link, - PHY_INTERFACE_MODE_RMII); - if (err) { - dev_err(&pdev->dev, "Connecting PHY failed\n"); - goto err_phy_connect; - } + err =3D ftgmac100_probe_ncsi(netdev, priv, pdev); + if (err) + goto err_setup_mdio; } else if (np && (of_phy_is_fixed_link(np) || of_get_property(np, "phy-handle", NULL))) { struct phy_device *phy; --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BAFC2D5410; Mon, 5 Jan 2026 07:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596961; cv=none; b=JsGYkO494SuZJ+gcb53zyLFEVRlDSdAWcy/nGoYDKu03cvxYD3KI1XZwl7fFEcPHP/rGJYD2ao5+44YwSylNVS0tl38RBn9O/6nx6nb1OxSQS6mPUHJCVq8zEX2ZI9oZ5oobXSwVlwjf9Dpi2wlp9t+KHG5dpuV2s/qaahQ7YL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596961; c=relaxed/simple; bh=SOWs+5iZWnENSrRyzkpfSl7DW/3CbwKEya9ptBY6DQk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=tsma1WlQnqrqt5ZvwPw04OtDXe4C8tZ3Y88NmPZfo0qi1cjat8ewNEGmxjSUn3PDDXQAN+wzJAcszyXkn41eJVJyROlLrwS7AJskF+HCn4DnZh2ikVg+t/PJmf6FryhBb1JwKpxdp3j2vGVFOGr7tQ/03/gd05XZ5RSodmSPZzY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:52 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:52 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:55 +0800 Subject: [PATCH 09/15] net: ftgmac100: Always register the MDIO bus when it exists Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-9-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=2219; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=wOY86KFy16/fdZZiuRKZeVWVJXfvqR4ytPNJAoapJLM=; b=kD+09PBLOMPBH/WRbHW3ty3ncGp/GeSM1aVoFKmBCUD/PPA439I/M7/GgZVeIZRwGjgb73q0L 1Z7YBZEgTgxBXHA0FJHvnAN0RgG9FyjLum9J1osLRqKFBR0B43R+x8L X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn 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 Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- 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/etherne= t/faraday/ftgmac100.c index 1bdc6793e817..327e29064793 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1958,6 +1958,14 @@ static int ftgmac100_probe(struct platform_device *p= dev) priv->txdes0_edotr_mask =3D BIT(15); } =20 + if (priv->mac_id =3D=3D FTGMAC100_FARADAY || + priv->mac_id =3D=3D FTGMAC100_AST2400 || + priv->mac_id =3D=3D FTGMAC100_AST2500) { + err =3D ftgmac100_setup_mdio(netdev); + if (err) + goto err_phy_connect; + } + if (np && of_get_property(np, "use-ncsi", NULL)) { err =3D ftgmac100_probe_ncsi(netdev, priv, pdev); if (err) @@ -1966,18 +1974,6 @@ static int ftgmac100_probe(struct platform_device *p= dev) of_get_property(np, "phy-handle", NULL))) { struct phy_device *phy; =20 - /* 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 =3D=3D FTGMAC100_AST2400 || - priv->mac_id =3D=3D FTGMAC100_AST2500)) { - err =3D ftgmac100_setup_mdio(netdev); - if (err) - goto err_setup_mdio; - } - phy =3D of_phy_get_and_connect(priv->netdev, np, &ftgmac100_adjust_link); if (!phy) { @@ -2000,9 +1996,6 @@ static int ftgmac100_probe(struct platform_device *pd= ev) * PHYs. */ priv->use_ncsi =3D false; - err =3D ftgmac100_setup_mdio(netdev); - if (err) - goto err_setup_mdio; =20 err =3D ftgmac100_mii_probe(netdev); if (err) { --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 948C2274FE9; Mon, 5 Jan 2026 07:09:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596963; cv=none; b=dcnvsVFAohV8zV+gX2ANstNTXMx+qy/XgzASQ+d8pMHwxcKZPHu9N2H9PTGOMR1WlvmJlC/H86uHDE+qULDoQgJM4fZm228RP/loth+StyQ9Y8Yuk8qAHK/wmWW1eHfXfpgBdqkeAVwIU+ZKw1uYIOuVOWoDNfnTj9FSP4YnJvg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596963; c=relaxed/simple; bh=QtDQeZvDeVc4olfYKBioia/GNDEozJ5YslmVcoE1wUU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=NJuAMcrHs1p8VvTG60x5R766q06x89leCPYhzY/8df0q6mTYDHcuTVWyeG1tJsmNvtPeJrz0CdvBsCU+OXLaPNRC9t0NBWxSRr5J6b8P8OkxzAIHVPA0VrkJIToTBIh98UPpWf/E6kES3V8LkNb8FYQcuWV2NfIbnCcVHh/6JfY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:52 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:52 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:56 +0800 Subject: [PATCH 10/15] net: ftgmac100: Simplify legacy MDIO setup Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-10-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=1050; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=sTOR8ejCb9ahGiji0rY+7pEcpOADWbGOQwYfcP4m9uE=; b=WlVoaSp1563j6acdnnF6I+ZXqoxzDPsmIqYbBsMwZ0pYqsefnO1GDq+By+FPERLwahlkqcY73 SdwErVW03W2Cubp+mfenJNKvCkBIr7nTVEl4o0nzCaJJ9E8cfuWhNkN X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn There are old device trees which place the PHY nodes directly in the MAC nodes, rather than within an MDIO container node. The probe logic indicates that the use of NCSI and the legacy placement of PHYs is mutually exclusive. Hence priv->use_ncsi cannot be true, so there is no reason to set it false. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 327e29064793..cc01cf616229 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1995,8 +1995,6 @@ static int ftgmac100_probe(struct platform_device *pd= ev) * child node. Automatically scan the MDIO bus for available * PHYs. */ - priv->use_ncsi =3D false; - err =3D ftgmac100_mii_probe(netdev); if (err) { dev_err(priv->dev, "MII probe failed!\n"); --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE6E32D7DE1; Mon, 5 Jan 2026 07:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596965; cv=none; b=SHcvKk0n4Wxh2TU+soCh4RFOJe1mdmKISooZNqPNZDrabeXU3qVf6QhmByxJLAASsWiigcR+8ab/hDjuCaCVziRtEBqGkRS/wL68MHABryswoxy5iR9+NRPB4jaETtxq45SdEJEW+7wM1qscQOQGm7cr0TE7iAePlQCoBAS/vbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596965; c=relaxed/simple; bh=oS1ETupMifkYoBdYv45Gyidm3cob0zIsPfWZyWftMuQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Kp6mhxPXsWR9rwmq+RmTfi6oDHVlV/sMZmT9UrIIFvTMpZG7XqWdXHyJnlHyTtlQEddwomnMEERhzpTKKFdL5Da1u76DyYpjlCbH9+Wus0Lwi2elfpUCbJseUoIppnLnY85GCshiJpa11UiEkwekB5BZSFyF9jO96FJOOLaAJx0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:52 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:52 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:57 +0800 Subject: [PATCH 11/15] net: ftgmac100: Move DT probe into a helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-11-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=4025; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=AgmOg+fS71mT31byJzXNyMALPBqZdv0OZINj3HLBaBs=; b=DLXtOEfMrqEWFCWsQ1WBJwiYFbXuDINrw6wW9aHId4qWcc2KnB1iLZsy9uwNY3JRRhRFi40Jq wpHmtCMYAkUDByQEyShQcpbgcPi61xuLKRGpgtVByIbN9T3Rxrq6T+w X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn By moving all the DT probe code into a helper, the complex if else if else structure can be simplified. No functional change intended. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 89 +++++++++++++++++++---------= ---- 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index cc01cf616229..d30b0b050648 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1870,6 +1870,58 @@ static int ftgmac100_probe_ncsi(struct net_device *n= etdev, return err; } =20 +static int ftgmac100_probe_dt(struct net_device *netdev, + struct platform_device *pdev, + struct ftgmac100 *priv, + struct device_node *np) +{ + struct phy_device *phy; + int err; + + if (of_get_property(np, "use-ncsi", NULL)) + return ftgmac100_probe_ncsi(netdev, priv, pdev); + + if (of_phy_is_fixed_link(np) || + of_get_property(np, "phy-handle", NULL)) { + /* Support "mdio"/"phy" child nodes for ast2400/2500 + * with an embedded MDIO controller. Automatically + * scan the DTS for available PHYs and register + * them. 2600 has an independent MDIO controller, not + * part of the MAC. + */ + phy =3D of_phy_get_and_connect(priv->netdev, np, + &ftgmac100_adjust_link); + if (!phy) { + dev_err(&pdev->dev, "Failed to connect to phy\n"); + return -EINVAL; + } + + /* Indicate that we support PAUSE frames (see comment in + * Documentation/networking/phy.rst) + */ + phy_support_asym_pause(phy); + + /* Display what we found */ + phy_attached_info(phy); + return 0; + } + + if (!ftgmac100_has_child_node(np, "mdio")) { + /* Support legacy ASPEED devicetree descriptions that + * decribe a MAC with an embedded MDIO controller but + * have no "mdio" child node. Automatically scan the + * MDIO bus for available PHYs. + */ + err =3D ftgmac100_mii_probe(netdev); + if (err) { + dev_err(priv->dev, "MII probe failed!\n"); + return err; + } + } + + return 0; +} + static int ftgmac100_probe(struct platform_device *pdev) { const struct ftgmac100_match_data *match_data; @@ -1966,41 +2018,10 @@ static int ftgmac100_probe(struct platform_device *= pdev) goto err_phy_connect; } =20 - if (np && of_get_property(np, "use-ncsi", NULL)) { - err =3D ftgmac100_probe_ncsi(netdev, priv, pdev); + if (np) { + err =3D ftgmac100_probe_dt(netdev, pdev, priv, np); if (err) - goto err_setup_mdio; - } else if (np && (of_phy_is_fixed_link(np) || - of_get_property(np, "phy-handle", NULL))) { - struct phy_device *phy; - - phy =3D of_phy_get_and_connect(priv->netdev, np, - &ftgmac100_adjust_link); - if (!phy) { - dev_err(&pdev->dev, "Failed to connect to phy\n"); - err =3D -EINVAL; goto err_phy_connect; - } - - /* Indicate that we support PAUSE frames (see comment in - * Documentation/networking/phy.rst) - */ - phy_support_asym_pause(phy); - - /* Display what we found */ - phy_attached_info(phy); - } else if (np && !ftgmac100_has_child_node(np, "mdio")) { - /* Support legacy ASPEED devicetree descriptions that decribe a - * MAC with an embedded MDIO controller but have no "mdio" - * child node. Automatically scan the MDIO bus for available - * PHYs. - */ - err =3D ftgmac100_mii_probe(netdev); - if (err) { - dev_err(priv->dev, "MII probe failed!\n"); - goto err_ncsi_dev; - } - } =20 priv->rst =3D devm_reset_control_get_optional_exclusive(priv->dev, NULL); @@ -2058,11 +2079,9 @@ static int ftgmac100_probe(struct platform_device *p= dev) err_register_netdev: err_phy_connect: ftgmac100_phy_disconnect(netdev); -err_ncsi_dev: if (priv->ndev) ncsi_unregister_dev(priv->ndev); ftgmac100_destroy_mdio(netdev); -err_setup_mdio: return err; } =20 --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11E7C2C08D0; Mon, 5 Jan 2026 07:09:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596967; cv=none; b=r2Pc0/vK85slE2cN2R3OmQYiGRRfztTZ+dEsym5l2xEC6E6/cby34gz/0MbKJS/ZTf2+PHVti2YMa6UhzF8EMh3PDrQKMhK22vUhoz6nu6hb5+Q7PVRRZU9tsTf87GkZ4mp3WANL5QBr0Y2kGkV2evr35YIEA+e4li8bMcHefOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596967; c=relaxed/simple; bh=N7hQaGmYRSe0yuMHvP9Udy0NJv1QQ2M+XZ7K0zAhWyg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=J7wBl4pM0W97LtS6gxuE8wc5asSokC8wUKmlSEtHUlDQhzwXZJpA3hNBf43+mECnK+mMsC5DTQ9yL91uB5pjiqvqpKlwzVkjed4JCz93SxuN04YPnp+0qc+zk3SM74sKMiC4uLt4tgDVNXby5VWuwj/wggeydNxRAy9AWiv57m4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:52 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:52 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:58 +0800 Subject: [PATCH 12/15] net: ftgmac100: Remove redundant PHY_POLL Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-12-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=1275; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=OK07WGZywqscNZStTCl8lNsV7v+estKb1ypfM5betm8=; b=HZ4ahaO/+dBncU6FR+M+8Oim1k69rCGnUw3cyy9DZcmY0kUspNtuodtXkSs2LIm45piCNKIBU CkIe/fYnpnfDedz4HceOT5quSvaZoI/lkJUHWZ7d7a8azO06E0CIxCg X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn When an MDIO bus is allocated, the irqs for each PHY are set to polling. Remove the redundant code in the MAC driver which does the same. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index d30b0b050648..23a2212ee3bc 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1712,7 +1712,7 @@ static int ftgmac100_setup_mdio(struct net_device *ne= tdev) struct platform_device *pdev =3D to_platform_device(priv->dev); struct device_node *np =3D pdev->dev.of_node; struct device_node *mdio_np; - int i, err =3D 0; + int err =3D 0; u32 reg; =20 /* initialize mdio bus */ @@ -1740,9 +1740,6 @@ static int ftgmac100_setup_mdio(struct net_device *ne= tdev) priv->mii_bus->read =3D ftgmac100_mdiobus_read; priv->mii_bus->write =3D ftgmac100_mdiobus_write; =20 - for (i =3D 0; i < PHY_MAX_ADDR; i++) - priv->mii_bus->irq[i] =3D PHY_POLL; - mdio_np =3D of_get_child_by_name(np, "mdio"); =20 err =3D of_mdiobus_register(priv->mii_bus, mdio_np); --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4DBA27E040; Mon, 5 Jan 2026 07:09:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596969; cv=none; b=AbTU2vOaGX8A7KCYqW8PpxKEWR/v3fZ+PmDna0locXk9CuE/jqa+8AykaaTQNoaSJEfI2x+TvB+qPR726KtcT7B2WiTiEqKaUCVCbRPTVLwK1Ty7i/Jef1q2bTK38c6HKLr2CYrb9kqKU7fj+urjEjGXs7DelwMp4Tn+3uR23Vw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596969; c=relaxed/simple; bh=aD3Y/J4WZhGKsr3d7Oz+Ovnk92GYeHT4AmKUjOZT3PA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=qRfy/7aXj1r0aKJ7ZOKhHyGVHIXedeNenxOwBWckg9uSkMShC0fnT8c3w5SZ16WjEEQwXFBN6wCJfqQoBL1uWfO9uw0khzXMbLQZhhK9uV1CKYWziLJBH/6piQ3xdzXHY1slLfBvba/orfwbi+SRvvX7osFYYMHDOVj0gkvG8Dc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:53 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:53 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:08:59 +0800 Subject: [PATCH 13/15] net: ftgmac100: Simplify error handling for ftgmac100_setup_mdio Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-13-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=910; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=/wYKQIprzeIHoGUa5tn6VzD6FBP9laPgt1UMjBwnQRw=; b=Fxy3lHdN5MMoqKUVYXdwnt+CqbcXs8YszPaIW41EdFyeS9Uh8JYdlHMBotOQ6i8VDpdd7ep3/ FcETLZqJzGGAnNw2KKjEdAKRsN2BL3NU3l0SLFhOZC9TTJNh5QkUOUa X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn ftgmac100_setup_mdio() cleans up any resources it gets on error. All resources obtained by the probe function up until this call point use devm_ methods. So just return the error code rather than use a goto. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 23a2212ee3bc..982944ab1ff1 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2012,7 +2012,7 @@ static int ftgmac100_probe(struct platform_device *pd= ev) priv->mac_id =3D=3D FTGMAC100_AST2500) { err =3D ftgmac100_setup_mdio(netdev); if (err) - goto err_phy_connect; + return err; } =20 if (np) { --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 225E5286408; Mon, 5 Jan 2026 07:09:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596972; cv=none; b=dN2NKoqyPJetSjZVGWB8CKQPgukW1uYToHs+/vQcS7pVtbL3QM5+dZZAUVfmKr6TlWjqG25Nb2pQjA3d9kdPVfs6B4MPCY9hDHx9pUIxOjy4wBnxQ4s30wNIluFynbpkiPOQJJkYtJR5rNUOGdez6RjDfEMKXx2lviwkHJSSxDQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596972; c=relaxed/simple; bh=PrAJ4wQMmXJcV1h0udjZuA4xTtpeRqTZg4dLRIzZaww=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=c+HMOai7eg5G8vKt0VFZFM+TCoNJQBx24HHjxzzhEQwMOdcJojmojc1AVuHWC1bFtTdjYJpQkhta2dEaV48evHcjNx+SdnPWvhYW1rnRrz5S7BU4y9OBZcWoPeTfWGLig1nTlfB0O3nwXGd5fJrVnwlBDc5MQQh0CwNl6WXiRkY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:53 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:53 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:09:00 +0800 Subject: [PATCH 14/15] net: ftgmac100: Simplify condition on HW arbitration Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-14-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=1216; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=fYKQ5LeYKEpuI1fnPxPK8Gt5GiBUBdPOZZycvwLxNlE=; b=U4o9xmQsCGgYf2HtIIawDYn/aUnfrKm9E27sFEa3MrJVBdxua8FMRU6+7EEypVYk6NG/KLwn1 8RfgBjsjYLpDPHJi9nNKXwLQEDh2EqoAmYB82m0+F1mOFKDDatmAsis X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn The MAC ID is sufficient to indicate this is a ast2600. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 982944ab1ff1..38e7ac6628d5 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2031,13 +2031,13 @@ static int ftgmac100_probe(struct platform_device *= pdev) err =3D ftgmac100_setup_clk(priv); if (err) goto err_phy_connect; - - /* Disable ast2600 problematic HW arbitration */ - if (priv->mac_id =3D=3D FTGMAC100_AST2600) - iowrite32(FTGMAC100_TM_DEFAULT, - priv->base + FTGMAC100_OFFSET_TM); } =20 + /* Disable ast2600 problematic HW arbitration */ + if (priv->mac_id =3D=3D FTGMAC100_AST2600) + iowrite32(FTGMAC100_TM_DEFAULT, + priv->base + FTGMAC100_OFFSET_TM); + /* Default ring sizes */ priv->rx_q_entries =3D priv->new_rx_q_entries =3D DEF_RX_QUEUE_ENTRIES; priv->tx_q_entries =3D priv->new_tx_q_entries =3D DEF_TX_QUEUE_ENTRIES; --=20 2.34.1 From nobody Sun Feb 8 01:31:12 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B4552DD5EF; Mon, 5 Jan 2026 07:09:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596974; cv=none; b=ll8kov1xj9XF9GwnQCDibuigZZGJO5jXSpMmbKDUWR0h3Rse8fcTOrHeaWyKbVHYEEEusFCkp11KXurGyDjEV/qv8/xVziRAJWar3HHotXDhs94XOJ+NVabIIM/nAh8gK0anoHlMR2UMiUesK1UHwA0Ye2ePqxfrZPDITH8TpU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767596974; c=relaxed/simple; bh=2B3HBjY0SQaRsjgj79hQLnuqPqzO6u6U53HjalBYMeg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=cKycJrTE+xDYFUZAv6d3sGvaMGr/5Vb8Dcs5aGwJaJC1xTQrudx68fQhr3TnypTRLdT+35yGcgNtYW2uvaDX8zB4pLSfzNBuo+l/HtP7ze7Bbx7VfpEXpIDUVq3C0xYbGbKuG68YRVBwOp/BPcM0Iq9Me51RH5f/IUAYIi+m3CI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Mon, 5 Jan 2026 15:08:53 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Mon, 5 Jan 2026 15:08:53 +0800 From: Jacky Chou Date: Mon, 5 Jan 2026 15:09:01 +0800 Subject: [PATCH 15/15] net: ftgmac100: Fix wrong netif_napi_del in release Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260105-ftgmac-cleanup-v1-15-b68e4a3d8fbe@aspeedtech.com> References: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> In-Reply-To: <20260105-ftgmac-cleanup-v1-0-b68e4a3d8fbe@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767596931; l=864; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=1O9ZlfqURpu++PsSf/kDTMV+laEgc3XYu8eIPMs2lG8=; b=UegqSPM9WFOJyMQalal1nwa7lLRgJl02YTmx7YyftoaeIjNWo9pEMqzN9FT8yWHuv7ohecLOF vg+1Du83JbpAXUfeu/soXH3LHHW8QwGS67SN8JlO6XKgS9oL6kuSSsE X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= From: Andrew Lunn netif_napi_add() is called in open. There is a symmetric call to netif_napi_del() in stop. Remove to wrong call to netif_napi_del() in release. Signed-off-by: Andrew Lunn Signed-off-by: Jacky Chou Reviewed-by: Simon Horman --- drivers/net/ethernet/faraday/ftgmac100.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 38e7ac6628d5..42344588aa44 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2101,8 +2101,6 @@ static void ftgmac100_remove(struct platform_device *= pdev) =20 ftgmac100_phy_disconnect(netdev); ftgmac100_destroy_mdio(netdev); - - netif_napi_del(&priv->napi); } =20 static const struct ftgmac100_match_data ftgmac100_match_data_ast2400 =3D { --=20 2.34.1