summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
diff options
context:
space:
mode:
authorChristophe Roullier <christophe.roullier@foss.st.com>2024-07-01 08:48:37 +0200
committerPaolo Abeni <pabeni@redhat.com>2024-07-02 15:47:09 +0200
commit3cd1d4651cebe9776a0142ade36ff9f2e3545436 (patch)
tree57a58f0e5214b32ce68a60cee8d68fca74f1ffde /drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
parentdt-bindings: net: dwmac: Validate PBL for all IP-cores (diff)
downloadlinux-3cd1d4651cebe9776a0142ade36ff9f2e3545436.tar.xz
linux-3cd1d4651cebe9776a0142ade36ff9f2e3545436.zip
net: stmmac: dwmac-stm32: Add test to verify if ETHCK is used before checking clk rate
When we want to use clock from RCC to clock Ethernet PHY (with ETHCK) we need to check if value of clock rate is authorized. If ETHCK is unused, the ETHCK frequency is 0Hz and validation fails. It makes no sense to validate unused ETHCK, so skip the validation. Fixes: 582ac134963e ("net: stmmac: dwmac-stm32: Separate out external clock rate validation") Signed-off-by: Christophe Roullier <christophe.roullier@foss.st.com> Reviewed-by: Marek Vasut <marex@denx.de> Tested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
index 23cf0a5b047f..d6a268237ca1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
@@ -206,6 +206,9 @@ static int stm32mp1_validate_ethck_rate(struct plat_stmmacenet_data *plat_dat)
struct stm32_dwmac *dwmac = plat_dat->bsp_priv;
const u32 clk_rate = clk_get_rate(dwmac->clk_eth_ck);
+ if (!dwmac->enable_eth_ck)
+ return 0;
+
switch (plat_dat->mac_interface) {
case PHY_INTERFACE_MODE_MII:
case PHY_INTERFACE_MODE_GMII: