* [U-Boot] [PATCH] clk: clk_set_default: accept no-op skip fields
@ 2018-07-26 13:19 Neil Armstrong
2018-07-27 0:35 ` Simon Glass
2018-08-04 23:41 ` [U-Boot] " Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Neil Armstrong @ 2018-07-26 13:19 UTC (permalink / raw)
To: u-boot
The Assigned Clock parents and rates misses the fact that a "0" entry can
be passed to skip setting a parent or rate of an assigned clock as
described in the Linux clock bindings at [1].
This patch simply skips the clock reparenting if the DT parsing returns
-ENOENT and the clock rate setting if "0" is passed as clock rate.
[1] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/clock/clock-bindings.txt#L135
Fixes: f4fcba5c5baa "clk: implement clk_set_defaults()"
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/clk/clk-uclass.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 419d451..2b15978 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -154,6 +154,10 @@ static int clk_set_default_parents(struct udevice *dev)
for (index = 0; index < num_parents; index++) {
ret = clk_get_by_indexed_prop(dev, "assigned-clock-parents",
index, &parent_clk);
+ /* If -ENOENT, this is a no-op entry */
+ if (ret == -ENOENT)
+ continue;
+
if (ret) {
debug("%s: could not get parent clock %d for %s\n",
__func__, index, dev_read_name(dev));
@@ -210,6 +214,10 @@ static int clk_set_default_rates(struct udevice *dev)
goto fail;
for (index = 0; index < num_rates; index++) {
+ /* If 0 is passed, this is a no-op */
+ if (!rates[index])
+ continue;
+
ret = clk_get_by_indexed_prop(dev, "assigned-clocks",
index, &clk);
if (ret) {
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] clk: clk_set_default: accept no-op skip fields
2018-07-26 13:19 [U-Boot] [PATCH] clk: clk_set_default: accept no-op skip fields Neil Armstrong
@ 2018-07-27 0:35 ` Simon Glass
2018-08-04 23:41 ` [U-Boot] " Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2018-07-27 0:35 UTC (permalink / raw)
To: u-boot
On 26 July 2018 at 07:19, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> The Assigned Clock parents and rates misses the fact that a "0" entry can
> be passed to skip setting a parent or rate of an assigned clock as
> described in the Linux clock bindings at [1].
>
> This patch simply skips the clock reparenting if the DT parsing returns
> -ENOENT and the clock rate setting if "0" is passed as clock rate.
>
> [1] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/clock/clock-bindings.txt#L135
>
> Fixes: f4fcba5c5baa "clk: implement clk_set_defaults()"
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
> drivers/clk/clk-uclass.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] clk: clk_set_default: accept no-op skip fields
2018-07-26 13:19 [U-Boot] [PATCH] clk: clk_set_default: accept no-op skip fields Neil Armstrong
2018-07-27 0:35 ` Simon Glass
@ 2018-08-04 23:41 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2018-08-04 23:41 UTC (permalink / raw)
To: u-boot
On Thu, Jul 26, 2018 at 03:19:32PM +0200, Neil Armstrong wrote:
> The Assigned Clock parents and rates misses the fact that a "0" entry can
> be passed to skip setting a parent or rate of an assigned clock as
> described in the Linux clock bindings at [1].
>
> This patch simply skips the clock reparenting if the DT parsing returns
> -ENOENT and the clock rate setting if "0" is passed as clock rate.
>
> [1] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/clock/clock-bindings.txt#L135
>
> Fixes: f4fcba5c5baa "clk: implement clk_set_defaults()"
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180804/65e44228/attachment.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-08-04 23:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-26 13:19 [U-Boot] [PATCH] clk: clk_set_default: accept no-op skip fields Neil Armstrong
2018-07-27 0:35 ` Simon Glass
2018-08-04 23:41 ` [U-Boot] " Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.