From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claudiu.Beznea at microchip.com Date: Tue, 4 Aug 2020 07:24:59 +0000 Subject: [PATCH 04/22] clk: bind clk to new parent device In-Reply-To: References: <1596034301-5428-1-git-send-email-claudiu.beznea@microchip.com> <1596034301-5428-5-git-send-email-claudiu.beznea@microchip.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 04.08.2020 05:00, Simon Glass wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On Wed, 29 Jul 2020 at 08:51, Claudiu Beznea > wrote: >> >> 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 >> --- >> drivers/clk/clk-uclass.c | 11 ++++++++++- >> 1 file changed, 10 insertions(+), 1 deletion(-) > > Reviewed-by: Simon Glass > > But please add a sandbox test. Sure! > > >> >> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c >> index aa1f11a27c41..b390a6b01c06 100644 >> --- a/drivers/clk/clk-uclass.c >> +++ b/drivers/clk/clk-uclass.c >> @@ -14,6 +14,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -511,6 +512,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)) >> @@ -520,7 +522,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) >> -- >> 2.7.4 >>