diff options
author | Claudiu Beznea <claudiu.beznea@microchip.com> | 2020-09-07 17:46:34 +0300 |
---|---|---|
committer | Eugen Hristev <eugen.hristev@microchip.com> | 2020-09-22 11:27:18 +0300 |
commit | 4d139f3838b4ee48d7df9ca9c37ccd1a57202a52 (patch) | |
tree | cfb9c112684b3421dbe7b396193f2eb1661fe5f8 /drivers/clk/clk-uclass.c | |
parent | cfecbaf4e768991056a88d3a7a3daf4b4baf8038 (diff) | |
download | u-boot-4d139f3838b4ee48d7df9ca9c37ccd1a57202a52.tar.gz u-boot-4d139f3838b4ee48d7df9ca9c37ccd1a57202a52.tar.bz2 u-boot-4d139f3838b4ee48d7df9ca9c37ccd1a57202a52.zip |
clk: bind clk to new parent device
Clock re-parenting is not binding the clock's device to its new
parent device, it only calls the clock's ops->set_parent() API. The
changes in this commit re-parent the clock device to its new parent
so that subsequent operations like clk_get_parent() to point to the
proper parent.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/clk/clk-uclass.c')
-rw-r--r-- | drivers/clk/clk-uclass.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 934cd5787a..5e0c8419d6 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -14,6 +14,7 @@ #include <errno.h> #include <log.h> #include <malloc.h> +#include <dm/device-internal.h> #include <dm/devres.h> #include <dm/read.h> #include <linux/bug.h> @@ -512,6 +513,7 @@ ulong clk_set_rate(struct clk *clk, ulong rate) int clk_set_parent(struct clk *clk, struct clk *parent) { const struct clk_ops *ops; + int ret; debug("%s(clk=%p, parent=%p)\n", __func__, clk, parent); if (!clk_valid(clk)) @@ -521,7 +523,14 @@ int clk_set_parent(struct clk *clk, struct clk *parent) if (!ops->set_parent) return -ENOSYS; - return ops->set_parent(clk, parent); + ret = ops->set_parent(clk, parent); + if (ret) + return ret; + + if (CONFIG_IS_ENABLED(CLK_CCF)) + ret = device_reparent(clk->dev, parent->dev); + + return ret; } int clk_enable(struct clk *clk) |