mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] mci: imx: fix clk handling after clk driver update
Date: Mon, 10 Jun 2024 15:05:19 +0200	[thread overview]
Message-ID: <20240610130519.2659833-1-s.hauer@pengutronix.de> (raw)

Since c54441527a the i.MX27 clk driver has been synced with the Kernel.
We now have to get the two clocks specified in the device tree. Also we
have to enable the clocks explicitly, they no longer come up enabled.
This fixes the MMC driver hanging on card probe.

Fixes: c54441527a ("clk: imx27: sync with kernel")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mci/imx.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/mci/imx.c b/drivers/mci/imx.c
index 48a3378335..3607a5feb2 100644
--- a/drivers/mci/imx.c
+++ b/drivers/mci/imx.c
@@ -100,7 +100,8 @@ struct mxcmci_regs {
 struct mxcmci_host {
 	struct mci_host		mci;
 	struct mxcmci_regs	*base;
-	struct clk		*clk;
+	struct clk		*clk_per;
+	struct clk		*clk_ipg;
 	int			irq;
 	int			detect_irq;
 	int			dma;
@@ -414,7 +415,7 @@ static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios)
 {
 	unsigned int divider;
 	int prescaler = 0;
-	unsigned long clk_in = clk_get_rate(host->clk);
+	unsigned long clk_in = clk_get_rate(host->clk_per);
 
 	while (prescaler <= 0x800) {
 		for (divider = 1; divider <= 0xF; divider++) {
@@ -494,9 +495,13 @@ static int mxcmci_probe(struct device *dev)
 
 	host = xzalloc(sizeof(*host));
 
-	host->clk = clk_get(dev, NULL);
-	if (IS_ERR(host->clk))
-		return PTR_ERR(host->clk);
+	host->clk_per = clk_get_enabled(dev, "per");
+	if (IS_ERR(host->clk_per))
+		return PTR_ERR(host->clk_per);
+
+	host->clk_ipg = clk_get_enabled(dev, "ipg");
+	if (IS_ERR(host->clk_ipg))
+		return PTR_ERR(host->clk_ipg);
 
 	host->mci.send_cmd = mxcmci_request;
 	host->mci.set_ios = mxcmci_set_ios;
@@ -511,7 +516,7 @@ static int mxcmci_probe(struct device *dev)
 
 	host->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
 
-	rate = clk_get_rate(host->clk);
+	rate = clk_get_rate(host->clk_per);
 	host->mci.f_min = rate >> 7;
 	host->mci.f_max = rate >> 1;
 
-- 
2.39.2




                 reply	other threads:[~2024-06-10 13:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240610130519.2659833-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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