clk: Warn on failure to assign rate

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>
This commit is contained in:
Sean Anderson 2021-04-08 22:13:03 -04:00 committed by Leo Yu-Chi Liang
parent c0c80e7843
commit 8c12cb3fd8

View File

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