net: stmmac: dwmac-stm32: refactor clock config
authorBen Wolsieffer <ben.wolsieffer@hefring.com>
Mon, 9 Oct 2023 14:59:04 +0000 (10:59 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Oct 2023 09:03:19 +0000 (10:03 +0100)
commit4d177f4996659fee4a32d30035d2acb19a5ac5de
tree31dc2a90f175ea4ddc5c848eadc3348b521d847e
parent7497b0af21573bbfa78eb40d7cefe663c4c2477b
net: stmmac: dwmac-stm32: refactor clock config

Currently, clock configuration is spread throughout the driver and
partially duplicated for the STM32MP1 and STM32 MCU variants. This makes
it difficult to keep track of which clocks need to be enabled or disabled
in various scenarios.

This patch adds symmetric stm32_dwmac_clk_enable/disable() functions
that handle all clock configuration, including quirks required while
suspending or resuming. syscfg_clk and clk_eth_ck are not present on
STM32 MCUs, but it is fine to try to configure them anyway since NULL
clocks are ignored.

Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c