[PATCH] net: gem: Check rate before setting it up

Michal Simek michal.simek at amd.com
Wed Aug 31 10:14:32 CEST 2022



On 8/26/22 10:30, Michal Simek wrote:
> On QEMU setting rate for fixed clock is failing. That's why check a rate
> first if the rate is the same there is no need to ask for the change.
> 
> Signed-off-by: Michal Simek <michal.simek at amd.com>
> ---
> 
>   drivers/net/zynq_gem.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index 4e8dd4badd6b..61a6c83e335d 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -500,10 +500,13 @@ static int zynq_gem_init(struct udevice *dev)
>   	}
>   #endif
>   
> -	ret = clk_set_rate(&priv->tx_clk, clk_rate);
> -	if (IS_ERR_VALUE(ret)) {
> -		dev_err(dev, "failed to set tx clock rate\n");
> -		return ret;
> +	ret = clk_get_rate(&priv->tx_clk);
> +	if (ret != clk_rate) {
> +		ret = clk_set_rate(&priv->tx_clk, clk_rate);
> +		if (IS_ERR_VALUE(ret)) {
> +			dev_err(dev, "failed to set tx clock rate %ld\n", clk_rate);
> +			return ret;
> +		}
>   	}
>   
>   	ret = clk_enable(&priv->tx_clk);


Applied.
M


More information about the U-Boot mailing list