From nobody Sat Feb 7 17:48:46 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 0407A30DD25; Mon, 2 Feb 2026 07:02:12 +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=1770015733; cv=none; b=guXqU4JZLaPDROx55o+2rxH/HcbsIbTrXzPy+PmldiOZHj+HA249NRAXe+TcGlnI799OgYprZZKLf//K9bmIhyERmLJmpe7y1MBe5D/V7SFN86heWsoNfG4JoEufK0shPfZHCVb7Qn1TttG2bUkUFWivWIO49G/EYDQ69wiY7Tg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015733; c=relaxed/simple; bh=rPxIS+uhUzsKBY2yjgyhHwqeU3SRBIHj4tyBgoBhwGU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=CbCsGLmbw1Axs0hctqZp3BBu4PgE5Ccl09TIlC17RlNtKoBd2ZJLF3EiY37k+XbXPVf90G5DlAOCJoy6KI5gkSGOj0JOT2mJD1UMHA4NlHYP4Mt0dd+TEQgl3xXWkBqOzFm6aG7AdyG99wscw4hLL1WLrCwTvUw4eH3EEAM2y7w= 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, 2 Feb 2026 14:57:00 +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, 2 Feb 2026 14:57:00 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:56:55 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-1-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015419; l=912; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=VB5Hr6O+hVDiNqHf4IWzXWWPmq/hUMTRLmT1UTc/XL8=; b=DLFXzvbnBKzwv8L0kHAwBie+zTsEN9QXAGG0T8wtcKTa+U1DC7H5MisFmkBGOroYvNl6vZjh0 4wZ0UvUxE60A+B+FUCntIWa5uhp3+1iqTJ7QPqlMe4yQRisBUDz6OPj 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- 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 Sat Feb 7 17:48:46 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 A10BB30F549; Mon, 2 Feb 2026 07:02: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=1770015735; cv=none; b=Hwde7d2bt6rEDwnMTL0mcvx9gpUpA5wLAAdB3VgNLwLghKumSshDeO2IfJ/rrkxhK0ZKaOAW6r4obwjR8OLnlSDvVeU4YaiOygFcFo7wQQBaJTuHDBvEi5xLQm9M9pqwx/WerXuQ1BGIRp+Whrtt49rGp8ahM54x716fN8BCSPc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015735; c=relaxed/simple; bh=TvPvwgbTpwSpyw/7g9BTYt5lpmiQYEi+FH4stMJoeMs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ixMkSq4VkRytJSn7yd/sffMVG/KYMd0Bv9xcOrHRMioFMSjj0gyhscKEqQdKJUtJa+CrdsPu1UFX+JSrN3XsHS8NET52J6dD/Q1S2xmz6nhzeiyXA6KwXtHyhtLHbF3T56W4RTq6gw58yDVHUQ7LG1dmgb1CS2ZEP+7HuUBbjXA= 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, 2 Feb 2026 14:57:00 +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, 2 Feb 2026 14:57:00 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:56:56 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-2-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015419; l=3993; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=NVi1QwkA7JxwSCPAVjGjUYu41AXXsXEhvfrBSk1vf/A=; b=0mX1VGeXx3NDPyuMM36dYgRQexaqSJFibj+CQOSTRX5ghfWzRfkQcGs8CevfE6JJdmE0rJdBb tpxvbUnAXCND3nUA0A3PfOwG8LutUXgm/Am+PgiZprQr8R+tlobT9UH 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- 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 Sat Feb 7 17:48:46 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 73E5730E83C; Mon, 2 Feb 2026 07:02: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=1770015737; cv=none; b=FJEeAxNRegogh+fBdNKr1zIjCk6pSJ9/xPhVvdN/oTkisqqlYF+VdE1yL6NXWfRnE87zsWm7mSak/J2yS+zh018Ql3/j08e4kBzkCZzYhBbAwZmMjfvJJkqIqVrRI6L/14LB2oVu+qweLW7Nc4uvWGdqREGqAy2K8Ti+nyHgsOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015737; c=relaxed/simple; bh=1bEa2Jv/bTv7bHrcPfXv9ul57tdtU4FVmXDJgJry74s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=oUhkCGv6hWNeNpDbKGsgRTURDXZkMhrGDRFN4SLY/1h42jTKi96puPyWdRLPd4U97yZLZwUeDT0Uf1mnGuKj6AsUwAjZkqQpLgPNP70qcpHflIMIgpeQkIO0E4ODvlNWCz67+U8gjTY1x1GvkRT8clCav+kKBuSIKoIrcHagM08= 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, 2 Feb 2026 14:57:00 +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, 2 Feb 2026 14:57:00 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:56:57 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-3-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015419; l=3130; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=+aILZO8pus/3meVrNzurjk9uWwwKRISZWHJRBZ3qWxI=; b=cQaHfFCn2Tu+xjHPO213qIuDLrIRTvVe7zRWDuQxUsdMNFinCvKWMHbdz70zAs+KA8CoE7ZAM JvpuA2zf5sSDs/sd9BvOAD15vvHXqpwsAVYEI5AdoBq20w4SaCHCEiD 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- 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 Sat Feb 7 17:48:46 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 78D56313532; Mon, 2 Feb 2026 06:58: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=1770015513; cv=none; b=rTpK55YnD/sHPejl3DoXab6CeTwomeQOZnS6kphzsVt3CFcBiV29C8WrGf6AW6G4otthJsvmpNydr7DmrO3xnKEexv6sHOe5v+Mr/rmVGRMdwH1rpwNcvVsjqQA86RENmI6KHQs+OmFmnMYDgK42g0F4EDFRNu1fH9Jp57LNwq0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015513; c=relaxed/simple; bh=onLWbZUbnTMgDK4y8kzfyvlIWWGQE8LKDFBj5Fq38Dw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=AmpaFp4Vslpehx43jRVPIS/8b/ZZBjBuXYyRC4uA0neaB4i0Pg+hyoUNb8SI0TAD0s9tatOH883jav8hiuNvKcDUers1Ruelavh/yl9ue9z0GpKg+0q3CCPeuaUqNMgzKGOTUkbumAOQ0OBzkh3Ch2R0VsAEpsLzFfY6Q0EEKnI= 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, 2 Feb 2026 14:57:00 +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, 2 Feb 2026 14:57:00 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:56:58 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-4-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015419; l=1418; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=o3nIYAscEW7qqYCVm0zoQKSDXM36iO60MZ4R096iN0U=; b=gTR0yC8zHVVV5shYd7P8IFwV5wjXykFCOMKRYtsBSCsd3WaGAueFPox6N31p1ac/ByCzRom7A r6sjrptOQCUAWy0oHbeBON78k0o5B0kLJUL6Qia9vVZ54Jkx0xqyjKG 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- drivers/net/ethernet/faraday/ftgmac100.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index f07167cabf39..397ada43c851 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1877,11 +1877,9 @@ static int ftgmac100_probe(struct platform_device *p= dev) return irq; =20 /* setup net_device */ - netdev =3D alloc_etherdev(sizeof(*priv)); - if (!netdev) { - err =3D -ENOMEM; - goto err_alloc_etherdev; - } + netdev =3D devm_alloc_etherdev(&pdev->dev, sizeof(*priv)); + if (!netdev) + return -ENOMEM; =20 SET_NETDEV_DEV(netdev, &pdev->dev); =20 @@ -2080,8 +2078,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 +2108,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 Sat Feb 7 17:48:46 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 11D352BDC1C; Mon, 2 Feb 2026 06:58: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=1770015494; cv=none; b=OfXnLHiftg/fzMycObC/4eXDjQyXl+1+z2XxshrEL0bw/C6CiW7t9nchFj2cleO5oe3lqzG4HDEBx3FdziQribMj7whWWt1BdHbJwjXyQ69fssFIsj8G/cAo1Iw2ih2J3r2yQSVl0y3eRmw8sSaHcXt8kpEcj/A4GlrjyPwWwZ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015494; c=relaxed/simple; bh=ceYR9uOBjSpJRI2oiBkcEl1sbI98TqqWni7uo64dK5I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=dRRXWMJARy3DDmSDZ+atb7HrNexU37QLQzeWTntRXd0vYwAmummV1+J8IZtJzgipaMndFZXS4zO3+uSr3gjNKb+LvsN9VZIdUUaA8/VI1FtpHRXKplqUnZsnIXOYdfX594Slk6ZB/pR8CLIXKsTK2K+zRoW3ip+vOiEULHMLn/c= 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, 2 Feb 2026 14:57:00 +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, 2 Feb 2026 14:57:00 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:56:59 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-5-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015419; l=1997; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=PabSzzWHuOc4GjJAVT/Ar4WEHvlB1Z2Il9a4L8Pq5xY=; b=UealA8MQUvPt394swGWa6cSd3LUKbrLyOXgyMKqfUdg266dFocu3tHSAG/trMwDoIR77Sr7hZ Y7BcBVgS66BBC8bOYyBWca/bnSSASuLmOCd+Exq1JfJmUNyDDGWo/xs 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- 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 397ada43c851..ec2e7ec23ddf 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1897,19 +1897,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; @@ -2074,10 +2073,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 @@ -2104,9 +2099,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 Sat Feb 7 17:48:46 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 91EBF30BF6B; Mon, 2 Feb 2026 06:58:14 +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=1770015496; cv=none; b=OFd+YV+CFcYBES0EKV0zAjpQriNXP62XIcXq8GHMUQLDnmREg8ev0XPqO+JmfNEGPsEQ5tVQoCTI+HWUp9R/R9a0n3hYRFmlION4S5R61feyYHSYAUXvo2/CMky4+bV1oZXeKScRvEiQV0whevGd4OAQbbcWDUEJGcNH8uAAASs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015496; c=relaxed/simple; bh=XgKX0xdZa46he8amsmEI8h76ecDZ3K1z1hppQLAht+Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ATKzd1u9c7BK+OEvfAvkkL5fnfxk8gBaAXusGKhIJ9gFBxszro19y7cd/EgUZMsgDiO01aucs4QYqB9uqe8giPEkqQW0OY3F/f918yMrM/21F5O6VxMI1cW0LwyxBjjnh7AJc7ULwcTxJ4dUsZnLlg0MelBW+Wbff8vdPosQbBA= 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, 2 Feb 2026 14:57:00 +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, 2 Feb 2026 14:57:00 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:57:00 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-6-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015419; l=2593; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=a77ZGVgJdbUEVv/HmsFHuKrP2+pmsIXAJ/kpHVOPu+Y=; b=UoU/RcmgIrg/89sLoLp2Y7uKkyCiF7qAIXOGJBjBYxyiY3awKE5TyLnNP50yG0cQikoV/9laF U6zuyaMhpbkCtZHmp0Bk1jduUsqA3Q7Aq94jh19Aq3zS59XbrNQC2SZ 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- drivers/net/ethernet/faraday/ftgmac100.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index ec2e7ec23ddf..1fb03dd55c8f 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,17 @@ 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"); + if (IS_ERR(priv->rclk)) + return PTR_ERR(priv->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) @@ -2064,8 +2057,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: @@ -2088,9 +2079,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 Sat Feb 7 17:48:46 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 BDA1F30DEB2; Mon, 2 Feb 2026 06:58:16 +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=1770015498; cv=none; b=UShq/F6WEKjRpJdtQnqh1MScp6fTf+ACAMDnuKB7U+IHScxfGCEg+zII92ckDHDjBbdqiPEBh8eYp4BrW1oQR70azebVegWAT5KtAwKf7LvQSVFxIEa7ilYkDh7VD+RcJ1CCDHUKNvBgg8kPR4XFlavAH03im9SYn125HzV4gAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015498; c=relaxed/simple; bh=OmD5Arfn3RrbJ25M0ctPE3l/LqvXsbLTQxMzqMnbtzU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=MQpBWOlMCOKNeCtNCsnb4MHTISRTdo9otnOXrlih9ACKdBlbDyjZH41r68m/XADzejgkqm+Ok/2/u+3J6czkE3px0LOQBHprly8CH4ZPjrhxtlJX63C8F4POvhStIPkKmp28hD6VNXBPqp3AOD6HsG2QMTJHj50/go6UrUN1i6U= 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, 2 Feb 2026 14:57:00 +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, 2 Feb 2026 14:57:00 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:57:01 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-7-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015419; l=1005; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=v09SrIG5pIMosiqozTDRpfXyvuVR8w7kAu8PLHCKIaA=; b=hm4Ko4VNtaRF4QYcH6DzpuiZLt5OURMcxqKblVRzzc+ozm5sWCHClYGXjeRa67h5UhAXascng CR+SbfwK8CpCkYU9aV9SSSabR+O493NX5zEZdwcMg17zTtCnHqXAF7W 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- 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 1fb03dd55c8f..e511d6d5f7c2 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1914,7 +1914,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 Sat Feb 7 17:48:46 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 A1DEC30EF84; Mon, 2 Feb 2026 06:58:18 +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=1770015500; cv=none; b=irIXjGPBBrjMBoAqDVq4MUXbCrLVQ9KoR5kE0sktdOB5Yj6A8Pj2MXoUboXPLUmT5e+9xa8wmzxbPE/O6mERB20pg88R5fIQq0OcSyMi9Sm7aIuZA26plVyZ6uX/0/t8ex74imiI2i5MUKEjDGCsdsMj7HmQyTGAbOMYOADWXxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015500; c=relaxed/simple; bh=8d3EE6sOJwUfL4OUiPuDwsXaq+4QaYfiFan31T7cIX4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=nNq09y4Z9ar6Xg6WXbSJnqeL2df8/mbw1LzHy44ja1fbKKdQNOoQWfLTRlNNgjZCUgFxnVO/n+3iP6TC//GxQZ2mnhDLD+z5eNhly9bqo4UCMnjWTvi1BfGdRPwsx06FAK6XUHD4aJW6EZLD/Rsd4wCIeg79nkAV0943z3K6OwE= 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, 2 Feb 2026 14:57:00 +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, 2 Feb 2026 14:57:00 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:57:02 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-8-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015420; l=3233; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=esbPpcq45s+GQmLXKfVpYucwKfgmnwfq/x9GxcOWAq4=; b=hEaclajCJNqiQwp/HND+T3+LqsuEyJBBBntI79E4N/L9zMS+zVDSmMEBXeSDLh0pKcVR7o/vW awir4YMWTPeAqvp2HuuHjbub/lJdfQh3IEDKUFmuB3WxAKwvd7MfCON 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 helper. No functional change intended. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- 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 e511d6d5f7c2..9d8256d4d368 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1839,6 +1839,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; @@ -1846,7 +1879,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; @@ -1928,32 +1960,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 Sat Feb 7 17:48:46 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 5D81330F922; Mon, 2 Feb 2026 06:58:20 +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=1770015501; cv=none; b=OGEOyQJyziatza41JQ0jqB1Mq6c12Oet8TLT656bAKy8OVkZPJYeBl9N60ZIQrwwB86EYKGeUQ6MWutHeci0McprdrcvOiEkRN5gsosOVPGQ09hcBDIZCP+mKI5pJdcEVDP3uc12ZflAmo8nvVlmbAtDh2LQ4zm2R/XNJonj/OQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015501; c=relaxed/simple; bh=0rao3di+9z5QqfP2hfQGyeg+E1GmKRhuEwu1JAtnSSc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=jQcJYFtGt3k8if2npH0RVZTjSkj7xC2ZM3lsFKSpgrmd/eaO4EcSJ/96tc9E9QHbYqtMlXEXOFe7F7AYV5d+juqpHfmxH4pjTbfECnEQXCl9fBpLdFeSbwqXQr3ovCF/4Qs3Aj8OlZyYbezaVn1YvgCWgnJhMkdOfVTVHwzutQ8= 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, 2 Feb 2026 14:57:01 +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, 2 Feb 2026 14:57:01 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:57:03 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-9-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015420; l=3611; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=vEpD7gzaQ6fmysAORHjEdjk+R/oL0FH1m/sZb4xfwwc=; b=NsuWMPYEezUgulC/HwVdZNoL/S2ZDHh6fMbvTrhwiit7+kjAXPCz4S3qFgx5pW0HGq7NJSe4h 6V0holDyPVCD1hJGm1AZgMMoFvFPw1AUdCBc/l6Pn2unkuC6TaS6ymd 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- drivers/net/ethernet/faraday/ftgmac100.c | 40 ++++++++++++----------------= ---- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 9d8256d4d368..e2a0a97af726 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1959,32 +1959,28 @@ static int ftgmac100_probe(struct platform_device *= pdev) 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) + return err; + } + if (np && of_get_property(np, "use-ncsi", NULL)) { err =3D ftgmac100_probe_ncsi(netdev, priv, pdev); if (err) - goto err_setup_mdio; + goto err; } else if (np && (of_phy_is_fixed_link(np) || 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) { dev_err(&pdev->dev, "Failed to connect to phy\n"); err =3D -EINVAL; - goto err_phy_connect; + goto err; } =20 /* Indicate that we support PAUSE frames (see comment in @@ -2001,14 +1997,11 @@ static int ftgmac100_probe(struct platform_device *= pdev) * 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) { dev_err(priv->dev, "MII probe failed!\n"); - goto err_ncsi_dev; + goto err; } =20 } @@ -2016,13 +2009,13 @@ static int ftgmac100_probe(struct platform_device *= pdev) priv->rst =3D devm_reset_control_get_optional_exclusive(priv->dev, NULL); if (IS_ERR(priv->rst)) { err =3D PTR_ERR(priv->rst); - goto err_phy_connect; + goto err; } =20 if (priv->is_aspeed) { err =3D ftgmac100_setup_clk(priv); if (err) - goto err_phy_connect; + goto err; =20 /* Disable ast2600 problematic HW arbitration */ if (priv->mac_id =3D=3D FTGMAC100_AST2600) @@ -2058,21 +2051,18 @@ static int ftgmac100_probe(struct platform_device *= pdev) err =3D register_netdev(netdev); if (err) { dev_err(&pdev->dev, "Failed to register netdev\n"); - goto err_register_netdev; + goto err; } =20 netdev_info(netdev, "irq %d, mapped at %p\n", netdev->irq, priv->base); =20 return 0; =20 -err_register_netdev: -err_phy_connect: +err: 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 Sat Feb 7 17:48:46 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 24C1330FF36; Mon, 2 Feb 2026 06:58:22 +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=1770015503; cv=none; b=LakFevu/sdu2+DR6FAdm+mslinRKxXgJLdGOeo9a10VkrvqpR5iG1evphOj9ni7L3K1VynGSXmnwVvJr06xSlt2QMhExG77RyZAdQDXH24u8spmYmvTEImJvxp7ThJQ+2aPqPCShaggOOdHS4fVqXmimU13NHmy2+XjUezbdr+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015503; c=relaxed/simple; bh=59D6pnU8mY3g55Owjv3M4tJi5tnJthJ3dxFIFBId8S0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=CIGRrVL3N8eCigKHjx4NzPpVFllJE0BW6ALlH3le0fX+MARqLZGJWmHKwvVx0p5g5zL6+Q8PiZvYeHwc5xyd53zkQzFJ4Zn/fqgmPpLPyp963HE5KP45dD1N4iT5EqBq0ebfJR794qEvRGCDreKEf6saZka/s0sJk275iRT3YLU= 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, 2 Feb 2026 14:57:01 +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, 2 Feb 2026 14:57:01 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:57:04 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-10-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015420; l=1096; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=raC8TK67zJMczu7KplRwfD04+p91R9SiUDehbrIovdw=; b=Lpe2obpFpqVhlxmStXaaJ5ScuW6dq/GUsgn6WzpzOYVW5Et3f5h8wlat7RCxw5c/rfNulDPe+ 3NvoahqrmstBnifdCv03zV40vM7qD91Rw/+aJ+J3ZoOfhKlcSiFEhWF 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- 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 e2a0a97af726..4c7430088c63 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1996,8 +1996,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 Sat Feb 7 17:48:46 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 BFE2E3112C0; Mon, 2 Feb 2026 06:58: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=1770015505; cv=none; b=Jyqiks3DyuurOOyJdomisFMLzDZcCRZM52hmHMZRUgnsXqjuxzzoypv1C8DZHYyI0zFugoZ77xdu542FDkuucRP8UljbckJ+/Cl36D9xmn1vAldYNoxq769e7LU3N+eQ3S/Pt00Vo1OqzNeVS+mLurGuQGrUlT2Z+UNRO/koqf0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015505; c=relaxed/simple; bh=oFLod5/eCtcLJc4LaF0R/Qx43O0Yen3fiT9Qo2Fs5hg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=rdo6WFJGUQKGykcS3y81ciQuJ3goO5r17oEFqxU+E+f+dE3zU07OXW5gx3n9If+3rDCEuUFo+NW+J+rmA++47Hy9L9jByBv409gVtAIdqhVn360Y1pj6Xn5gI9T5yf8ZB9NfiOXgq2csLNyivkKQkhaJsNAOeRonf2ZqBbCRfdY= 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, 2 Feb 2026 14:57:01 +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, 2 Feb 2026 14:57:01 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:57:05 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-11-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015420; l=3722; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=McZ0I9AK7nogEIoCH3TqWS3BP8+jYuWEkFAmsFCLwq8=; b=OifrRU2JWEZ1G9tYpIbLzgyt/tnmlbhXYamXiglb0D2MAd2N3iLj8XYaYSyA274lKLzT9IkAd q0Pm9+9T/CNAoLCbdkOw5WPcL08muEC1GaZxWPZ890hQzOgPVZmqwhY 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- drivers/net/ethernet/faraday/ftgmac100.c | 87 ++++++++++++++++++++--------= ---- 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 4c7430088c63..eac0eddff641 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1872,6 +1872,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; @@ -1967,41 +2019,10 @@ static int ftgmac100_probe(struct platform_device *= pdev) return err; } =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; - } 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; - } - - /* 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; - } - } =20 priv->rst =3D devm_reset_control_get_optional_exclusive(priv->dev, NULL); --=20 2.34.1 From nobody Sat Feb 7 17:48:46 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 ACA23312805; Mon, 2 Feb 2026 06:58:25 +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=1770015507; cv=none; b=oJDIecMJVsXozYJJP2A4M4NP5UJu6fIgqgK/I2t26ar5vFd2lbYlaXdEvmWYF7TWbmp4LwMzh5VTPQi3wjyJeglA/q4Kdc+ttEUDPYGgbay7TBUy6VslpCd8p4ZEvtfewgj27/Rs2f+FBpDOe8N3EVo4g8NLdc1UsvaKnJTltpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015507; c=relaxed/simple; bh=xYzuPf4JpHkrgbcNDcIhc2AIPUmm1ELC+ia/CAI9TEw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ALwMxxPRFV8JQPngE3hgK4PJhYfp3cVlaJgYmjNPOSXz0CivdvCsB+p+ozem3eKGZzrmTy6G/noMaWLSVoDZUMLFlR7cW5FT6UGP7htO7PyUfBThYeehEagEg82isCY5UakPRYSjgGnpcuURhBZA7N0HkVCP5c1bvBk/03xu2Mk= 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, 2 Feb 2026 14:57:01 +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, 2 Feb 2026 14:57:01 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:57:06 +0800 Subject: [PATCH net-next v3 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: <20260202-ftgmac-cleanup-v3-12-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015420; l=1321; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=1fAu1sJrlN8RbP5zBZRB1ty0MJGnS8BU28stOLewZ40=; b=4AG56XV68HiduK30y/FQj160NBHCnugr9EGcenSUJgJMPGijXlScVXK/4iCGe3F7l/wv+0BRw uB27BeW40+uBo0UBXqAJOSliF0O/vd6QjAWU9uOWtdtmdRNRI4krY+o 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- 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 eac0eddff641..491b684a79fb 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 Sat Feb 7 17:48:46 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 659EC313532; Mon, 2 Feb 2026 06:58: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=1770015508; cv=none; b=L243Sr/QUK/9LiMVV94Cfr01+vCcDZawuAkRcvrQv1pfJMtb6NperL+x/7BAokJlp1C83uP0T9wqK0sWkcx6eEgM6zvA2voWjPXAhh/3G41yGjS3XFO69clC2DRbO3omtT9XkVNVCfDHtx5hJLGqF4/u/pBDaFqpxT6y088FqsY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015508; c=relaxed/simple; bh=PDYi6UpYkJptqVcGU/3hRklZnU4sEbljA07zhsRbTso=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=gSDAF03MsFpNOOjR75OTGyMbwWJGyewt79fNfhmdauisyFcX/Yux5c2Ak96ibbrw/R5G2uUuFGEngGff2iVR6xXXz3NCBLHz1/13byOs8tod7EwgKxX0DOvEcNILFNZ86EHHSWOD+W75FvWyT3B0vnwi3yP12MP12m0sGchsilg= 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, 2 Feb 2026 14:57:01 +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, 2 Feb 2026 14:57:01 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:57:07 +0800 Subject: [PATCH net-next v3 13/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: <20260202-ftgmac-cleanup-v3-13-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015420; l=1250; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=ezU52f1OQn+OfdME2BnrNSlfDj+674WoYoINJjV0Dxo=; b=jBgGn7VN3r1DXosYMyHg1R+OEyTXUGNXZ1ov5HgZ3B5WMDXlkVlJ1khp9TP48i2wQEYZyETz3 /T11MHFi3ijDHOzRmTND9T11VCstOaYYUkzy+QAL9LTTjTUdquK8Y+7 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- 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 491b684a79fb..55a592b3d2c6 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2032,13 +2032,13 @@ static int ftgmac100_probe(struct platform_device *= pdev) err =3D ftgmac100_setup_clk(priv); if (err) goto err; - - /* 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 Sat Feb 7 17:48:46 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 20462314A79; Mon, 2 Feb 2026 06:58:29 +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=1770015510; cv=none; b=eLW6M4L0PWLM1E1fbWBR599kXd8Axp5yMbd4C366A3Y8GM129lKR/OZ3P8E9WmjBnLw4JBcusspSfzB7sui1t7+1KVCTJkValj4GV2f9qPOWKSSJ4fyqTHtu+Dw7/6zJYhRfzdwKrk5UZucM+0uZY/H0SUVQkiPolEFQhMkwsNI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015510; c=relaxed/simple; bh=UjgZvyr3h7j7m5xJ9jp66e9iDUJvnvWRprKsNxTiiq0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=DtJW5XwbZNmekKFydu3FSzRgNsZEXqu8VDnd4xJkl1R18Q16yHQOg2lYfMG2sPgCdWLgVYoKwUBB1c7PGUNTDVkN+WuLDPg4jGRrM61E8cwx6gRlb5wtIgCX29VUzAXO02ZrJtqrleeBH0o4wObEjrHGMbBjRUr3jwy3YFnL2UI= 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, 2 Feb 2026 14:57:01 +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, 2 Feb 2026 14:57:01 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:57:08 +0800 Subject: [PATCH net-next v3 14/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: <20260202-ftgmac-cleanup-v3-14-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , Andrew Lunn , Jacky Chou , Simon Horman X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770015420; l=910; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=AaqHFFSyE0sFfHM4rRsamXsCM6KZqCk9Cn6V4gwrWUw=; b=XoFVsNKZwTlWGjOES42L87QjdfBNMmrevu2+5xBFCQh+HFFBi1nao7/k1yfrQ3Kk5QfFQQMqX VdS+AS8QXDJApHgJgz3tUGe+otLn8vFAYNtmTelzW4XlqALFg2QTURP 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 Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- 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 55a592b3d2c6..45312b9ef35f 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 From nobody Sat Feb 7 17:48:46 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 BA1F03161BB; Mon, 2 Feb 2026 06:58: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=1770015512; cv=none; b=Fglmc6gqNDiSUzfz2aHtCby4ygN+Abr01xvrVgTK6a3nR4Xed54AaI94rdjQyYK3mFy4Atn76qWpFtOnkVK9vypbNubAMIeInl+P1LtatKfe2uEiaotnnYedilB2POrMenZQ66UezGfX9UE2yFBgr4Da57qbG5qoEktOIO2qxDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770015512; c=relaxed/simple; bh=8z5Asf4hOzuHazRpZ4TfjfOeTZlsMlsx0v93+W03d8o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=gswVRN4+BS79JgRWCtxmlq7FhlDPwm8FXJY8eguJRlIt+aYoYyPwxSxQXCTDsD0Iw+gO8BO7aQidVx1umBEycn0Im4ogsG2e2sqbqG1Uxx1oLz3SYOPA/4sNRsHD3sOehg7Pk7teh0eXalE123F0Dj7a715vWh3vhNccjP4ffQw= 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, 2 Feb 2026 14:57:01 +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, 2 Feb 2026 14:57:01 +0800 From: Jacky Chou Date: Mon, 2 Feb 2026 14:57:09 +0800 Subject: [PATCH net-next v3 15/15] net: ftgmac100: Use devm_mdiobus_alloc/devm_of_mdiobus_register 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: <20260202-ftgmac-cleanup-v3-15-6a6a8d45280a@aspeedtech.com> References: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@aspeedtech.com> In-Reply-To: <20260202-ftgmac-cleanup-v3-0-6a6a8d45280a@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=1770015420; l=2368; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=8z5Asf4hOzuHazRpZ4TfjfOeTZlsMlsx0v93+W03d8o=; b=xtAOu7T0BfUKJ5qHYr7c7kiIRnrG0s0iKMJkZo4AJWCjRqYcZWDqb+fRgpNYu699j+/9salV+ kAsT8+K/pi5AS6Dbsaitszv3OjEwrsOSDp240ne5weU8DILWMmjAB5F X-Developer-Key: i=jacky_chou@aspeedtech.com; a=ed25519; pk=8XBx7KFM1drEsfCXTH9QC2lbMlGU4XwJTA6Jt9Mabdo= Make use of devm_ methods to allocate and register mdiobus to simplify cleanup. Signed-off-by: Jacky Chou --- drivers/net/ethernet/faraday/ftgmac100.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index 45312b9ef35f..36ec230312ad 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1716,7 +1716,7 @@ static int ftgmac100_setup_mdio(struct net_device *ne= tdev) u32 reg; =20 /* initialize mdio bus */ - priv->mii_bus =3D mdiobus_alloc(); + priv->mii_bus =3D devm_mdiobus_alloc(priv->dev); if (!priv->mii_bus) return -EIO; =20 @@ -1742,19 +1742,14 @@ static int ftgmac100_setup_mdio(struct net_device *= netdev) =20 mdio_np =3D of_get_child_by_name(np, "mdio"); =20 - err =3D of_mdiobus_register(priv->mii_bus, mdio_np); + err =3D devm_of_mdiobus_register(priv->dev, priv->mii_bus, mdio_np); + of_node_put(mdio_np); if (err) { dev_err(priv->dev, "Cannot register MDIO bus!\n"); - goto err_register_mdiobus; + return err; } =20 - of_node_put(mdio_np); - return 0; - -err_register_mdiobus: - mdiobus_free(priv->mii_bus); - return err; } =20 static void ftgmac100_phy_disconnect(struct net_device *netdev) @@ -1773,17 +1768,6 @@ static void ftgmac100_phy_disconnect(struct net_devi= ce *netdev) fixed_phy_unregister(phydev); } =20 -static void ftgmac100_destroy_mdio(struct net_device *netdev) -{ - struct ftgmac100 *priv =3D netdev_priv(netdev); - - if (!priv->mii_bus) - return; - - mdiobus_unregister(priv->mii_bus); - mdiobus_free(priv->mii_bus); -} - static void ftgmac100_ncsi_handler(struct ncsi_dev *nd) { if (unlikely(nd->state !=3D ncsi_dev_state_functional)) @@ -2078,7 +2062,6 @@ static int ftgmac100_probe(struct platform_device *pd= ev) ftgmac100_phy_disconnect(netdev); if (priv->ndev) ncsi_unregister_dev(priv->ndev); - ftgmac100_destroy_mdio(netdev); return err; } =20 @@ -2100,7 +2083,6 @@ static void ftgmac100_remove(struct platform_device *= pdev) cancel_work_sync(&priv->reset_task); =20 ftgmac100_phy_disconnect(netdev); - ftgmac100_destroy_mdio(netdev); } =20 static const struct ftgmac100_match_data ftgmac100_match_data_ast2400 =3D { --=20 2.34.1