]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: enetc: do not access non-existent registers on pseudo MAC
authorWei Fang <wei.fang@nxp.com>
Tue, 24 Mar 2026 06:21:21 +0000 (14:21 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 27 Mar 2026 03:19:06 +0000 (20:19 -0700)
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>
Tested-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260324062121.2745033-4-wei.fang@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/enetc/enetc4_pf.c

index 53cecbb23a974adead93e4a8a0dbc383e5997be2..56899f2254aaa2d87a184bc9dbf09298186148cf 100644 (file)
@@ -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;
+
        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;
+
        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,