diff mbox series

[02/13] net: fsl_enetc: Remove ifdef around enetc_set_ierb_primary_mac()

Message ID 20250116040449.306098-2-marex@denx.de
State Accepted
Commit 755aa1c3ff89387559981830134a77f66a23c959
Delegated to: Fabio Estevam
Headers show
Series [01/13] net: fsl_enetc: Introduce enetc_is_ls1028a() | expand

Commit Message

Marek Vasut Jan. 16, 2025, 4:03 a.m. UTC
Use enetc_is_ls1028() instead of ifdef around enetc_set_ierb_primary_mac()
and clean up the function. No functional change intended.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Alice Guo <alice.guo@nxp.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jerome Forissier <jerome.forissier@linaro.org>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Markus Gothe <markus.gothe@genexis.eu>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Robert Marko <robert.marko@sartura.hr>
Cc: Romain Naour <romain.naour@smile.fr>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ye Li <ye.li@nxp.com>
Cc: u-boot@lists.denx.de
---
 drivers/net/fsl_enetc.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c
index d1414167723..fc51647257e 100644
--- a/drivers/net/fsl_enetc.c
+++ b/drivers/net/fsl_enetc.c
@@ -36,29 +36,29 @@  static int enetc_is_ls1028a(struct udevice *dev)
  * sets the MAC address in IERB registers, this setting is persistent and
  * carried over to Linux.
  */
-static void enetc_set_ierb_primary_mac(struct udevice *dev, int devfn,
-				       const u8 *enetaddr)
-{
-#ifdef CONFIG_ARCH_LS1028A
-/*
- * LS1028A is the only part with IERB at this time and there are plans to change
- * its structure, keep this LS1028A specific for now
- */
 #define IERB_BASE		0x1f0800000ULL
 #define IERB_PFMAC(pf, vf, n)	(IERB_BASE + 0x8000 + (pf) * 0x100 + (vf) * 8 \
 				 + (n) * 4)
 
-static int ierb_fn_to_pf[] = {0, 1, 2, -1, -1, -1, 3};
-
+static void enetc_set_ierb_primary_mac(struct udevice *dev, int devfn,
+				       const u8 *enetaddr)
+{
+	static int ierb_fn_to_pf[] = {0, 1, 2, -1, -1, -1, 3};
 	u16 lower = *(const u16 *)(enetaddr + 4);
 	u32 upper = *(const u32 *)enetaddr;
 
-	if (ierb_fn_to_pf[devfn] < 0)
-		return;
-
-	out_le32(IERB_PFMAC(ierb_fn_to_pf[devfn], 0, 0), upper);
-	out_le32(IERB_PFMAC(ierb_fn_to_pf[devfn], 0, 1), (u32)lower);
-#endif
+	if (enetc_is_ls1028a(dev)) {
+		/*
+		 * LS1028A is the only part with IERB at this time and
+		 * there are plans to change its structure, keep this
+		 * LS1028A specific for now.
+		 */
+		if (ierb_fn_to_pf[devfn] < 0)
+			return;
+
+		out_le32(IERB_PFMAC(ierb_fn_to_pf[devfn], 0, 0), upper);
+		out_le32(IERB_PFMAC(ierb_fn_to_pf[devfn], 0, 1), (u32)lower);
+	}
 }
 
 /* sets up primary MAC addresses in DT/IERB */