From 6ee57e5f0f7cd2f736f9f87e453695174d790cb1 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Thu, 16 Jan 2025 05:03:18 +0100 Subject: [PATCH] net: fsl_enetc: Introduce enetc_is_ls1028a() Introduce accurate test for LS1028A compatibility based both on IS_ENABLED(CONFIG_ARCH_LS1028A) and PCI vendor ID. This is done in preparation for adding ENETCv4 support, which has a different PCI vendor ID. Signed-off-by: Marek Vasut --- drivers/net/fsl_enetc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c index a6b0bafc8c6..d1414167723 100644 --- a/drivers/net/fsl_enetc.c +++ b/drivers/net/fsl_enetc.c @@ -23,6 +23,15 @@ static int enetc_remove(struct udevice *dev); +static int enetc_is_ls1028a(struct udevice *dev) +{ + struct pci_child_plat *pplat = dev_get_parent_plat(dev); + + /* Test whether this is LS1028A ENETC. This may be optimized out. */ + return IS_ENABLED(CONFIG_ARCH_LS1028A) && + pplat->vendor == PCI_VENDOR_ID_FREESCALE; +} + /* * sets the MAC address in IERB registers, this setting is persistent and * carried over to Linux. @@ -416,7 +425,7 @@ static int enetc_write_hwaddr(struct udevice *dev) struct enetc_priv *priv = dev_get_priv(dev); u8 *addr = plat->enetaddr; - if (IS_ENABLED(CONFIG_ARCH_LS1028A)) + if (enetc_is_ls1028a(dev)) return enetc_ls1028a_write_hwaddr(dev); u16 lower = *(const u16 *)(addr + 4); -- 2.39.5