diff mbox series

[net-next,1/2] net: stmmac: dwmac-stm32: Add test to verify if ETHCK is used before checking clk rate

Message ID 20240627084917.327592-2-christophe.roullier@foss.st.com (mailing list archive)
State New
Headers show
Series Fixes for stm32-dwmac driver fails to probe | expand

Commit Message

Christophe Roullier June 27, 2024, 8:49 a.m. UTC
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 but we must add
test before to check if ETHCK is used.

Fixes: 582ac134963e ("net: stmmac: dwmac-stm32: Separate out external clock rate validation")

Signed-off-by: Christophe Roullier <christophe.roullier@foss.st.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Marek Vasut June 27, 2024, 3:06 p.m. UTC | #1
On 6/27/24 10:49 AM, Christophe Roullier wrote:
> 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

I think it would be better to add fullstop (.) here , and then continue:

If ETHCK is unused, the ETHCK frequency is 0 Hz and validation fails. It 
makes no sense to validate unused ETHCK, so skip the validation.

> but we must add
> test before to check if ETHCK is used.

With the commit message updated a bit

Reviewed-by: Marek Vasut <marex@denx.de>

Thanks !
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
index b2db0e26c4e4..8b85265ca6cf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
@@ -195,6 +195,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: