[PATCH RFC net-next 06/10] net: stmmac: dche is only for GMAC4 cores

Russell King (Oracle)
2026-04-08T09:27:46Z

dma_cfg->dche is only read by dwmac4_dma_init(), which is only called
for the DWMAC_CORE_GMAC4 core type. Rather than having a bare IP
version check that can match any core type, make this conditional on
DWMAC_CORE_GMAC4 to make it clear that it's a GMAC4 feature.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 295d31d7b28b..e47321119c83 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7895,9 +7895,10 @@ static int __stmmac_dvr_probe(struct device *device,
if (ret)
goto error_hw_init;

- /* Only DWMAC core version 5.20 onwards supports HW descriptor prefetch.
+ /* Only DWMAC4 core version 5.20 onwards support HW descriptor prefetch.
*/
- if (priv->snpsver < DWMAC_CORE_5_20)
+ if (priv->plat->core_type != DWMAC_CORE_GMAC4 ||
+ priv->snpsver < DWMAC_CORE_5_20)
priv->plat->dma_cfg->dche = false;

stmmac_check_ether_addr(priv);
--
2.47.3