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 <marex@denx.de>
This commit is contained in:
Marek Vasut
2025-01-16 05:03:18 +01:00
committed by Fabio Estevam
parent 639cd40998
commit 6ee57e5f0f

View File

@@ -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);