Re: [PATCH] net: fec: Refactor MAC reset to function

From: Simon Horman
Date: Wed Feb 05 2025 - 08:28:45 EST


On Tue, Feb 04, 2025 at 10:36:03AM +0100, Csókás, Bence wrote:
> The core is reset both in `fec_restart()` (called on link-up) and
> `fec_stop()` (going to sleep, driver remove etc.). These two functions
> had their separate implementations, which was at first only a register
> write and a `udelay()` (and the accompanying block comment). However,
> since then we got soft-reset (MAC disable) and Wake-on-LAN support, which
> meant that these implementations diverged, often causing bugs.
>
> For instance, as of now, `fec_stop()` does not check for
> `FEC_QUIRK_NO_HARD_RESET`, meaning the MII/RMII mode is cleared on eg.
> a PM power-down event; and `fec_restart()` missed the refactor renaming
> the "magic" constant `1` to `FEC_ECR_RESET`.
>
> To harmonize current implementations, and eliminate this source of
> potential future bugs, refactor implementation to a common function.
>
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@xxxxxxxxxxxxxxx>
> Reviewed-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
> Fixes: c730ab423bfa ("net: fec: Fix temporary RMII clock reset on link up")
> Fixes: ff049886671c ("net: fec: Refactor: #define magic constants")
> Signed-off-by: Csókás, Bence <csokas.bence@xxxxxxxxx>

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>