Commit d64caaf77dec2f0a576d0d1f7c7f4f463ebc7de8
Committed by
Tom Rini
1 parent
314d3acd4d
Exists in
smarc_8mq_lf_v2020.04
and in
11 other branches
clk: clk_set_default: accept no-op skip fields
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>
Showing 1 changed file with 8 additions and 0 deletions Side-by-side Diff
drivers/clk/clk-uclass.c
... | ... | @@ -154,6 +154,10 @@ |
154 | 154 | for (index = 0; index < num_parents; index++) { |
155 | 155 | ret = clk_get_by_indexed_prop(dev, "assigned-clock-parents", |
156 | 156 | index, &parent_clk); |
157 | + /* If -ENOENT, this is a no-op entry */ | |
158 | + if (ret == -ENOENT) | |
159 | + continue; | |
160 | + | |
157 | 161 | if (ret) { |
158 | 162 | debug("%s: could not get parent clock %d for %s\n", |
159 | 163 | __func__, index, dev_read_name(dev)); |
... | ... | @@ -210,6 +214,10 @@ |
210 | 214 | goto fail; |
211 | 215 | |
212 | 216 | for (index = 0; index < num_rates; index++) { |
217 | + /* If 0 is passed, this is a no-op */ | |
218 | + if (!rates[index]) | |
219 | + continue; | |
220 | + | |
213 | 221 | ret = clk_get_by_indexed_prop(dev, "assigned-clocks", |
214 | 222 | index, &clk); |
215 | 223 | if (ret) { |