From patchwork Fri Feb 14 16:08:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alifer Moraes X-Patchwork-Id: 236376 List-Id: U-Boot discussion From: alifer.wsdm at gmail.com (Alifer Moraes) Date: Fri, 14 Feb 2020 13:08:28 -0300 Subject: [PATCH 2/3] clk: imx: imx8mn: add set_parent callback In-Reply-To: <20200214160829.27994-1-alifer.wsdm@gmail.com> References: <20200214160829.27994-1-alifer.wsdm@gmail.com> Message-ID: <20200214160829.27994-2-alifer.wsdm@gmail.com> Add set_parent callback, then assigned-clock-parents in dts could work properly Signed-off-by: Alifer Moraes --- drivers/clk/imx/clk-imx8mn.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index 103ba770ed..2abd9a3810 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -175,11 +175,30 @@ static int imx8mn_clk_enable(struct clk *clk) return __imx8mn_clk_enable(clk, 1); } +static int imx8mn_clk_set_parent(struct clk *clk, struct clk *parent) +{ + struct clk *c, *cp; + int ret; + + debug("%s(#%lu), parent: %lu\n", __func__, clk->id, parent->id); + + ret = clk_get_by_id(clk->id, &c); + if (ret) + return ret; + + ret = clk_get_by_id(parent->id, &cp); + if (ret) + return ret; + + return clk_set_parent(c, cp); +} + static struct clk_ops imx8mn_clk_ops = { .set_rate = imx8mn_clk_set_rate, .get_rate = imx8mn_clk_get_rate, .enable = imx8mn_clk_enable, .disable = imx8mn_clk_disable, + .set_parent = imx8mn_clk_set_parent, }; static int imx8mn_clk_probe(struct udevice *dev)