From nobody Fri Apr 3 10:17:43 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 33DDC37B011 for ; Tue, 24 Mar 2026 09:21:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774344097; cv=none; b=HhP2oWDsNTPFAB5q1RQ90sDDqh4C6S5lLFjmibuQ1hUHq9B4RMI4pF/eZKJ08x6xCX5GljW0T55ZMxciVpMtJ9Ex3Ceg5xQuWSJb8cAlzWk0MJujNrbHvNDCVAmNklAMezhFZ9sKmQLX7kl97r2X5oKC3VV29KuqHGH17Qm/S4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774344097; c=relaxed/simple; bh=PK9VmfB/Zm9WB9+I5rhUehsIxk/SExGUW33povYtk+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hzOEkvywqMjBg9vUaEGI1pgkp0fUXEI0H/6ueFpUIeyF3KdkL8VQTz46e1IB1rxs/Mao8IcPo4pPyNWLKOuE4F5D+gTU37TGA3hBr/Oi6JzIWGlWjfbUahY1ecX1S1x31Hcnq375EUbDx7YLWvN3FqWWc9Yv7IClA6WVWf9/hX4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=0AM3DAUN; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="0AM3DAUN" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 7B36F1A2FC1; Tue, 24 Mar 2026 09:21:24 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4994F6011D; Tue, 24 Mar 2026 09:21:24 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B977C10451116; Tue, 24 Mar 2026 10:21:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1774344082; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=3fR9TaU7lvH4uvfrULIcHLIjIm0TTYsxcGUZBDQbW9Y=; b=0AM3DAUNovS0AoQN8tCoBO5bOV8LDo/FacTUkB56iZvdrUuaPxoPy1Ah89OVi/XSdaT8nb FZXbYFiRaV7psWBEFgSjkAutu0QUrRzn6/TcgCvP9W7fmYg526DZobGsn0vrH4MV9+3xS+ W6+eiefzcn2wPpOOqrvkwBvt0V+eI8MFiYJjgFTpUpF7b7mq6lU4PeBQZAZQdv2yhlL5VW ItTEI9zQDsiIZQtLhKDh59bS/Hhvb5vGeFS86ryS6btXPBwvteGyq0NsbZTF+0kf0m9oBM YH8Deb/SR9xveifB+KNPKR/JZnRbHovueLqh0Hxm/iyoWvj1EqksvaWP78Ie2Q== From: Maxime Chevallier To: Andrew Lunn , Jakub Kicinski , davem@davemloft.net, Eric Dumazet , Paolo Abeni , Simon Horman , Maxime Coquelin , Alexandre Torgue , Russell King Cc: Maxime Chevallier , thomas.petazzoni@bootlin.com, =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Rohan G Thomas , Mun Yew Tham , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH net-next 1/5] net: stmmac: dwmac-socfpga: Move internal helpers Date: Tue, 24 Mar 2026 10:20:56 +0100 Message-ID: <20260324092102.687082-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20260324092102.687082-1-maxime.chevallier@bootlin.com> References: <20260324092102.687082-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" This is preparatory work to allow reusing the SGMII configuration helper and the wrapper to get the interface in the fix_mac_speed() callback. Signed-off-by: Maxime Chevallier Reviewed-by: Russell King (Oracle) --- .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 5f89fd968ae9..42da73b92ceb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -72,6 +72,18 @@ struct socfpga_dwmac { const struct socfpga_dwmac_ops *ops; }; =20 +static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac) +{ + return dwmac->plat_dat->phy_interface; +} + +static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable) +{ + u16 val =3D enable ? SGMII_ADAPTER_ENABLE : SGMII_ADAPTER_DISABLE; + + writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); +} + static void socfpga_dwmac_fix_mac_speed(void *bsp_priv, phy_interface_t interface, int speed, unsigned int mode) @@ -244,18 +256,6 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwm= ac *dwmac, struct device * return ret; } =20 -static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac) -{ - return dwmac->plat_dat->phy_interface; -} - -static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable) -{ - u16 val =3D enable ? SGMII_ADAPTER_ENABLE : SGMII_ADAPTER_DISABLE; - - writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); -} - static int socfpga_set_phy_mode_common(int phymode, u32 *val) { switch (phymode) { --=20 2.49.0 From nobody Fri Apr 3 10:17:43 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 49133377EAC for ; Tue, 24 Mar 2026 09:21:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774344100; cv=none; b=L2lPemrZGbIW1PoDnnzt+ycJFewIBiXCSDpeaGPPLoiRyoDlucNwcJlxkn5/fXXwAklrkY/eX7UlNP1VwPjLpuZkmSZHEK5JKy9NVOeqExPURx5ceqXXbqyTKhpzCcxOACERj55b5pb0Pf664m/cvF4MGjTNLP90xTOIj0048BA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774344100; c=relaxed/simple; bh=dMyhJaW1YdqgbH/gPICMvK+c0JpKrr6pXbd/fMpnu4w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h6bahQe04LkQvGBKpEVO0PapMRaxEBhngT1WmJgFzGUx/Bp9t6aOIoIATBZo1dim1vYcoX1D4CsqwkT5Zo0358+QudIo99GQnqns/6wza2ahbrfucDpmDUmVWBd+AwLJt6Hx009O3hv2Kp7xG9drPvduzEQlrD7vqIwS7UrInp4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=hfX7WMvd; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="hfX7WMvd" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 40CCA1A2FC3; Tue, 24 Mar 2026 09:21:27 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0185F6011D; Tue, 24 Mar 2026 09:21:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 68E8510450A18; Tue, 24 Mar 2026 10:21:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1774344085; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=lDTQ1Gt3uozCZwLuZf90CgPV5cm4b1e03TcvTltg1FA=; b=hfX7WMvd3Fs12xUyTk1i+9Y/5nSUyw5ERcxx/XHj+AMiDa88uo4Zj38y5p4cUtBiNk+m5J MxBbrwhwuXnIILYpQBXdLdPzTkl5Htb/6+eYV7n3sbmdZG/h9ovWSUaMrM5eoSVNknrzHV 8L1x8+b1Ia7I5KrvtjDUvpmvv9RYP3Ap6uSddTJQ76DM/tQVeUUhSy0NnlijXhU2oLSu4K CfdJj+vnamHCgx9C6zWEkLsf3ESSJj9gL58mDg1uwrsEAJdXqEJFLYFe3l57totM2GGA+D odlXnxThjOYvx+mGc9vJAqsk9NmlJtw0XU11edZi1mTlIMkjFG+daHVzUpNUmw== From: Maxime Chevallier To: Andrew Lunn , Jakub Kicinski , davem@davemloft.net, Eric Dumazet , Paolo Abeni , Simon Horman , Maxime Coquelin , Alexandre Torgue , Russell King Cc: Maxime Chevallier , thomas.petazzoni@bootlin.com, =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Rohan G Thomas , Mun Yew Tham , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH net-next 2/5] net: stmmac: dwmac-socfpga: Use the socfpga_sgmii_config() helper Date: Tue, 24 Mar 2026 10:20:57 +0100 Message-ID: <20260324092102.687082-3-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20260324092102.687082-1-maxime.chevallier@bootlin.com> References: <20260324092102.687082-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Use the existing socfpga_sgmii_config() helper in socfpga_dwmac_fix_mac_speed(), instead of re-coding the register access. Signed-off-by: Maxime Chevallier Reviewed-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 42da73b92ceb..ed6448c0ad2a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -95,8 +95,7 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv, u32 val; =20 if (sgmii_adapter_base) - writew(SGMII_ADAPTER_DISABLE, - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); + socfpga_sgmii_config(dwmac, false); =20 if (splitter_base) { val =3D readl(splitter_base + EMAC_SPLITTER_CTRL_REG); @@ -121,8 +120,7 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv, if ((priv->plat->phy_interface =3D=3D PHY_INTERFACE_MODE_SGMII || priv->plat->phy_interface =3D=3D PHY_INTERFACE_MODE_1000BASEX) && sgmii_adapter_base) - writew(SGMII_ADAPTER_ENABLE, - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); + socfpga_sgmii_config(dwmac, true); } =20 static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct de= vice *dev) --=20 2.49.0 From nobody Fri Apr 3 10:17:43 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 C1B89363C49 for ; Tue, 24 Mar 2026 09:21:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774344104; cv=none; b=fiJgxtx6ahd6872ms0SzBPKVk7mBzmQ7vda5Mwgw3xSzNyrnc2OEclowWiPrA5byd5q1VmJreyb3e1+rbV5VEF8EPNtbCyWsKgtB8A881H776FTXpZx2vKxHFNKitd5DwFLJnlW6ZH8Nc81GBzHTEnf/zG9+c+/1r4ejZpxzpQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774344104; c=relaxed/simple; bh=BfBFqaDuUuwjt+LEIhJ9aKKSBbuR6ZmsJyVY9a/3l3g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LfnEaiypXLep9IaTfG6GOmFC+SNfnNkw+7VwbKXx4c/86643Ilj/LH+h+1WhnVjVANfWh+DkF+ZafwfAWJo3YlXBxgnzaX25Cw6oyLc2Dmn0E0Fx7nw+jrsuxiHzuFV7cT6GXzdPVBI0ku0MDSqCXE0VXSUe/mq8icK+EsVHhHc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=cxA/kf5g; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="cxA/kf5g" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 22EFB4E427C7; Tue, 24 Mar 2026 09:21:30 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 924EC6011D; Tue, 24 Mar 2026 09:21:29 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 567DA104511A9; Tue, 24 Mar 2026 10:21:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1774344088; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=Jl+zv1qJmZXW+mDeB3W8k/7HhcPBhRwvYFxrgAInSP8=; b=cxA/kf5gpYbIex+CoaokBYA+SpEs39Fk0Abby5TD9YNoriShrrsVtUp4oduIQKNmDzkhVR yQov/qovYmCdF4P0vzkg/1A5Gtv4fUqHxlzY5W/mDotlcE0dE+ydZPyBJobSJjcx+un4BB /CihzzaD7aJ8XJIjmENAla3P1ZBlqey5zPOPg+OStaIQ54G3US32OhZZThESznk9ASxJF7 jt8yBw9h9krOyXbz+atMvCWOxz+lhbQqy4EO685O1VYOWmYHSFqJhk5BqDWgwsFiHLZo8R nBv0EtFyWCd80DmPiLZFgAEXfF1l+5WkDfHeCYb1edSpI1U4I3Mhtdq9lJ/W5A== From: Maxime Chevallier To: Andrew Lunn , Jakub Kicinski , davem@davemloft.net, Eric Dumazet , Paolo Abeni , Simon Horman , Maxime Coquelin , Alexandre Torgue , Russell King Cc: Maxime Chevallier , thomas.petazzoni@bootlin.com, =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Rohan G Thomas , Mun Yew Tham , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH net-next 3/5] net: stmmac: dwmac-socfpga: Use the correct type for interface modes Date: Tue, 24 Mar 2026 10:20:58 +0100 Message-ID: <20260324092102.687082-4-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20260324092102.687082-1-maxime.chevallier@bootlin.com> References: <20260324092102.687082-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The internal helper socfpga_get_plat_phymode() returns an int where we actually return a PHY_INTERFACE_MODE_xxx, use the correct type for this. Signed-off-by: Maxime Chevallier Reviewed-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-socfpga.c index ed6448c0ad2a..629074dbbc15 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -72,7 +72,7 @@ struct socfpga_dwmac { const struct socfpga_dwmac_ops *ops; }; =20 -static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac) +static phy_interface_t socfpga_get_plat_phymode(struct socfpga_dwmac *dwma= c) { return dwmac->plat_dat->phy_interface; } @@ -386,7 +386,7 @@ static int smtg_crosststamp(ktime_t *device, struct sys= tem_counterval_t *system, static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac) { struct regmap *sys_mgr_base_addr =3D dwmac->sys_mgr_base_addr; - int phymode =3D socfpga_get_plat_phymode(dwmac); + phy_interface_t phymode =3D socfpga_get_plat_phymode(dwmac); u32 reg_offset =3D dwmac->reg_offset; u32 reg_shift =3D dwmac->reg_shift; u32 ctrl, val, module; @@ -444,7 +444,7 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwm= ac *dwmac) static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac) { struct regmap *sys_mgr_base_addr =3D dwmac->sys_mgr_base_addr; - int phymode =3D socfpga_get_plat_phymode(dwmac); + phy_interface_t phymode =3D socfpga_get_plat_phymode(dwmac); u32 reg_offset =3D dwmac->reg_offset; u32 reg_shift =3D dwmac->reg_shift; u32 ctrl, val, module; --=20 2.49.0 From nobody Fri Apr 3 10:17:43 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 161AE3DCD95 for ; Tue, 24 Mar 2026 09:21:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774344105; cv=none; b=gZuj0zRgO4LxbWb2sCXPDC1QdamNKC/paUIj+16fQq+L/OzK3PgRvqBWEljMm489BnBXK18SMhI7WzGj8Pva3UgZPzcciCHoFp+jWKzclWjVAQtk59XgfQuUix6sgtQoZ3PeqU6+oJ+vpdMf53nW2LerZhTPzkRUhDEbYj4ZDAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774344105; c=relaxed/simple; bh=AyRiTGcPXYmu3RZtu7TRaFSdrS/g+khupPFj0y8aDjE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dF1+LzhIQr+DaBXKGJGbHM8hC2ZXiFNqthQ8QIN8OqUY8pNLtN0bj+CyjPBrC7VJ9aODcs94I9mtLz1oTvgHbuyJbreoaACVAdCWFElHsxpYtkYm5WRv2ZoZ87+PzmWzngl/IvfZB4stMGqjwgB9I5HWT4ccyuuvZ6qSSo2wO3A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=BZFuNgKc; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="BZFuNgKc" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 493A24E427C5; Tue, 24 Mar 2026 09:21:32 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0C16B6011D; Tue, 24 Mar 2026 09:21:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DAF8C10451116; Tue, 24 Mar 2026 10:21:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1774344091; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=2MaJGVLz8R3aV7CXG66GxuSg5iwkZ6E8Ug7Y4Ilvlj8=; b=BZFuNgKc93q5zEqH9mzxnRoQqutfe7rG1jo52LFXE7ApKnSpBMhC0YodgvKmQ0v4A6n020 RfdyqJDpz+CipOpRWNoHZ4x8J0i478dY/k2gRgRQTTkjiV9wPjmTK5LPY5e1HMJQzof1I/ Vc5m1E2LhTEi8P+iNdZalfHXhKF9tBSja1k5tkf/BMTREPQRStBRtG+AOlAT0lLPKhUSIY 1J9TjHoFxGty2NFiRlOxTFObB32ZLQ5tUx9UgC89SwpErxwXRBC3zeNinQvYitT3FVNEf0 ka0cSclctExJrh2CUsFibU0uX64f3Xe6wnCJcyXq3KATXXogQZM8wwNZ8WFk/A== From: Maxime Chevallier To: Andrew Lunn , Jakub Kicinski , davem@davemloft.net, Eric Dumazet , Paolo Abeni , Simon Horman , Maxime Coquelin , Alexandre Torgue , Russell King Cc: Maxime Chevallier , thomas.petazzoni@bootlin.com, =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Rohan G Thomas , Mun Yew Tham , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH net-next 4/5] net: stmmac: dwmac-socfpga: get the phy_mode with the dedicated helper Date: Tue, 24 Mar 2026 10:20:59 +0100 Message-ID: <20260324092102.687082-5-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20260324092102.687082-1-maxime.chevallier@bootlin.com> References: <20260324092102.687082-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" We enable/disable the sgmii_adapter in the .fix_mac_speed() ops based on the phy_mode used in the plat_data. We currently get it with : socfpga_dwmac ->dev ->drv_data ->netdev ->priv ->stmmac_priv ->plat ->phy_interface where we can get it with : socfpga_dwmac ->plat_data ->phy_interface (done by socfpga_get_plat_phymode) Use that helper here. Note that we are also being passed a phy_interface_t from the .fix_mac_speed() callback, provided by phylink. We can handle that in the future when dynamic interface selection is supported. We'd need to guarantee that we have a Lynx PCS to handle it. Signed-off-by: Maxime Chevallier Reviewed-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 629074dbbc15..ae40de2ed8eb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -89,9 +89,9 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv, unsigned int mode) { struct socfpga_dwmac *dwmac =3D (struct socfpga_dwmac *)bsp_priv; - struct stmmac_priv *priv =3D netdev_priv(dev_get_drvdata(dwmac->dev)); - void __iomem *splitter_base =3D dwmac->splitter_base; void __iomem *sgmii_adapter_base =3D dwmac->sgmii_adapter_base; + phy_interface_t phymode =3D socfpga_get_plat_phymode(dwmac); + void __iomem *splitter_base =3D dwmac->splitter_base; u32 val; =20 if (sgmii_adapter_base) @@ -117,9 +117,8 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv, writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG); } =20 - if ((priv->plat->phy_interface =3D=3D PHY_INTERFACE_MODE_SGMII || - priv->plat->phy_interface =3D=3D PHY_INTERFACE_MODE_1000BASEX) && - sgmii_adapter_base) + if ((phymode =3D=3D PHY_INTERFACE_MODE_SGMII || + phymode =3D=3D PHY_INTERFACE_MODE_1000BASEX) && sgmii_adapter_base) socfpga_sgmii_config(dwmac, true); } =20 --=20 2.49.0 From nobody Fri Apr 3 10:17:43 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 766D53DD521; Tue, 24 Mar 2026 09:21:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774344109; cv=none; b=PHamASw+vDOIy1zFEqBZKC/n/uspIXQoZM+B3BjKp0AD+Zt9g42ZHoVbRBaqG3Lb4ssPXAY1hTdEwtPJF0DUe5a6Ao1FCeNn9RUeEtN/xB4+R5ii+/m0eI4QOsaggdQRxHtluOHwRRgUvgSJxejOfKqOYXYbgH9g1hyLaD2adR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774344109; c=relaxed/simple; bh=mng/OGMm2oi7vuZLgmgl6YVSPPsyhWXT10AzJCrskxM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=okeqflKDEm8LJGIMMjdZExDEJfgOvyhSDN0KhnDp9rM8SwRxsGD+vYshN6js0TzpGdHgHPdWc83hCBhdDEgtO90sTMhxfff98PnL7n28zmg5mFqejrUhRifPwNLevlqbrqPQ7NcMCUxLteOn8AqYNBtHMlnTj+j1JUCz83jXxq8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=VYEdNHVv; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="VYEdNHVv" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 53C6CC5809B; Tue, 24 Mar 2026 09:22:01 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 217826011D; Tue, 24 Mar 2026 09:21:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 572B9104511A8; Tue, 24 Mar 2026 10:21:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1774344093; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=E0H4SZ3DlYEVqlzu6JJsZInSW5jEBx0hElRQGDXixpQ=; b=VYEdNHVvZITYjJxp+4w6ZHknWDgFyGHrKUuXfDFyQ/1eR/CXJ2M4JdSFABSwxtSEeDjrVH mIsjeTUysEzm19uEMT6hr69dbUrpmVQ6oRtJ4CO9ZNOB0R4c95R9tDbRx6H9tN0ZSCPcOP /FJExyqWh+lqxlw6RRjFeVaOcvsQzXMxrG9Jb6NeD+g0TH/eOVSPWU3mTobdX4J+gQuEgT 6i4y85EFRH4wkXZVGQDeWDRu/RreMOVxlFvm5lpViKtR7ziRVfUoM/9zDq0X2sR4Xtwqj1 1sjlfyKgE7TRWz3CPcOD6X6zLPotfFPmtVX/kAWkAjzc7jBJ+u+M+XP67BYAuQ== From: Maxime Chevallier To: Andrew Lunn , Jakub Kicinski , davem@davemloft.net, Eric Dumazet , Paolo Abeni , Simon Horman , Maxime Coquelin , Alexandre Torgue , Russell King Cc: Maxime Chevallier , thomas.petazzoni@bootlin.com, =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Rohan G Thomas , Mun Yew Tham , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH net-next 5/5] net: stmmac: dwmac-sofcpga: Drop the struct device reference Date: Tue, 24 Mar 2026 10:21:00 +0100 Message-ID: <20260324092102.687082-6-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20260324092102.687082-1-maxime.chevallier@bootlin.com> References: <20260324092102.687082-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" We keep a reference to our the struct device in the socfpga_dwmac priv structure, but now it's only ever used to produce logs in the .set_phy_mode() ops, that are specific to this driver. When we call that ops, we always have a ref to the struct device around, so let's pass it to .set_phy_mode(). We can now discard that reference from struct socfpga_dwmac. Signed-off-by: Maxime Chevallier Reviewed-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-socfpga.c index ae40de2ed8eb..1d7f0a57d288 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -53,14 +53,14 @@ =20 struct socfpga_dwmac; struct socfpga_dwmac_ops { - int (*set_phy_mode)(struct socfpga_dwmac *dwmac_priv); + int (*set_phy_mode)(struct socfpga_dwmac *dwmac_priv, + struct device *dev); void (*setup_plat_dat)(struct socfpga_dwmac *dwmac_priv); }; =20 struct socfpga_dwmac { u32 reg_offset; u32 reg_shift; - struct device *dev; struct plat_stmmacenet_data *plat_dat; struct regmap *sys_mgr_base_addr; struct reset_control *stmmac_rst; @@ -243,7 +243,6 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwma= c *dwmac, struct device * dwmac->reg_offset =3D reg_offset; dwmac->reg_shift =3D reg_shift; dwmac->sys_mgr_base_addr =3D sys_mgr_base_addr; - dwmac->dev =3D dev; of_node_put(np_sgmii_adapter); =20 return 0; @@ -382,7 +381,8 @@ static int smtg_crosststamp(ktime_t *device, struct sys= tem_counterval_t *system, return 0; } =20 -static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac) +static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac, + struct device *dev) { struct regmap *sys_mgr_base_addr =3D dwmac->sys_mgr_base_addr; phy_interface_t phymode =3D socfpga_get_plat_phymode(dwmac); @@ -391,7 +391,7 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwm= ac *dwmac) u32 ctrl, val, module; =20 if (socfpga_set_phy_mode_common(phymode, &val)) { - dev_err(dwmac->dev, "bad phy mode %d\n", phymode); + dev_err(dev, "bad phy mode %d\n", phymode); return -EINVAL; } =20 @@ -440,7 +440,8 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwm= ac *dwmac) return 0; } =20 -static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac) +static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac, + struct device *dev) { struct regmap *sys_mgr_base_addr =3D dwmac->sys_mgr_base_addr; phy_interface_t phymode =3D socfpga_get_plat_phymode(dwmac); @@ -552,7 +553,7 @@ static int socfpga_dwmac_init(struct device *dev, void = *bsp_priv) { struct socfpga_dwmac *dwmac =3D bsp_priv; =20 - return dwmac->ops->set_phy_mode(dwmac); + return dwmac->ops->set_phy_mode(dwmac, dev); } =20 static void socfpga_gen5_setup_plat_dat(struct socfpga_dwmac *dwmac) --=20 2.49.0