]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
clk: Warn on failure to assign rate
authorSean Anderson <seanga2@gmail.com>
Fri, 9 Apr 2021 02:13:03 +0000 (22:13 -0400)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Fri, 14 May 2021 08:20:47 +0000 (16:20 +0800)
If the user/dev explicitly requests a clock be assigned a certain rate,
then we should warn them if we can't do it. This makes it clear if the
clock is running at the default rate.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
drivers/clk/clk-uclass.c

index 4ab3c402ed834163019516fb5341d11a50653f95..53e7be764d3653798dd2d66b566cc759efdc94d9 100644 (file)
@@ -14,6 +14,7 @@
 #include <errno.h>
 #include <log.h>
 #include <malloc.h>
+#include <dm/device_compat.h>
 #include <dm/device-internal.h>
 #include <dm/devres.h>
 #include <dm/read.h>
@@ -309,8 +310,9 @@ static int clk_set_default_rates(struct udevice *dev, int stage)
                ret = clk_get_by_indexed_prop(dev, "assigned-clocks",
                                              index, &clk);
                if (ret) {
-                       debug("%s: could not get assigned clock %d for %s\n",
-                             __func__, index, dev_read_name(dev));
+                       dev_dbg(dev,
+                               "could not get assigned clock %d (err = %d)\n",
+                               index, ret);
                        continue;
                }
 
@@ -332,8 +334,9 @@ static int clk_set_default_rates(struct udevice *dev, int stage)
                ret = clk_set_rate(c, rates[index]);
 
                if (ret < 0) {
-                       debug("%s: failed to set rate on clock index %d (%ld) for %s\n",
-                             __func__, index, clk.id, dev_read_name(dev));
+                       dev_warn(dev,
+                                "failed to set rate on clock index %d (%ld) (error = %d)\n",
+                                index, clk.id, ret);
                        break;
                }
        }