All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V1 2/6] clk: imx: imx8mm: add set_parent callback
Date: Tue, 22 Oct 2019 03:29:51 +0000	[thread overview]
Message-ID: <20191022034714.27781-3-peng.fan@nxp.com> (raw)
In-Reply-To: <20191022034714.27781-1-peng.fan@nxp.com>

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

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/clk/imx/clk-imx8mm.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c
index 4911345fd9..091b092bbb 100644
--- a/drivers/clk/imx/clk-imx8mm.c
+++ b/drivers/clk/imx/clk-imx8mm.c
@@ -175,11 +175,30 @@ static int imx8mm_clk_enable(struct clk *clk)
 	return __imx8mm_clk_enable(clk, 1);
 }
 
+static int imx8mm_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 imx8mm_clk_ops = {
 	.set_rate = imx8mm_clk_set_rate,
 	.get_rate = imx8mm_clk_get_rate,
 	.enable = imx8mm_clk_enable,
 	.disable = imx8mm_clk_disable,
+	.set_parent = imx8mm_clk_set_parent,
 };
 
 static int imx8mm_clk_probe(struct udevice *dev)
-- 
2.16.4

  parent reply	other threads:[~2019-10-22  3:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22  3:29 [U-Boot] [PATCH V1 0/6] imx: imx8mm-evk: support eth Peng Fan
2019-10-22  3:29 ` [U-Boot] [PATCH V1 1/6] clk: imx8mm: add enet clk Peng Fan
2019-10-23 16:31   ` Schrempf Frieder
2019-10-22  3:29 ` Peng Fan [this message]
2019-10-23 16:31   ` [U-Boot] [PATCH V1 2/6] clk: imx: imx8mm: add set_parent callback Schrempf Frieder
2019-10-22  3:29 ` [U-Boot] [PATCH V1 3/6] arm: dts: imx8mm: drop assigned clocks for clk node Peng Fan
2019-10-22  3:29 ` [U-Boot] [PATCH V1 4/6] net: Kconfig: FEC: Add dependency on i.MX8M Peng Fan
2019-10-23 16:31   ` Schrempf Frieder
2019-10-22  3:30 ` [U-Boot] [PATCH V1 5/6] net: fec_mxc: support i.MX8M with CLK_CCF Peng Fan
2019-10-23 16:31   ` Schrempf Frieder
2019-10-24  1:09     ` Peng Fan
2019-10-24  7:53       ` Schrempf Frieder
2019-10-22  3:30 ` [U-Boot] [PATCH V1 6/6] imx: imx8mm-evk: enable ethernet Peng Fan
2019-10-22 12:24   ` Fabio Estevam
2019-10-23 13:35     ` Peng Fan

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=20191022034714.27781-3-peng.fan@nxp.com \
    --to=peng.fan@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.