Skip to contentSkip to conversation

net: enetc: add i.MX952 support

PATCH In review [email protected] 2 participants 6 messages Apr 13 – Apr 22 Network drivers

lore
Share & tools
lore
#0 lore raw

v2 cover net: enetc: add i.MX952 support

Changes in v2:
- Drop DTS-related patch.
- No functional changes to the ENETC support code.

---
Clark Wang (1):
net: fsl_enetc: fix the duplex setting on the iMX platform

Ye Li (1):
net: fsl_enetc: Add support for i.MX952

 drivers/net/Kconfig                   |  4 +-
 drivers/net/fsl_enetc.c               | 46 +++++++++++++++++-----
 drivers/net/fsl_enetc_netc_blk_ctrl.c | 72 +++++++++++++++++++++++++++++++++++
 3 files changed, 110 insertions(+), 12 deletions(-)

---
base-commit: e2fa3e570f83ab0f9ce667ddaec9dc738bcf05b9
change-id: 20260413-netc-32b997252a99

Best regards,

Signature · 1 line
Alice Guo <[email protected]>
#1 lore raw

PATCH v2 1/2 net: fsl_enetc: fix the duplex setting on the iMX platform

From: Clark Wang <[email protected]>

The iMX and LS platforms use different bits in the same register to set duplex, but their logics are opposite.
The current settings will result in unexpected configurations in RGMII mode.

Fixes e6df2f5e22c6 ("net: fsl_enetc: Update enetc driver to support i.MX95")
---
 drivers/net/fsl_enetc.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/fsl_enetc.c +9 -9
index a4ba27904bc..766aea035d3 100644
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <pci.h>
 #include <miiphy.h>
+#include <linux/bitfield.h>
 #include <linux/bug.h>
 #include <linux/delay.h>
 #include <linux/build_bug.h>
@@ -388,7 +389,7 @@ static int enetc_init_sgmii(struct udevice *dev)
 /* set up MAC for RGMII */
 static void enetc_init_rgmii(struct udevice *dev, struct phy_device *phydev)
 {
-	u32 old_val, val, dpx = 0;
+	u32 old_val, val = 0;
 
 	old_val = val = enetc_read_mac_port(dev, ENETC_PM_IF_MODE);
 
@@ -408,15 +409,14 @@ static void enetc_init_rgmii(struct udevice *dev, struct phy_device *phydev)
 		val |= ENETC_PM_IFM_SSP_10;
 	}
 
-	if (enetc_is_imx95(dev))
-		dpx = ENETC_PM_IFM_FULL_DPX_IMX;
+	if  (enetc_is_imx95(dev))
+		val = u32_replace_bits(val,
+				       phydev->duplex == DUPLEX_FULL ? 0 : 1,
+				       ENETC_PM_IFM_FULL_DPX_IMX);
 	else if (enetc_is_ls1028a(dev))
-		dpx = ENETC_PM_IFM_FULL_DPX_LS;
-
-	if (phydev->duplex == DUPLEX_FULL)
-		val |= dpx;
-	else
-		val &= ~dpx;
+		val = u32_replace_bits(val,
+				       phydev->duplex == DUPLEX_FULL ? 1 : 0,
+				       ENETC_PM_IFM_FULL_DPX_LS);
 
 	if (val == old_val)
 		return;
Signature · 1 line
2.34.1
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] net: fsl_enetc: fix the duplex setting on the iMX platform

Quoted 10 lines · On Mon, Apr 13, 2026 at 04:15:39PM +0800, [email protected] wrote:

From: Clark Wang <[email protected]>

The iMX and LS platforms use different bits in the same register to set duplex, but their logics are opposite.
The current settings will result in unexpected configurations in RGMII mode.

Fixes e6df2f5e22c6 ("net: fsl_enetc: Update enetc driver to support i.MX95")
#3 lore raw

PATCH v2 2/2 net: fsl_enetc: Add support for i.MX952

In reply to [email protected]

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 ed07e286676..4da10ed1289 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 766aea035d3..a1569b9d989 100644
@@ -67,10 +67,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 = ofnode_read_u32_array(dev_ofnode(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
Reviewed-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] net: fsl_enetc: Add support for i.MX952

Quoted 42 lines · On Mon, Apr 13, 2026 at 04:15:40PM +0800, [email protected] wrote:

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 +0 -0
index ed07e286676..4da10ed1289 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

drivers/net/Kconfig +2 -2
-	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 +0 -0
index 766aea035d3..a1569b9d989 100644
@@ -67,10 +67,36 @@ static int enetc_is_ls1028a(struct udevice *dev)
 	       pplat->vendor == PCI_VENDOR_ID_FREESCALE;

drivers/net/fsl_enetc.c static int enetc_is_ls1028a(struct udevice *dev) · line 77

Quoted 10 lines
drivers/net/fsl_enetc.c +8 -0
 }
 
+static int enetc_dev_id_imx(struct udevice *dev)
+{
+	if (IS_ENABLED(CONFIG_IMX952)) {
+		int bus_devfn;
+		u32 reg[5];
+		int error;
+
+		error = ofnode_read_u32_array(dev_ofnode(dev), "reg", reg, ARRAY_SIZE(reg));

nit: use dev_read_u32_array. with this addressed, you could add:

Quoted 3 lines
drivers/net/fsl_enetc.c +3 -0
+		if (error)
+			return error;
+
#5 lore raw

回复: [PATCH v2 2/2] net: fsl_enetc: Add support for i.MX952

Quoted 76 lines

-----邮件原件-----
发件人: Peng Fan (OSS) <[email protected]>
发送时间: 2026年4月21日 21:48
收件人: Alice Guo (OSS) <[email protected]>
抄送: Ye Li <[email protected]>; [email protected]; Marek Vasut <[email protected]>; Fabio Estevam <[email protected]>; [email protected]; Jerome Forissier <[email protected]>; Tom Rini <[email protected]>; Michael Walle <[email protected]>; Vladimir Oltean <[email protected]>; Heiko Thiery <[email protected]>; Clark Wang <[email protected]>; Thomas Schäfer <[email protected]>; Christian Marangi <[email protected]>; Quentin Schulz <[email protected]>; Simon Glass <[email protected]>; Mikhail Kshevetskiy <[email protected]>; Robert Marko <[email protected]>; Yao Zi <[email protected]>; Peng Fan <[email protected]>; Andrew Goodbody <[email protected]>; Jacky Bai <[email protected]>; Alice Guo <[email protected]>
主题: Re: [PATCH v2 2/2] net: fsl_enetc: Add support for i.MX952

Quoted 43 lines · On Mon, Apr 13, 2026 at 04:15:40PM +0800, [email protected] wrote:

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 index renamed from drivers/net/Kconfig +0 -0

ed07e286676..4da10ed1289 100644

drivers/net/Kconfig +0 -0
@@ -1018,8 +1018,8 @@ config FSL_ENETC

config FSL_ENETC_NETC_BLK_CTRL
bool "NXP ENETC NETC blocks control driver" depends on FSL_ENETC

drivers/net/Kconfig +2 -2
-	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 diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c index 766aea035d3..a1569b9d989 100644

drivers/net/fsl_enetc.c static int enetc_is_ls1028a(struct udevice *dev) · line 76

Quoted 10 lines
drivers/net/fsl_enetc.c +8 -0
@@ -67,10 +67,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 = ofnode_read_u32_array(dev_ofnode(dev), "reg", reg,
+ARRAY_SIZE(reg));

nit: use dev_read_u32_array. with this addressed, you could add:

Quoted 1 line

Thanks for the review. I will address the nit and add your Reviewed-by in v3.