Re: [PATCH net v2] net: mdio: mdio-bcm-unimac: Correct rate fallback logic

From: Simon Horman
Date: Thu Jul 31 2025 - 16:21:21 EST


On Wed, Jul 30, 2025 at 01:25:33PM -0700, Florian Fainelli wrote:
> When the parent clock is a gated clock which has multiple parents, the
> clock provider (clk-scmi typically) might return a rate of 0 since there
> is not one of those particular parent clocks that should be chosen for
> returning a rate. Prior to ee975351cf0c ("net: mdio: mdio-bcm-unimac:
> Manage clock around I/O accesses"), we would not always be passing a
> clock reference depending upon how mdio-bcm-unimac was instantiated. In
> that case, we would take the fallback path where the rate is hard coded
> to 250MHz.
>
> Make sure that we still fallback to using a fixed rate for the divider
> calculation, otherwise we simply ignore the desired MDIO bus clock
> frequency which can prevent us from interfacing with Ethernet PHYs
> properly.
>
> Fixes: ee975351cf0c ("net: mdio: mdio-bcm-unimac: Manage clock around I/O accesses")
> Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
> ---
> Changes in v2:
>
> - provide additional details as to how a parent clock can have a rate of
> 0 (Andrew)
>
> - incorporate Simon's feedback that an optional clock is NULL and
> therefore returns a rate of 0 as well

Thanks for the update.

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>