From nobody Sat Feb 7 17:04:39 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 22F502D322E; Fri, 6 Feb 2026 03:17:48 +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=1770347868; cv=none; b=K9m62C5+X/RH8t89mo4in2IBPblf9tSCbPIgMPu6SenAHAKREY8WepC366nY4o1vuMv5Ms3N4qavb5VdkaznjiXUv4ZjiU3kz22P5UEgCjnR0Okkk+7Q+uMz8xfKsQBNzBBJK7xTNl3gwzjrPPqVx1LTF186Y3fUr3uvjnndytc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347868; c=relaxed/simple; bh=rPxIS+uhUzsKBY2yjgyhHwqeU3SRBIHj4tyBgoBhwGU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=TiSe1HVyz6OVqfLVjhMllk5nlacf1DBh9K8DjJKbjZiz1fW2mqhxmexmGPgzhRhp1qn2l9yJv0JXztHelPZSqGChYCRaNXCKUP0138GqVVo1rSPLc0y/y9d+VEm0KCGfsrDFZScEEv6JGfduOBkrnfjI14mENJGEmid+DzatF2A= 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; Fri, 6 Feb 2026 11:17:44 +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; Fri, 6 Feb 2026 11:17:44 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:41 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-1-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=912; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=VB5Hr6O+hVDiNqHf4IWzXWWPmq/hUMTRLmT1UTc/XL8=; b=DVMNZJJFM2kyOGc0fg3AROPbEbyMedcgMnwEzIJZ/FDX+baSlC97xD7c3fzIKmo+Q2LplEpnn dN9zwzv65FnDj/exO5Cy/4SnL+OQ+4JV7f3EibnBIsNipr7ALUVV6uv 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:04:39 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 0F554330331; Fri, 6 Feb 2026 03:17:49 +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=1770347869; cv=none; b=FhctjcxS9/it+OlGv+UQc2/U9W3pTzDtYCEKuEothyiCNeAVIG2KYcoF2DfgApqJqTNO0NvK0SRt/qBbRJlCu5HbeBmXWGWmW700mPEwMwo1Nmzpw0ej73VmP//gKqwyQTi2CbAgzwiZa3Iq8PQjpxs3foIui1qRx2u/uimRfGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347869; c=relaxed/simple; bh=TvPvwgbTpwSpyw/7g9BTYt5lpmiQYEi+FH4stMJoeMs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=hLlA+ltTT5+4zxlUK+JNsZHmSpeHiZRsxDZbj0GMh/8/AUQSHugKqaOv2dJFCEto6iOHHpyPwrO73/ljBFJ+bYbij7aKubdym6JyUzKMezy/VQqjRcHz8DcXjE+2WTCDQ6MkgeYePtiNBAhb5MW44R9rq79Omq9OWffp6j7YoCA= 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; Fri, 6 Feb 2026 11:17:45 +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; Fri, 6 Feb 2026 11:17:45 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:42 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-2-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=3993; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=NVi1QwkA7JxwSCPAVjGjUYu41AXXsXEhvfrBSk1vf/A=; b=tpk1GakZw49oFnSCjE7N2IehbitaB7Z8oYK3nhioDB6XDrvoJaeO1/5ad0Se7aXQdmVXQz2yb lskG3seCWRAAKoGwPiOVlijdEAw+YlTzQRuDlnK154c8d0zQHEflvhU 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:04:39 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 B6C8A331217; Fri, 6 Feb 2026 03:17:49 +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=1770347870; cv=none; b=oMeIQfq2VVuaR0UK6o1Kn7ZIt1Yb1xiPnju/iYedjI9Zc9+W+/weh25idIQRXtcbpm4Dy3Vs20MfthpbKCdp6dVKSL6nI1TFvuEW+5xtzwv2y59/qsHKvmIKYiJVyWiEpHb8UShW4nNmpKEe6aj4MM5C3nH0P2r0kjwHwxNRj2c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347870; c=relaxed/simple; bh=1bEa2Jv/bTv7bHrcPfXv9ul57tdtU4FVmXDJgJry74s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=PG8zIyyPzsH7KZLe+s/+Mt8654Xr71emrNhW+JrKAGjyKexlo3sNyVFBoNIW0tmepqj5dZCEjmFcc6Xcj4mK3QDnpCpjLqqK0Mv9xR3/UAX/hQ+GYhJ1/56bgdvmD0WNojl1dngHML7SUbWnqFVm0dTQeg6OaM8Qk3GqFOj1lgs= 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; Fri, 6 Feb 2026 11:17:45 +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; Fri, 6 Feb 2026 11:17:45 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:43 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-3-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=3130; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=+aILZO8pus/3meVrNzurjk9uWwwKRISZWHJRBZ3qWxI=; b=YwhHvJhsmNgPnpnwO3u2mjkkfPxJGmLzEDZabIn8008jc7NmBaBWLyYnHQ7mAiC/kU3TzQmD2 qki/i832AHeCkGVviCrgr49OKdOz0f7/ObJsf1wSKcfyApC5UAcqtSU 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:04:39 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 6A3ED331A7E; Fri, 6 Feb 2026 03:17:50 +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=1770347870; cv=none; b=UESFHzvg8iNDT6qJVt+7mZFzojoRK/wHR8EKBbtgi6BzfukJbotnvhAcVtgcRvPU/ysYQPOT7pcpy3jSF+LUkWZ1yDuEKdN5YVdwuCa5fexXOKUZ7yxc9wrH9APPUUHf/UCOVLNdiJ5KpMLu0eAoDFes78qdct9Fn05YHiXDceg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347870; c=relaxed/simple; bh=onLWbZUbnTMgDK4y8kzfyvlIWWGQE8LKDFBj5Fq38Dw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=i6DXNzl12goRiTceLyt8a2VT3ZxajtPWLpWeYm7Sev6Yu/5SsE/ADbr6jpvw56iq7d8Fgl5Cnet6jiAVPpzJeQmvJUuvxpQ3vUzM8OpmdRKzkDyMnRHsoWg4bcZb8ennTSnfdiadVeXQj9hK+w3vdKUGt8fWKOONo3Y1XaBuoIY= 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; Fri, 6 Feb 2026 11:17:45 +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; Fri, 6 Feb 2026 11:17:45 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:44 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-4-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=1418; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=o3nIYAscEW7qqYCVm0zoQKSDXM36iO60MZ4R096iN0U=; b=mzTEFmhAoO1EGxoTUAWhpdmJPQuAf306p5uIk9Zv2GjNTuEK/A6GFxoNOrKorhHgye3bpChwf tfhUHKzU3HXB8DkhZ44qg/530GyHYnDZ221s8i5jpL2n+m2ojy4Uk1u 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:04:39 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 EE3B7332900; Fri, 6 Feb 2026 03:17:50 +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=1770347871; cv=none; b=rFiOSP/VNEDpSt4IfqYeKxsqsDgS/8m0mlysy5V3cQDE2aatlThUUiR6L7tiMw10oUujHIaTMSePjTHo1tYZEYZZMDgK1K4mOZzEDmPMR40s95+TpMxZjc3veYM16Dw4M0kdJmmnqO/KxSdZXsbx+jDMvoOdH0M5ku8V4j9BgWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347871; c=relaxed/simple; bh=ceYR9uOBjSpJRI2oiBkcEl1sbI98TqqWni7uo64dK5I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=jI4ITcZfmWqzzbUt9WDdVmeZq10HYI9NLiuF3Sj8zRPVyxkwSlDmc9hvJSZShQ4Zou09hGTUqIySb0vAaWQHURhZt9GjSGf3/7cWIRTqbyFwZNKR1dxN8J+9VppPkyx2rW8DSxyos/EaIs0HKqEGXoFsaHb8uDIpnjRgepWYYCw= 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; Fri, 6 Feb 2026 11:17:45 +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; Fri, 6 Feb 2026 11:17:45 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:45 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-5-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=1997; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=PabSzzWHuOc4GjJAVT/Ar4WEHvlB1Z2Il9a4L8Pq5xY=; b=7c4D4vThyApvx2dZpOjJtPABlPwmJvlbkshP1PDTo8NDNpMHqERM/E8T2ufoLWEstRqUYEtQc MVGlP7dTBiOCZJs22XKcNszyJFWohvFWtRvOCv3//0hlp3PUjgCcXBv 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:04:39 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 8004B334C26; Fri, 6 Feb 2026 03:17:51 +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=1770347871; cv=none; b=j8D86jRvR7BpoL+lZmX7Y50gjFqWnR1ZN/BM8o9tp/YoXdywSqBOuB60ztK304vlMU8PinRMQJsxsQEsja22ZeUjBu1VstsXeYl0RYmirWU4xXUyKT+3TmT8XCTisOjtYL0bybMv5d62UddfVS9xOUez5ZChVezRWbTzAfDA48c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347871; c=relaxed/simple; bh=XgKX0xdZa46he8amsmEI8h76ecDZ3K1z1hppQLAht+Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=WYAuh3GC7ZruGFPD1rW7ZYhMDswRMMqzhxQURGh+zxka9UBTehrKIRc0AA4ktjST3RTjpfUjCEGwITbWFwKdhGGDH3+Ac6J5m7dXbjkGfQx2fYAHKY6fCN7b2R5k01ctsJjwomPUzuUYiS7B8+7yKjKKBHUEVxWo6uiiw6mR4ho= 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; Fri, 6 Feb 2026 11:17:45 +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; Fri, 6 Feb 2026 11:17:45 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:46 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-6-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=2593; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=a77ZGVgJdbUEVv/HmsFHuKrP2+pmsIXAJ/kpHVOPu+Y=; b=xNlB+zjjhvTUquGAJ+dAvrOFVWbNiZ35LQ4DtFBNYZYS0aoMrerixbAQYFw+96NhQfKaqjmp3 BORdTT+iskDC8+ANkajNu1ti8gWuG+pFxpeei8Bj3yDhhcJ1zGKrIF7 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:04:39 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 1668A3358B9; Fri, 6 Feb 2026 03:17:52 +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=1770347872; cv=none; b=msmlO9l1Fh1xqy+fyRI2ItVR+PNjiaw4ceC9obL/kMZAo1WKP/8g3wi0RF8zCTFZIsav6xpRCypvHs784tSXkv9CcuqLoKxJmg/NHjPVZF6p9nQMli3tEkaGdEQX5fpEbxDwZYLqRcMuTTxzfRxO391lnzAnx/7bjH3dDOcYKP8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347872; c=relaxed/simple; bh=OmD5Arfn3RrbJ25M0ctPE3l/LqvXsbLTQxMzqMnbtzU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=TG3sgwqDx/bSmWsh6ZgTmPqTPJq6FWbtZbLnBAsgG6HIax2gScJcofzz/d+pBRK0S3TmBbzPFlU/ISHC4GVdbyNpKyPrwLlrvoY0Et5IXjaKvft9/G/7OdAKUAp0IjC4Dq5vw8nRe6IEBiox8M73omMBK1pltZSOIJgugyYSgKI= 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; Fri, 6 Feb 2026 11:17:45 +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; Fri, 6 Feb 2026 11:17:45 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:47 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-7-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=1005; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=v09SrIG5pIMosiqozTDRpfXyvuVR8w7kAu8PLHCKIaA=; b=ou+nUO4iudpkB3k/COB2jX5Bu3IxcW7Wy+ZeWnSmw6CPQgW8AL3hnqx/SSasfkkjL09Oq5XWN qCQ7ef4Io4SDhxvMQ0f2CtfrdMv2uF0c8LglmXTjjVz+JHUabIzsgBO 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:04:39 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 9A6DE33066B; Fri, 6 Feb 2026 03:17:52 +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=1770347872; cv=none; b=Jl7fg6EIf0MQINX/jmbhAX7wTn04wN2jeRcMnmSDm0fnZYaxnDUAt3T7/eZCChaiYTf839paErHTmNYImRv8HiPFSzs70KA4sNbm/8NI4wqzuF4jPCsVpy0kvE9Y04loHT/K2EYOlzf+E3hmJDreC22/14+jtmNlgNBfQI5Dqnw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347872; c=relaxed/simple; bh=gSbia3WaxEeZQQY7TAYAQOtiprwaE2po05CCkXzjtb4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=J4KWiqFmKqOSN/dFdZ/1EHA7vBo07eMkvoHHUdeajeOwBj3z1+BzDFrNRiMWWJDawD9ZwpZ8gn5A52WdyHrAaUSedEQB2fKIc0FfPdfdrgqStHybeX7vvg4/H3aZawSK6t+w9QuxSD1cBMD4Q8u3LXdfi6JZlA5K4q2JHyo2+6o= 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; Fri, 6 Feb 2026 11:17:45 +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; Fri, 6 Feb 2026 11:17:45 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:48 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-8-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=3472; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=sCcnFPaIUzRRKY8OtbSsSiEnVCEq64c12O3rmhF8S6A=; b=Jp8XA/sbqUV8gZRzPq5Vg5WJgStsWb7WvTMbswD9qr+O6V8qVtIJA1oeOU5wnEQgiO67eSBXA HAXd/v+06PsAOdRNmcGtuRi8fL4LulIBLthbha/unGI26p3D93HlbE2 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. The refactoring results in improved cleanup of the fixed PHY in error paths. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- drivers/net/ethernet/faraday/ftgmac100.c | 72 ++++++++++++++++++++--------= ---- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index e511d6d5f7c2..c9d25b9e6502 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1839,6 +1839,48 @@ 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"); + err =3D PTR_ERR(phydev); + goto err_register_ndev; + } + 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_register_phy; + } + + return 0; +err_register_phy: + fixed_phy_unregister(phydev); +err_register_ndev: + if (priv->ndev) + ncsi_unregister_dev(priv->ndev); + priv->ndev =3D NULL; + return err; +} + static int ftgmac100_probe(struct platform_device *pdev) { const struct ftgmac100_match_data *match_data; @@ -1846,7 +1888,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 +1969,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:04:39 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 2B57B3382CD; Fri, 6 Feb 2026 03:17:53 +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=1770347873; cv=none; b=pU7wgsWgu0DHuFz67XVL83qM7JgQZAAScE9z577Wf778XU0rDLd4VShtoU5snaO8Qbxkwsr+oSXX+WNHQXrk/woYzy3duoBeXGh70Xr/g9WjxWhvg5JO7foh1zm9O2KB33ols6ikFiHt66/mPOGPXaMeDyIPkFyuB6xG2PIdRn0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347873; c=relaxed/simple; bh=TmAhmpVU/K6bSx1TMPCmo++gIA3hhZSpYByFbTdRTzQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Dvy3r1uUB4F6NLYDeyQc/bMI2+VnXTfMijjpFcJhdSz+MY4esICzfAHS1YlOjGLi1LlhelgGayfNQubagQIu7zwlFveKoyt1G1F/eRmJX+kZrPQjmVALnbXYwIx6L/6P5DUWPQhlE03Hpsa9QPX9K305fv3m2m1qSuhWdq+DufM= 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; Fri, 6 Feb 2026 11:17:45 +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; Fri, 6 Feb 2026 11:17:45 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:49 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-9-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=4335; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=Ep5MV6/vjVSjH5v02iKeCNqBfCgE2iCrknDuVcuy4gU=; b=Gfkl9kuFFf6W0gU/ZQQh78C6Y+IV3Zz8BvcU5Hu2BVAih3f8rhD8wz41Q7x+Bi4NCx1KXzzg+ fGkrkW+wxk4D0u0EZGnrig0vfa8GW0u3Yuy5C9JWnvOpvM7IhkwGaNG 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. AST2600 uses an external MDIO controller and does not have an embedded MDIO bus in the MAC. For such configurations, the legacy MII probe path must not be entered without a registered mii_bus. Add an explicit check to fail gracefully when no MDIO bus is present, preventing a NULL pointer dereference while keeping the intended behavior for platforms without embedded MDIO. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- drivers/net/ethernet/faraday/ftgmac100.c | 45 ++++++++++++++--------------= ---- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index c9d25b9e6502..c33726e7bff6 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1483,6 +1483,11 @@ static int ftgmac100_mii_probe(struct net_device *ne= tdev) phy_interface_t phy_intf; int err; =20 + if (!priv->mii_bus) { + dev_err(priv->dev, "No MDIO bus available\n"); + return -ENODEV; + } + /* Default to RGMII. It's a gigabit part after all */ err =3D of_get_phy_mode(np, &phy_intf); if (err) @@ -1968,32 +1973,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 @@ -2010,14 +2011,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 } @@ -2025,13 +2023,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) @@ -2067,21 +2065,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:04:39 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 B130B330D3B; Fri, 6 Feb 2026 03:17:53 +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=1770347874; cv=none; b=UFlYJTQPaYWCp09pW8PPc0uiAqOXOl679V10vcuIcrgu1CMERNRMFdPWJkDlCJ1a54Q+iV9OJNy7xlXi/kenqzB9pGxjHUM8QnaGYa4xmwvwMcRn9A1xV9bvdDg2zkRRgyM5X/bOzqzHNYOr9cx6vYt24HbWDquM4YLqHANvgAA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347874; c=relaxed/simple; bh=Xm43c+KKic+049Qk5F38DZFCb5ouFHXJhHFJPYfLQ2A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=l97fdVex4c9pdJirA+CGViY/lwv6fuzOc7oBuw7UlwMywRR/HS8NMkDO0e6+R96Mu4vo1fWdaFe/rXDvsWfrECZ4uJAlWxVUXKJ8jOidvE6njKYO7rPws+y2zZ3B7vj0S5GwPtQ5o0Hd6C/PlnnJc6tBi92c+ZIeD8UWqGStUqU= 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; Fri, 6 Feb 2026 11:17:46 +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; Fri, 6 Feb 2026 11:17:46 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:50 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-10-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=1096; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=GTkRyDcl3ULtGmvephJdZgK7CRofqaRfmOgtTmD+CE4=; b=8NPrYO4IW6skyuBdvLBKg5s83NXq0BNrT8EUcmxwurvSSxiXecjvfZgFs4ItVdCIDnGIl5ty/ xFk2xmVYTnFCQ8uDQ6NQ4CSL/JWP3PDw/OF+Eph6mwV75y+pxkTBCju 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 c33726e7bff6..ee886ed03587 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2010,8 +2010,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:04:39 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 4371E33A70F; Fri, 6 Feb 2026 03:17:54 +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=1770347876; cv=none; b=GN6PcxYwEXEZ23LIIYnlzH5+4+L/RMzIEtM7hYCm3USyK/6qXNFbGEy6iVwAwaBbxWZ4IoQLZkgJaH0yl5yUvWIADJGipEi6YyuJ8Z1euC+VVDlxFnaVlaoTakj2s51BT68XtIOb9RZ/ygTWifNQCFPV7RK/UyGrAhZhx6GOzSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347876; c=relaxed/simple; bh=SFd9fj77BibhBkdQDezvuWhWXH2DxQ9DRn8c7rnsi0A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Jq41gYUIuwt00SHlvHgsaZp2fXqt1bFdtcTrLN9Tm+h3m9unWDklbc5JBl1dmWt6R/1/gqpL4vzPBNXFc2rR73rohwj35JYeJkccOzMrxD+VxvOJ7K3z+BHwnRtmBzX5j+n1H8a/aZTQ+i7vbHRzxr6I2dBs8yvybyyQUmQUeWs= 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; Fri, 6 Feb 2026 11:17:46 +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; Fri, 6 Feb 2026 11:17:46 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:51 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-11-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=3722; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=7o3Grdwedb8a9iXtcWUwowbRbDphr2VvIKjMaSv1qKc=; b=yfmi9qLQSEZF75vPMCvZWib4rIvzNxaybCjsr1s0EZhqyDOckAn19K1HccRoCaO4iptkIWVCt zM5LuYCzRatC8HEXzH36QR2sia/pryjwn+ouzQp37LGzJ/ROyq+AJ5u 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 ee886ed03587..ad1203b8de0b 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1886,6 +1886,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; @@ -1981,41 +2033,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:04:39 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 C5AB3331A45; Fri, 6 Feb 2026 03:17:56 +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=1770347877; cv=none; b=ufgpYOKdeeYz+gYhj+BMcpvOXaWvi/b+YsQXbPNbfj0B4UsaDzNDN4MLS/0eRSjp+gnzhnLEKFJkH+zRl2UFoHCR4AZrw9wZvAyozb51gInwQA/k8RUPER7S+KxKr+51bH048PGHf1QbcVMF0CGBSJbRN8p6YSsTl58Sl8jp2yQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347877; c=relaxed/simple; bh=3kbjmttSSZxHiIqKVErl4TXlbtfsMfAoG6c7o9Segsw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=gscepBP3Yl6iuBbbKQiCsHYHjJ9QFePFi8xECzR2B3J8VShB7ibF2xNzcY3WE8LxBfOivbeY+mKkxpsVtXhAzaWoPjkCQ34GLcWDfSg3ENWXo6cuA7GWpGZef2rYd5ARalAlBufS+1HQgKbudVQhvK+RfLl7R1+Gwx9PAEiq8HY= 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; Fri, 6 Feb 2026 11:17:46 +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; Fri, 6 Feb 2026 11:17:46 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:52 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-12-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=1321; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=zvaO0l69fDQ2LJXMjMPiRZVBQp5EpLhxBNOqvHf3sTo=; b=c5IN1Ivtxqib3oOrXRFIbU1YIZ1TYzsd+48q9SX4leFRv0C+jt7j0rsHgGJaQjjF4xsAMCiTv jQHF0os0bSgDc7NciFpS7btoCV1n5dxpCKUI2pHbItJMf8dQLy/MSWM 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 ad1203b8de0b..b86e47853217 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1717,7 +1717,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 */ @@ -1745,9 +1745,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:04:39 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 52C2E3321C1; Fri, 6 Feb 2026 03:17:57 +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=1770347877; cv=none; b=kZ6o4JJqeOr/iTT84BTw+EhAnoxT4SQS/6tppCl8hGhXoRAKTTAfkcySPTvSjjtGLXn1Eanc9+vTPN5/XIU7EjwmSqfxWVc+EYdO/eax4WH+EyrUfA5xGQNBZUNZ+6GTCa1j8UekqnbMli4paIogzoB7zipnB+uBNatZ+GJtdKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347877; c=relaxed/simple; bh=2eLgKfiLnplFPzX/dA44OcUWfTOFdBJt5swsEo8OQxE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=UT5h/JOHPzzCBB9F+DLaqvmHbSbD6TZOn4x4eHlWI8cHHrSp/k4StTc8+7gywDA3s+37TWdZZXufRZEvchAd1gn25XRO9Nw7ZpIT7sLLh1Shtsi81KrxGo0zZN6FltyIdZnwDvBsoZ48kq39ZqPSIrLBSg38zCdwUgAwKS3pLhw= 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; Fri, 6 Feb 2026 11:17:46 +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; Fri, 6 Feb 2026 11:17:46 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:53 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-13-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=1250; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=a6+86liO9P7vVmt6XhKmL9rOJB28akHl0QZT32CiKBE=; b=3E79w3guGEi/By28j8Nl29XOUpeed0GZhIMVRlACuerofvcGUfopBC6Y4P5ku/7KDVvOPrIhF SgwOjqHX0JDDax8jdY/Tg3CqlXPeXTkzg31FCJmraRDB4m/0Dxla8G2 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 b86e47853217..410c5ab82516 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2046,13 +2046,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:04:39 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 D446633B6F0; Fri, 6 Feb 2026 03:17:57 +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=1770347878; cv=none; b=clO+nwrw40/UFleVUNxyafe2ogivLjNnX1YFGaUSQ+G/f7B9NZHLvFby9kZXjMO1FcOHFjej48e9jRAT5gNBuCLC4J1+sRqEsJFQc4si0woTezYFjj4vf3KxPeSuqhYz2mhG9dTJnkDZe217JsmMpAP8brtkF/EXBSpFLgmmpps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347878; c=relaxed/simple; bh=9TUCgMWyIOXck17MyXsVumlNExY7Nv5ockWi5VwFB8w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=C9nxC6KLpbbICG6jvUPnqDuyBvbgPd6XBIFRZrETj+apDWgr3f+J62vNQYFDOccNdhmcEsgx8p8G9vJsOaOx7ZhqpxuDOm6nLrI2sjZ22s9H+WqjH43z8gmbMK3Kl7L+yCei6RDS2h0zso3RlGVqcELNGMSMVgAPKE5tbhaf4VA= 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; Fri, 6 Feb 2026 11:17:46 +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; Fri, 6 Feb 2026 11:17:46 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:54 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-14-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=910; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=MIsUnnlbI6MdwX8ogzk9hcMNHvgSeNjEupg3hrlqQLg=; b=bTXTUKm1tTkKsJm9rOkIb/XZ40di35efmUxA3oU+PAmGWC795e5wsleyaf/PPjnmedyKr9KoK odtlxF6L+FrAl6ZojhuuuXw3EZNG4XQIMhStBrqoBwCSvii6LsM2Z5u 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 410c5ab82516..e3b69451d436 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2115,8 +2115,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:04:39 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 6187133BBD4; Fri, 6 Feb 2026 03:17:58 +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=1770347878; cv=none; b=KoV7bkXr3mWzgybBqA9YkEw4jA/6mJ3lT04F6YRup4J+8PEPweB+QRX+19kfNh87v4mBa4lPi/yXAETaCZGsrn0Nrg3KcIYnN4MECNwXii2WB3HB0NAQFvpwrzWaAKd0wmQ27F0UEYn95r3tdnLxp6TqvMBIhjbDQ4y7KqVjHeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770347878; c=relaxed/simple; bh=TJf4Sw5Eo7AhuBhHi/Rv52LkMC36J96XB7cDcL0QAUw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=siX58jPcYaoCw6rTatTUxxiDr/SGZ7qUnM92ibVHb0sm94bWsr1acOoV+6v847h+nWZyBifw5YvA3svH0BG26laWrR5O32Gzemq0R00anpwymzQ2ANUi1bOo1jrdTRt9eA1ioXbzVG9UqlOdeSoAl0PIruw20d2wqkN2vV8iX/g= 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; Fri, 6 Feb 2026 11:17:46 +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; Fri, 6 Feb 2026 11:17:46 +0800 From: Jacky Chou Date: Fri, 6 Feb 2026 11:17:55 +0800 Subject: [PATCH net-next v5 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: <20260206-ftgmac-cleanup-v5-15-ad28a9067ea7@aspeedtech.com> References: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@aspeedtech.com> In-Reply-To: <20260206-ftgmac-cleanup-v5-0-ad28a9067ea7@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=1770347864; l=2368; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=TJf4Sw5Eo7AhuBhHi/Rv52LkMC36J96XB7cDcL0QAUw=; b=VIY+2RFcpIs0L6kEjpfmzLOfB4WIdvh62eyBXWc2fBViDd2gZbBUWivYNAhynRJkvjpVyWk2L ByQgUZaUYqAAvZHybt0SnOZEOWbwbIyed9EXuENIK6ON3JlapyYRltw 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 e3b69451d436..1e91e79c8134 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1721,7 +1721,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 @@ -1747,19 +1747,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) @@ -1778,17 +1773,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)) @@ -2092,7 +2076,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 @@ -2114,7 +2097,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