]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: gem: Check rate before setting it up
authorMichal Simek <michal.simek@amd.com>
Fri, 26 Aug 2022 08:30:47 +0000 (10:30 +0200)
committerMichal Simek <michal.simek@amd.com>
Tue, 13 Sep 2022 09:32:48 +0000 (11:32 +0200)
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@amd.com>
Link: https://lore.kernel.org/r/bc465ffd4904bfd65208b782daa06732b915db54.1661502645.git.michal.simek@amd.com
drivers/net/zynq_gem.c

index 4e8dd4badd6b3909c5604991be2c743bb6880c9a..61a6c83e335dbc9e01b7f788d809b292b7e09f41 100644 (file)
@@ -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);