Skip to contentSkip to conversation

net: fsl_enetc: Add support for i.MX952

PATCH RESEND New [email protected] 1 participant 1 message May 12 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v3 1/1 net: fsl_enetc: Add support for i.MX952

From: Ye Li <[email protected]>

Extend ENETC driver to support i.MX952 platform where 2 ENETC controllers are located on different PCIe buses.

Key changes:
- Add enetc_dev_id_imx() to derive device ID from device tree "reg" property for i.MX952, mapping bus_devfn values 0x0 and 0x100 to device IDs 0 and 1 respectively
- Implement imx952_netcmix_init() to configure MII protocol and PCS settings based on PHY mode parsed from device tree
- Add i.MX952 to FSL_ENETC_NETC_BLK_CTRL Kconfig dependencies

---
 drivers/net/Kconfig                   |  4 +-
 drivers/net/fsl_enetc.c               | 28 ++++++++++-
 drivers/net/fsl_enetc_netc_blk_ctrl.c | 72 +++++++++++++++++++++++++++
 3 files changed, 101 insertions(+), 3 deletions(-)
drivers/net/Kconfig +2 -2
index 666618681df..f2e838b84de 100644
@@ -1018,8 +1018,8 @@ config FSL_ENETC
 config FSL_ENETC_NETC_BLK_CTRL
 	bool "NXP ENETC NETC blocks control driver"
 	depends on FSL_ENETC
-	depends on IMX95 || IMX94
-	default y if IMX95 || IMX94
+	depends on IMX95 || IMX94 || IMX952
+	default y if IMX95 || IMX94 || IMX952
 	help
 	  This driver configures Integrated Endpoint Register Block (IERB) and
 	  Privileged Register Block (PRB) of NETC. For i.MX platforms, it also
drivers/net/fsl_enetc.c +27 -1
index b07193e4e83..f393af40e27 100644
@@ -75,10 +75,36 @@ static int enetc_is_ls1028a(struct udevice *dev)
 	       pplat->vendor == PCI_VENDOR_ID_FREESCALE;
 }
 
+static int enetc_dev_id_imx(struct udevice *dev)
+{
+	if (IS_ENABLED(CONFIG_IMX952)) {
+		int bus_devfn;
+		u32 reg[5];
+		int error;
+
+		error = dev_read_u32_array(dev, "reg", reg, ARRAY_SIZE(reg));
+		if (error)
+			return error;
+
+		bus_devfn = (reg[0] >> 8) & 0xffff;
+
+		switch (bus_devfn) {
+		case 0:
+			return 0;
+		case 0x100:
+			return 1;
+		default:
+			return -EINVAL;
+		}
+	}
+
+	return PCI_DEV(pci_get_devfn(dev)) >> 3;
+}
+
 static int enetc_dev_id(struct udevice *dev)
 {
 	if (enetc_is_imx95(dev))
-		return PCI_DEV(pci_get_devfn(dev)) >> 3;
+		return enetc_dev_id_imx(dev);
 	if (enetc_is_ls1028a(dev))
 		return PCI_FUNC(pci_get_devfn(dev));
 
drivers/net/fsl_enetc_netc_blk_ctrl.c +72 -0

99 lines not on this page · raw message

Signature · 1 line
2.34.1