public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alifer Moraes <alifer.wsdm@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 2/3] clk: imx: imx8mn: add set_parent callback
Date: Fri, 14 Feb 2020 13:08:28 -0300	[thread overview]
Message-ID: <20200214160829.27994-2-alifer.wsdm@gmail.com> (raw)
In-Reply-To: <20200214160829.27994-1-alifer.wsdm@gmail.com>

Add set_parent callback, then assigned-clock-parents in dts could work properly

Signed-off-by: Alifer Moraes <alifer.wsdm@gmail.com>
---
 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)
-- 
2.17.1

  reply	other threads:[~2020-02-14 16:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 16:08 [PATCH 1/3] clk: imx: imx8mn: add enet clk Alifer Moraes
2020-02-14 16:08 ` Alifer Moraes [this message]
2020-02-14 16:08 ` [PATCH 3/3] imx: imx8mn-evk: enable ethernet Alifer Moraes
2020-02-20 22:29 ` [PATCH 1/3] clk: imx: imx8mn: add enet clk Lukasz Majewski
2020-02-21 11:13   ` Alifer Moraes
2020-02-21 11:21     ` Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200214160829.27994-2-alifer.wsdm@gmail.com \
    --to=alifer.wsdm@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox