[PATCH 0/2] net: stmmac: dwmac-stm32: fix resume on STM32 MCU

From: Ben Wolsieffer
Date: Tue Sep 19 2023 - 15:20:05 EST


On STM32 MCUs, Ethernet fails to come up after resume and the following
errors appear in dmesg:

[ 17.451148] stm32-dwmac 40028000.ethernet: Failed to reset the dma
[ 17.451266] stm32-dwmac 40028000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed

This occurs because clk_rx is never re-enabled during resume. On the
STM32MP1, clk_rx is left running during suspend, and therefore doesn't
need to be enabled during resume, but this code was mistakenly applied
to the STM32 MCUs as well.

The first patch in this series applies a minimal fix for the bug, while
the second refactors the clock configuration to make it easier to spot
such bugs in the future.

I have tested that this series allows Ethernet to come back up correctly
after resuming from s2idle on an STM32F746. I don't have STM32MP1
hardware to test.

Ben Wolsieffer (2):
net: stmmac: dwmac-stm32: fix resume on STM32 MCU
net: stmmac: dwmac-stm32: refactor clock config

.../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 116 ++++++++----------
1 file changed, 48 insertions(+), 68 deletions(-)

--
2.42.0