From nobody Tue Dec 16 02:55:34 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6ACDB2F7479; Fri, 31 Oct 2025 17:27:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761931636; cv=none; b=nJrIvcRTmv3pWQNzCSEulAJwMB5IsDr9YipESArs6mK47brq9R6cKa3of09x+xm7RUTW2gam9Ty/v+B+9F6Unn66mBG8rjdVto7x4Hk08sQWgKvhX5DxTv8YPaGoQDztBG2mRwFNlsDG942VhfBn2VGI+BZMYUKX2vY/XUGlBbw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761931636; c=relaxed/simple; bh=p2mT5ghCrdyTCWnU0vH7XPeN9JbRC4F/94aiLq32Z9Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kNQaQoDQtkqHW1gIV626vv1cSUmBdOZUAWkSUcymhS99c7XkuXJY9EPmwOnjOlSCFNas/zDlhIrON5mAFC2xxb5AY9V9FVQk7glxMy2V3DjKW0n/kPdYxO/bDYSUzv2E8DObhRmGRoSUICb9rYZPZpTs0cc+qM2NwMtt9foUisk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a1q94A7e; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a1q94A7e" Received: by smtp.kernel.org (Postfix) with ESMTPS id F38D6C4CEFD; Fri, 31 Oct 2025 17:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761931636; bh=p2mT5ghCrdyTCWnU0vH7XPeN9JbRC4F/94aiLq32Z9Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=a1q94A7e1tB/Ndw3YaERBAvBBHnHmwpkQz1T/cx1sKJyueluvPzr5uULV30AELkko OYMfz/tmwhjXX1x9BsRr/mX7t3aGc/uLGNv3jmE5GJc76maQs8Nh357oRzeAsRoBbv 6eWDyr1snOYReKrsAI/wnr1DZqcBjRED15OZZWDTDhNp1BsYH9oVJc1oLQ49WsafGs Ydhm8lQrn/fF3SAUV0NUymlT3Knmvw4usVDIc7ZNMhi0uBbrc5Wy0uWhBIfFUcAnjt 0Sjk9gV9CX35hzLSeQ6mqq/PG6yrVpXg/F/6CWiAVT06WScPNE8VjGBryECA6RF0oP 3q2Gi5wfgIJGw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E39B9CCFA00; Fri, 31 Oct 2025 17:27:15 +0000 (UTC) From: Rohan G Thomas via B4 Relay Date: Sat, 01 Nov 2025 01:27:07 +0800 Subject: [PATCH net-next v2 1/4] net: stmmac: socfpga: Agilex5 EMAC platform configuration 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: <20251101-agilex5_ext-v2-1-a6b51b4dca4d@altera.com> References: <20251101-agilex5_ext-v2-0-a6b51b4dca4d@altera.com> In-Reply-To: <20251101-agilex5_ext-v2-0-a6b51b4dca4d@altera.com> To: Maxime Chevallier , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , Richard Cochran , Steffen Trumtrar Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rohan G Thomas X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1761931634; l=3455; i=rohan.g.thomas@altera.com; s=20250815; h=from:subject:message-id; bh=vntBDZwpth1lYOT1gYNvvzXdYXYWr60f8HSNHxW366k=; b=HqeT8OjjuqcrdJzqlau3nGAQRSE7vEu6aZPenJXIQ6PQ2HX6N2GytKv8laI1uw9z9vSrrXAwf QLHNl52JUwxAY+CrHPyW+OGjd+sKn5ppyam5qhcFD+DdH1WPKYgc3eb X-Developer-Key: i=rohan.g.thomas@altera.com; a=ed25519; pk=5yZXkXswhfUILKAQwoIn7m6uSblwgV5oppxqde4g4TY= X-Endpoint-Received: by B4 Relay for rohan.g.thomas@altera.com/20250815 with auth_id=494 X-Original-From: Rohan G Thomas Reply-To: rohan.g.thomas@altera.com From: Rohan G Thomas Agilex5 HPS EMAC uses the dwxgmac-3.10a IP, unlike previous socfpga platforms which use dwmac1000 IP. Due to differences in platform configuration, Agilex5 requires a distinct setup. Introduce a setup_plat_dat() callback in socfpga_dwmac_ops to handle platform-specific setup. This callback is invoked before stmmac_dvr_probe() to ensure the platform data is correctly configured. Also, implemented separate setup_plat_dat() callback for current socfpga platforms and Agilex5. Signed-off-by: Rohan G Thomas Reviewed-by: Maxime Chevallier Tested-by: Maxime Chevallier --- .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 30 ++++++++++++++++++= +--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 2ff5db6d41ca08a1652d57f3eb73923b9a9558bf..5666b01723643984f21b996e765= 3a36f4dc22e30 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -44,6 +44,7 @@ struct socfpga_dwmac; struct socfpga_dwmac_ops { int (*set_phy_mode)(struct socfpga_dwmac *dwmac_priv); + void (*setup_plat_dat)(struct socfpga_dwmac *dwmac_priv); }; =20 struct socfpga_dwmac { @@ -441,6 +442,23 @@ static int socfpga_dwmac_init(struct platform_device *= pdev, void *bsp_priv) return dwmac->ops->set_phy_mode(dwmac); } =20 +static void socfpga_gen5_setup_plat_dat(struct socfpga_dwmac *dwmac) +{ + struct plat_stmmacenet_data *plat_dat =3D dwmac->plat_dat; + + plat_dat->core_type =3D DWMAC_CORE_GMAC; + + /* Rx watchdog timer in dwmac is buggy in this hw */ + plat_dat->riwt_off =3D 1; +} + +static void socfpga_agilex5_setup_plat_dat(struct socfpga_dwmac *dwmac) +{ + struct plat_stmmacenet_data *plat_dat =3D dwmac->plat_dat; + + plat_dat->core_type =3D DWMAC_CORE_XGMAC; +} + static int socfpga_dwmac_probe(struct platform_device *pdev) { struct plat_stmmacenet_data *plat_dat; @@ -497,25 +515,31 @@ static int socfpga_dwmac_probe(struct platform_device= *pdev) plat_dat->pcs_init =3D socfpga_dwmac_pcs_init; plat_dat->pcs_exit =3D socfpga_dwmac_pcs_exit; plat_dat->select_pcs =3D socfpga_dwmac_select_pcs; - plat_dat->core_type =3D DWMAC_CORE_GMAC; =20 - plat_dat->riwt_off =3D 1; + ops->setup_plat_dat(dwmac); =20 return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res); } =20 static const struct socfpga_dwmac_ops socfpga_gen5_ops =3D { .set_phy_mode =3D socfpga_gen5_set_phy_mode, + .setup_plat_dat =3D socfpga_gen5_setup_plat_dat, }; =20 static const struct socfpga_dwmac_ops socfpga_gen10_ops =3D { .set_phy_mode =3D socfpga_gen10_set_phy_mode, + .setup_plat_dat =3D socfpga_gen5_setup_plat_dat, +}; + +static const struct socfpga_dwmac_ops socfpga_agilex5_ops =3D { + .set_phy_mode =3D socfpga_gen10_set_phy_mode, + .setup_plat_dat =3D socfpga_agilex5_setup_plat_dat, }; =20 static const struct of_device_id socfpga_dwmac_match[] =3D { { .compatible =3D "altr,socfpga-stmmac", .data =3D &socfpga_gen5_ops }, { .compatible =3D "altr,socfpga-stmmac-a10-s10", .data =3D &socfpga_gen10= _ops }, - { .compatible =3D "altr,socfpga-stmmac-agilex5", .data =3D &socfpga_gen10= _ops }, + { .compatible =3D "altr,socfpga-stmmac-agilex5", .data =3D &socfpga_agile= x5_ops }, { } }; MODULE_DEVICE_TABLE(of, socfpga_dwmac_match); --=20 2.43.7