Thread (12 messages) 12 messages, 3 authors, 2026-03-24

RE: [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on pseudo MAC

From: Claudiu Manoil <claudiu.manoil@nxp.com>
Date: 2026-03-16 14:13:32
Also in: imx, lkml

-----Original Message-----
From: Wei Fang <wei.fang@nxp.com>
Sent: Friday, March 13, 2026 11:47 AM
[...]
quoted hunk ↗ jump to hunk
Subject: [PATCH v5 net 3/3] net: enetc: do not access non-existent registers on
pseudo MAC

The ENETC4_PM_IEVENT and ENETC4_PM_CMD_CFG registers do not exist on
the
ENETC pseudo MAC, so the driver should prevent from accessing them.

Fixes: 5175c1e4adca ("net: enetc: add basic support for the ENETC with pseudo
MAC for i.MX94")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
Note that the commit 5175c1e4adca ("net: enetc: add basic support for
the ENETC with pseudo MAC for i.MX94") does not have such issue, this
patch depends on the patch 2 in this patch set.
---
 drivers/net/ethernet/freescale/enetc/enetc4_pf.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
index 53cecbb23a97..56899f2254aa 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
@@ -814,6 +814,9 @@ static void enetc4_mac_tx_graceful_stop(struct enetc_pf
*pf)
 	val |= POR_TXDIS;
 	enetc_port_wr(hw, ENETC4_POR, val);

+	if (enetc_is_pseudo_mac(si))
+		return;
+
Shouldn't the ~PM_CMD_CFG_TX_EN step apply to pseudo-MACs too?
quoted hunk ↗ jump to hunk
 	enetc4_mac_wait_tx_empty(si, 0);
 	if (si->hw_features & ENETC_SI_F_QBU)
 		enetc4_mac_wait_tx_empty(si, 1);
@@ -856,6 +859,9 @@ static void enetc4_mac_rx_graceful_stop(struct enetc_pf
*pf)
 	struct enetc_si *si = pf->si;
 	u32 val;

+	if (enetc_is_pseudo_mac(si))
+		goto check_rx_busy;
+
Shouldn't the ~PM_CMD_CFG_RX_EN step apply to pseudo-MACs too?
quoted hunk ↗ jump to hunk
 	if (si->hw_features & ENETC_SI_F_QBU) {
 		val = enetc_port_rd(hw, ENETC4_PM_CMD_CFG(1));
 		val &= ~PM_CMD_CFG_RX_EN;
@@ -868,6 +874,7 @@ static void enetc4_mac_rx_graceful_stop(struct enetc_pf
*pf)
 	enetc_port_wr(hw, ENETC4_PM_CMD_CFG(0), val);
 	enetc4_mac_wait_rx_empty(si, 0);

+check_rx_busy:
 	if (read_poll_timeout(enetc_port_rd, val,
 			      !(val & PSR_RX_BUSY),
 			      100, 10000, false, hw,
--
2.34.1
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help