]> www.infradead.org Git - users/hch/configfs.git/commit
net: stmmac: dwmac-stm32: Separate out external clock rate validation
authorMarek Vasut <marex@denx.de>
Tue, 11 Jun 2024 08:36:00 +0000 (10:36 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Fri, 14 Jun 2024 08:50:56 +0000 (10:50 +0200)
commit582ac134963e2d5cf6c45db027e156fcfb7f7678
treeb1e459e8126ef22e7396cf3996af75ad551c3bad
parent8a9044e5169bab7a8edadb4ceb748391657f0d7f
net: stmmac: dwmac-stm32: Separate out external clock rate validation

Pull the external clock frequency validation into a separate function,
to avoid conflating it with external clock DT property decoding and
clock mux register configuration. This should make the code easier to
read and understand.

This does change the code behavior slightly. The clock mux PMCR register
setting now depends solely on the DT properties which configure the clock
mux between external clock and internal RCC generated clock. The mux PMCR
register settings no longer depend on the supplied clock frequency, that
supplied clock frequency is now only validated, and if the clock frequency
is invalid for a mode, it is rejected.

Previously, the code would switch the PMCR register clock mux to internal
RCC generated clock if external clock couldn't provide suitable frequency,
without checking whether the RCC generated clock frequency is correct. Such
behavior is risky at best, user should have configured their clock correctly
in the first place, so this behavior is removed here.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Christophe Roullier <christophe.roullier@foss.st.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c