From nobody Sat Feb 7 17:09:45 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 E13DA359FB8; Wed, 4 Feb 2026 05:26:38 +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=1770182799; cv=none; b=pbdc1YYEXOvzx3GchGS1qGLX9vwXaQlSM+3+eLqTb3AuG7jL2Feak1/JEgVcQL6pXCTPd9xAcwXEQITa5EyRZT7K7AhoWTETWwYgOC3slWONtRhe5Mgj1aRUPKyjAYYoizoA/KspHq8r+EAacTdwrlmM8Gm9Kpy2S0nPrd39RXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182799; c=relaxed/simple; bh=rPxIS+uhUzsKBY2yjgyhHwqeU3SRBIHj4tyBgoBhwGU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=CewaF10/J8WtzamKLPd/10v2Vf6X39XdhmFM2nsd/0x2m4cZMpQqLmMym8pZf9P/dYBsce6rCcOOfvI4UPUEqsQoHKAKyHgKUCXRGMpffFSSbKvS7sDiajBVUt9ZvVEa9W9UdAL+BA9Za85Rc9u34zgrayHvY4UrFdJjy7cQmzs= 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; Wed, 4 Feb 2026 13:26:30 +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; Wed, 4 Feb 2026 13:26:30 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:27 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-1-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=912; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=VB5Hr6O+hVDiNqHf4IWzXWWPmq/hUMTRLmT1UTc/XL8=; b=+MBDgATCI5C0EsaPH30vsOwyIwJ7CuXAi73C0WrJtvms/z1TqDMQo5YWgY27HviF7xDjuNHvQ mmoKqz00GF6CS1UXirxBtHt4XJ/IXDC9q/dUxBqX/KuDINAx3YHdUWm 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:09:45 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 B8A4B35DCF5; Wed, 4 Feb 2026 05:26:39 +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=1770182800; cv=none; b=RvIDBm+MQ8jFVyAw3T/FNUlmfU1t1/C3nSaXel3wXkuXkK7TKnGG2nubUMayzRM6GORHvL9ssXI6yBZ+sHfuOswsHOsJgYewNJl00L3xWXHQ0ltFAgGYTKGbadSUEzP+wGuap5A0AZS7xeCRa+glg0807Ik/jNnEFP7IyPUsy/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182800; c=relaxed/simple; bh=TvPvwgbTpwSpyw/7g9BTYt5lpmiQYEi+FH4stMJoeMs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=dGEdEzyasFP2d70Wlv8P+BZSF/BRVyp0N31z0SmMPjrKjUCupWBMn2tvPD0gE1qMFvDaqUq7RqSna+o5EnG5gkA1pcRKFLeT0FMU73ju6zkA0Wy9rATVaHOMKu3/4xR3Lq4hyk1UCUlSPLF9Jc0+Qta07DstzfQY90abu54GKSw= 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; Wed, 4 Feb 2026 13:26:30 +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; Wed, 4 Feb 2026 13:26:30 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:28 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-2-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=3993; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=NVi1QwkA7JxwSCPAVjGjUYu41AXXsXEhvfrBSk1vf/A=; b=MwPg3dc0U75jkpmDym+r/7omlM2Zg7xzu5P0eizPp89TSyN3mWzBp7eceQgfvYKPIrfkEnFyC 34ZvxeFZLsJAu9+5XR9M9bioyXRmirTnnnXrmbg17PyByDsW9He9fyZ 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:09:45 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 8CD013590BE; Wed, 4 Feb 2026 05:26:40 +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=1770182800; cv=none; b=oBINE//O5jOk7a97gp3ihLMibU6tSWr47skwPOYfTcqJbpPu/lzJv/ZM5lcI1vxegJ+sQvvoi4I5G6P9ur250M0uhdabVIzQPTspNlZ+456RO4DQu7xMXRAuG5dLy13C1mfsL9tBcdF7pMyUqy7HQc50/u3P2h7HztcQkOMdVw0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182800; c=relaxed/simple; bh=1bEa2Jv/bTv7bHrcPfXv9ul57tdtU4FVmXDJgJry74s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=rnQvUJFvR5OfRRggvd/mYiW/e+CAO01DfNwv6m8WbJjFM/jXF9Pmij5IzgpjoQwaWkRj9lqGFccs5QObbVM4Yzd3cTsf3pdebl3o6hRRRQH6eG+Tqf9x9/qu/sUfLDOr9xOukvrdG9sfnKA2P7Y61fTN66VSy20DDzTTr/CLlas= 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; Wed, 4 Feb 2026 13:26:30 +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; Wed, 4 Feb 2026 13:26:30 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:29 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-3-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=3130; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=+aILZO8pus/3meVrNzurjk9uWwwKRISZWHJRBZ3qWxI=; b=SQI+5hqierrhpffPOQcAD+3Xo63lCiXo1Nn7MV22b3JWr2zVGu7rCrufqUU7r1axAtjhPIXS3 T9wtJ91M1TuC/nHfAYB4MJiIrjdFD1ZdszWoXvXdj8x+Dp3hpq0AdSJ 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:09:45 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 213D4366814; Wed, 4 Feb 2026 05:26:41 +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=1770182801; cv=none; b=iI+JV+2om05Be9JBYHPVeg04KHQep8v0SQUJ2NYWEUn7cp4BDlD1p1FIhSxsXd3FzelhbAOOl5ssXssqZGk3qKj0qXeCrCLNhVaokOa5LXjOgr1xJ8gMvRhpJyni+30WKb2iz05fb3z0RhDhqsJG0hVEWirAna7iuMotbnvF6X4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182801; c=relaxed/simple; bh=onLWbZUbnTMgDK4y8kzfyvlIWWGQE8LKDFBj5Fq38Dw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=nZ4gRN+oXEw9KWSO2NVFeMNh7boioyORdeOqlPzS4ZS6KzCgIA/tKiixYudQSIZBFhntNoMQEQIw/LguM8fo3OsXsPtws/8rw2cx35spSpWjDqscD8GAo+fzhSDJYsgyr/FlsM2rLmwr1e4DK5QkAiqXaXLAzvqP04ngN0oeTgM= 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; Wed, 4 Feb 2026 13:26:30 +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; Wed, 4 Feb 2026 13:26:30 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:30 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-4-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=1418; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=o3nIYAscEW7qqYCVm0zoQKSDXM36iO60MZ4R096iN0U=; b=FfQWVi5FdhqbaC0Rz9e6BhdGZ0lHXWkXaD5xxB9cYcE0fl8pGcceYwKZhC+SFUzID7M48EzQA KzPoQcvltWnDSPdCZNHFMLomPvg+HDhnMCAEPV8blvszm+dzV1j72fA 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:09:45 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 A8C3A35C1BF; Wed, 4 Feb 2026 05:26:41 +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=1770182802; cv=none; b=GrXnEkC72SBFxK7Wmoq4ZFoyH+eWN/6j0xzuzZFAQICB65HntgjJIfXZWODhs6y52w4hesOzogMRiCjobh+GzKbLbI50tpZUgbgZ58VcGbp38q9WmTgArAfseTPXz+Yf5FOTYF0r2f24rVzmsLkLJqZnRHDaMxCOOhPL6yzw80M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182802; c=relaxed/simple; bh=ceYR9uOBjSpJRI2oiBkcEl1sbI98TqqWni7uo64dK5I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Q4cQQZ4Q9fyQ+pBiedqTxaAt+sBUWcfxcUxx37AGdBed2vPLzUFPml8b3F4lygdYnHCsJzlV7iPB8QOn2g5dKeXt4QW7aNaNV3dFFp04QoZaDD9euBLs6QmCQsUBNyEAP0t7oVpycbxrjXgxgyT4FNFG+bvEJ+KiPI8fRsTmDxY= 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; Wed, 4 Feb 2026 13:26:30 +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; Wed, 4 Feb 2026 13:26:30 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:31 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-5-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=1997; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=PabSzzWHuOc4GjJAVT/Ar4WEHvlB1Z2Il9a4L8Pq5xY=; b=x18u2Me14OJPiAJYmVMqV3pk2/phB51jJvQScz4YAORox3GM5Vowug6Y6XI6LPlj12ZLm+kQD 59NrLjrnKMEBxbeHxtYeENP4pKX8A1VH/kE0T9ZcmDyRFtG1IM3ozUm 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:09:45 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 3F6A837416D; Wed, 4 Feb 2026 05:26:42 +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=1770182802; cv=none; b=sAJPbH03I2fa8IZ0uL1l5SFqH39CAK6epFFPNGb43RYw5kwFZjkCPp78mWXIwZMUWlT6J3TwDgOWD6RSyqK8NMq5YKQrgmsrzs3upl6myr7/v/TWl/fvz7TpPf2vBlQyXPj+hbCl6LP3BhAa2LrG711xW47sMvQ7yVhOg/WFZ2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182802; c=relaxed/simple; bh=XgKX0xdZa46he8amsmEI8h76ecDZ3K1z1hppQLAht+Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=jKtv0PBbOoyaVWGt5O3LFOSUgIWrxhlHNNHUZ+V12nf76wJPPO53K+wDKc+llO/XMkNAG9htFD98xwI9jAUzDRSCJrOiJFsPBB44G/HnKEBnKGcYvBnFVp1scfw8cpscGCvRhlP/7M6Uust4RsVbxbslVIziM6SQZdOscxVMDnU= 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; Wed, 4 Feb 2026 13:26:31 +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; Wed, 4 Feb 2026 13:26:30 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:32 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-6-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=2593; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=a77ZGVgJdbUEVv/HmsFHuKrP2+pmsIXAJ/kpHVOPu+Y=; b=f42Djj2MFdswJHllugqy4c0ba5oVcYJPSUsmoj3zkFuAQ/aWYtPZ9+XuWKhI6tFuUpPl+hPJl 7709yWwAyFfAiDKRiisMRFTOE0+g3QGkq0Yq5W9ymtigXFqM7KUIX7i 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:09:45 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 C7C88376BF0; Wed, 4 Feb 2026 05:26:42 +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=1770182803; cv=none; b=fkOuZLSIjFF1VRHxD/xt9HgCLChXe2vt7RZHIUztJ9qjubFDmghsuOsaJLLWINR2aSpNEwAnga1t8Jo5lslhQnzF5uAwpGf5bSq2ImwTvrwuNv+5xzXxuV/DCsczRUkvtc/sUqI6sST9I545+DjDK+ZyyG81gt4E2kqBepjEWvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182803; c=relaxed/simple; bh=OmD5Arfn3RrbJ25M0ctPE3l/LqvXsbLTQxMzqMnbtzU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=EHXMzpF7heemQaCFwdnFuh7xNz8rDqhjDtccFVoqMVgwU9QXQ6f6D4kEe2E9Q0wU2qVgAW6su7LSyqA0+B0G6mtxvYys1oOPzbigI/DFaUB53TmuR63cy2s5ZUOAaLBbp+yx5kWrlbmoFOwNyoPbQvqClTbpT5EDWv52NnTaFJE= 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; Wed, 4 Feb 2026 13:26:31 +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; Wed, 4 Feb 2026 13:26:31 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:33 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-7-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=1005; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=v09SrIG5pIMosiqozTDRpfXyvuVR8w7kAu8PLHCKIaA=; b=3mrG0gnqLqR8hDPE1y3SsmJLru/R5iT9xfinIlT12Rta5iEoHziD/sUNlxjZqiifWc1rcXFTH aRhrALXpsgDDnoCGHGYQLsrvvx8EMzUHun0l8CmZOpXBUinhCwvQfUg 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:09:45 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 5B6DA35E548; Wed, 4 Feb 2026 05:26:43 +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=1770182803; cv=none; b=q7CVWZSnFokWmQwnenBVl89hegPbTlSggBS3lCwIaCwXIFAXj5hxwk3jQeasNT7qMP6SCEFKA+z7471Zpob/U21MSmjiOX2nn+0LM1Zr9Uv1F6a/lJ2o2kpWy7m2u8RHLCTYVC3Ubg0DF/4LenI5rmfqUfYtGCWglqLRz7FjRSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182803; c=relaxed/simple; bh=J3dX5F3ZiK1SpSJ+nrfRy7k8oQkQE4tDxcff2zzXXEc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=MCQ4J1tGnhyIpyWKzQMkFH14x6CCW/eGNmMUprPH/ZwL3TQ21Hu5X49OntcCQaJiIQrCRI5gr9mv57Hq/kNofHIopSuQH9/hWH49GXSjdhT3symHpxXHetr3/7HsHHSggSuQy51GRax6x+xDl7hMuO1ktPOiCnPQEfrkqwaR/rY= 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; Wed, 4 Feb 2026 13:26:31 +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; Wed, 4 Feb 2026 13:26:31 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:34 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-8-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=3399; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=tSDLCPN7Gy5XtUmczxDf2SPRsE7s0Ws9LgjKXnfvqC4=; b=VgCgqTEOmUg2vbFBODrpsiettORswZAjRojrgQEoZgUF3eoShTJBYOYev9vUGVuLX6IvEslfy o+uDdtAvRtoDgO6fjfEkd0XEH6iVBIFeYkq8IKCeP8pJ5T5rk8nckx5 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 | 71 ++++++++++++++++++++--------= ---- 1 file changed, 44 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/etherne= t/faraday/ftgmac100.c index e511d6d5f7c2..1e52c4785b49 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1839,6 +1839,47 @@ 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); + return err; +} + static int ftgmac100_probe(struct platform_device *pdev) { const struct ftgmac100_match_data *match_data; @@ -1846,7 +1887,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 +1968,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:09:45 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 E3A7437AA79; Wed, 4 Feb 2026 05:26:43 +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=1770182804; cv=none; b=WKL7A6CPf/GE0K5SJ6FUrhlJR+IuqSuS3zBjUKf1w6y+SRD6caCDcQu0GNRcndG4Bs0mkF637L6AoWxkLnWGNz6oNfN8NIeYjrPVjdzcdOjdCV/qs6hMLkgHV210x66Bd3oPMrxRwN+ibVfQm9Rv5DQJWA+lkoHcAGL0nhXkwC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182804; c=relaxed/simple; bh=iriX92M1zIHCRmd88EI1TS6+DwLwGb9Rr2XR0fkU3Ys=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ohY2KL9hsZVlexHwgEkggIWj/OvAVJekzw5O2qpGFAZBUyjUEe0lSE1ReMOmEUUcpoUGvgMmolai7LScbEilZ450M0eTXiwYLtt63atR+Pjx0D3Ea5O20JlxmrjBjrPPhEMNuGaLpnptdbHrfjmZvSRwXo/fr+YEH7em/i19soE= 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; Wed, 4 Feb 2026 13:26:31 +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; Wed, 4 Feb 2026 13:26:31 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:35 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-9-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=3611; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=p3/DDR8AqAz/x6dmOVmUzbO5NrzREzPYAMKBbE/SR3w=; b=CUMC8lsFUTx2H89UwaT5jyfaPTpiipbiHvrXvfc52SbotT+WLXXGdbUTm2QDbq33Sy1608lHG hqUxcI6KUT8DYRc+PFxNm4/y3lv4VLDymmN5xUlfd8fdPcdvYBeyEzF 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 1e52c4785b49..7d6e7f2ae969 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1967,32 +1967,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 @@ -2009,14 +2005,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 } @@ -2024,13 +2017,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) @@ -2066,21 +2059,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:09:45 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 9A2A835FF67; Wed, 4 Feb 2026 05:26:44 +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=1770182804; cv=none; b=PJF/s6I56Acxo+E/4EQ+uYQGCorT2i6Pdf0H61RAuONWQNVVkTilJIP17Cr8cxn/1XHLmi3UoFxq+8IzwzNmPqH7HxI3P3eZeqcIqAwJ/OG46Me32454kQZeC8M557LV8uLJZH96vpzlP20Qn4HsCZx4J/04Q6/fvTabbtfajgo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182804; c=relaxed/simple; bh=V2JOY0gasY29VXtxo3LEmIpGkBi9oafw6uc+/ZJToXU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=rCMrXyXAIZIgWIs8NpbhAD2fqI2zGyyAA/F5BgcDUAHFkHb6upl6RWgo64Wq7LYazy+LRadXNI8p40Y0FKsyPa9JfeCqLs/4BW2er2/97sPH8nPKJJ9XWPsaXs5umlhGuGRN8dwkmE1G6JYdbt/sKCPNFJAp5SFBTYNTJSlVySE= 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; Wed, 4 Feb 2026 13:26:31 +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; Wed, 4 Feb 2026 13:26:31 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:36 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-10-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=1096; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=DGnv6La43c/7aB3OKSk34oqJb6jYWEE5545lnKEdofo=; b=qqZcaGrIla4O4xY9Jwr/x3dYbntzuA/JNS4/QvcEmZcgCnBn4J1K1IV0zwTj2XZPpwPgxKcxy KFsx00KtEdrCw7e9g8heNNrN1NxKHE85FzLvyrwRzg2ngif4Sh9v/eb 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 7d6e7f2ae969..debecb21bc8e 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2004,8 +2004,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:09:45 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 2EBDD37D10B; Wed, 4 Feb 2026 05:26:45 +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=1770182807; cv=none; b=fUz/DTlrmtnGb2KUqqPcWqZfrOm9K4Q2u9acwbtn/Keopss61QXyiu7ltpbVzJ8UU14bvRCttgYiGmGzxqrETsfgmtUlebpuqSmyOuMkrYQrjWJMHqnyRHJgtU6tkc5pFeAKOSdo3zg/FCE6jmRdXWsf2QStFQuxmzx+yyvxH3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182807; c=relaxed/simple; bh=tWOfF1oe4jVsLYkHEbJXRT/47EILQVJRq0KXBSQikqI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Cz0PFI5EEXV7yVchW/Pr3O7nhYIEtAXJ2WnAbythJRyUJT7NqfLbmcMpFRCPykacvv+uONFCvad+kXvAq6I+7rYgZLTnqTerM9C4C/AEVlQAxd12dBiHNT7MIcKM0JGQGyhVcsq5cqd8DV3W7RRJGqdTevE9+7VKT0sjWNlxcwU= 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; Wed, 4 Feb 2026 13:26:31 +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; Wed, 4 Feb 2026 13:26:31 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:37 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-11-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=3722; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=+MMfrmLNqcfeYr0WGv/jZamPy/UkATuVhxePKwV92tM=; b=v0931nqvM5h0SHniLVa7muDh7ep2FU0zfPgg0qeL76c7yUB0EMwn79dyWdsXVxaGOe+32cbJD juAHu9exUWEAcKqBFux9z/TgU0JtVJdn2Xy8Ej38NfaYNqFgocghy2s 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 debecb21bc8e..1c02660b8f96 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1880,6 +1880,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; @@ -1975,41 +2027,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:09:45 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 B641F3644D2; Wed, 4 Feb 2026 05:26:47 +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=1770182810; cv=none; b=s/qjW6aCGVovzZDJ/81yOFEfF+wp4K3dUSwZ2hh3gdsnkvFmr6Ao8jEfWOcGp4tv8FJdlVxm4teA5Rfnqs7IcNaTKlZk4n2UbGeLWlUEn9uRBTPkmGxz/YfAz4rV3SJsRc59k6VPtMc29vv90y76FkonB4kK3ltlFJjtlqCLZ4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182810; c=relaxed/simple; bh=471njwjL7QH16iQLFFNaaEQsRgbpFzhSLY3wfbfJexE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=tQD/w2nMx5s9Plwkd+dujnYQ0XI255jFjspb6JvmbssAnQiW0ZMCgWqigpg+FA9qmogDkAYqGg9R7zH0hGsy9KHaqfOrUzhu9WpBAbjltGjuSk2cvTac++rvaGqFGgeoHO9pRrigAHwMjGrx0BAnmgpsf70mKVq/D99wvZCyeVE= 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; Wed, 4 Feb 2026 13:26:31 +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; Wed, 4 Feb 2026 13:26:31 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:38 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-12-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=1321; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=5+muffs8Bl237UUbs270t5MmAvqGM6B99cKxqCf504c=; b=vP5i/GFYdElRqDSNnq/lxUFc344/M7iP3rYVrDMRraontraRcfJTsiLcJvmDHRKA/baOmDINa gEObmlQTFpsBuU0cC3+8GZrnpLlCKn/GlHvUv1Xpwm1Ov4BZ2dvN3mQ 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 1c02660b8f96..d4d686066f2c 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:09:45 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 49C3835CBD3; Wed, 4 Feb 2026 05:26: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=1770182812; cv=none; b=Mv31P1894RsKHdS1MSVcg15gLhuVYtRGFcbzcX0je9H0z3AnDmABxuyL3zoP1pny5NJwisS+8PweWn8cl2unpUJija74Hz8XlhKG76u4tFWScqOpfuA3fqllLad/+9vZLHcsnWZ2ydibWcWIn0wmea1osqFs+E0+Er3DvlRPxdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182812; c=relaxed/simple; bh=Yd6vQEPj4/+WhzY3jDwMf+4P39ERawGAPA74SPseMMg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=LZipvnBYNchb8zmzLZqBw6yZBgzrPBAtg99G4vXMHKkGZlhuqkbxT3EI28Qmvn/En217RzC2oneurtaEU55ucaKp4cV9iE+T9N28f7e9POF7kOXdapwQjNsqi0PJuc50Re6J6YuT9DbjxrbxJisvpTO3Fbnvpa7uerA9snahymI= 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; Wed, 4 Feb 2026 13:26:31 +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; Wed, 4 Feb 2026 13:26:31 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:39 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-13-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=1250; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=o651DaCpvZD+qCiXtLl6WBoDBGKdbexvwRsh4kVsKfY=; b=WVJlds0BrZaF7epP+am4/Br9PcpRkvYCNEiVENI6Z4P22e5pVTRIOuANAizAtP+lVTBSw4uED Dmk4rDHxrZ7Bc3gIvyVjUQ3CnMBfwvzMtvks4QO/ovGDTQtx/xQzLxx 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 d4d686066f2c..652a20a7bfe3 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2040,13 +2040,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:09:45 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 D1355374194; Wed, 4 Feb 2026 05:26: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=1770182813; cv=none; b=eRCU2CCZTuQybL8S+VLuUDGNyjYGNjp0nxs+m8wH7ygWUO2g/fUONGwER2Kaxg/GNHbEMlR5Wc39V9QsGCzd4C9M/FEAoo2cadAPCP1JHVoUQLGzJJDW0rf298C7DTN7PEj3ZngQS7gAFMgpJt1MoCZODFUqt/R8lLtIo7ImaJ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182813; c=relaxed/simple; bh=VjnFZx7IhhL9ZymjAB4MNit+/oQv65Dw7l/sS5fa1r0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=BywjX7wD+xzfKJFAUTu8ao8Oie0fHlfbFBvBnQIsJ3IJRtCBcZ8TUGxonVeCFNczUC3JM0TFYZU3e4YRrnscaK+qjnO5UtkVzEnGgZ7Eh7a0hIoP3OT/j0Ts4JnpOmYJwgFwP1Mi7ePmKP3pvTucJaejJ52elQO98UtESyxL0CA= 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; Wed, 4 Feb 2026 13:26:31 +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; Wed, 4 Feb 2026 13:26:31 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:40 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-14-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=910; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=WMJxdeGDLfXSqtw+jtmI+hZXKEcfdsYZEq1/J6zdoRU=; b=KJA8cuDqmvZEcTLtkkBMLAmGneFGHerfb8CdcTAJ/D4PS5lqq+2QDQy4aN7xCgwpkH386NAgc ZSpeA68jxrBBvOjcQ2ZGJYsxr4OjC6QRI+DeY5+dL27dYnVW1i8Inp1 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 652a20a7bfe3..d5cdd6ac65eb 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -2109,8 +2109,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:09:45 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 6478A37E30D; Wed, 4 Feb 2026 05:26: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=1770182813; cv=none; b=N7EszN4mofdlKS0LXKvdoIlLmvvxTO3HvdS1POOReCo2MU9SIndNihjHl5FWyx846nxwZ31BveOjmWQrYGHxaLjnPzUDrgrEJRfmCwAD+t4+jHDG1r7SwP5Tem6pakNrkLjIPfBeTSdmcC0ft8a1lAfOqyu4c2PlqCjFbm4sHJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770182813; c=relaxed/simple; bh=/pgWTDi5+56ExcDOnn/4hchxZjnem104hwhxzKEl+e4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=tPegWsbr7PiAk+FH0Z1lc6YW6l9Wg4ERmhtyOuYZAItvAMrZJ2NZfHWUQd5q9ZbJoNdMv8P4XzbyRHdVL/3xe5g7Pg3QjlNmadd7Ya3ev5rejJfRay0ocNbz20f+PYm2NcbyXRo2/EPlIjpYqCvRjZ0h/MDzZ6LbyuZlj7o5Cf0= 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; Wed, 4 Feb 2026 13:26:32 +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; Wed, 4 Feb 2026 13:26:32 +0800 From: Jacky Chou Date: Wed, 4 Feb 2026 13:26:41 +0800 Subject: [PATCH net-next v4 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: <20260204-ftgmac-cleanup-v4-15-b7f379939b76@aspeedtech.com> References: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@aspeedtech.com> In-Reply-To: <20260204-ftgmac-cleanup-v4-0-b7f379939b76@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=1770182790; l=2368; i=jacky_chou@aspeedtech.com; s=20251031; h=from:subject:message-id; bh=/pgWTDi5+56ExcDOnn/4hchxZjnem104hwhxzKEl+e4=; b=RLoUKIAJB5oAh5IMKBgKRSQlHBgdhCWFyroIccPCh3XpsKVJnMP6IZ4tT28Sk/nCRJLfNfPjb nmhIpTc5kwTB32yPJsceJ9fuCxQh38vRZ+x3n7hovOBLUWbX1lK+Jz3 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 d5cdd6ac65eb..b55216d3c77b 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)) @@ -2086,7 +2070,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 @@ -2108,7 +2091,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