mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mci: imx: fix clk handling after clk driver update
@ 2024-06-10 13:05 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2024-06-10 13:05 UTC (permalink / raw)
  To: Barebox List

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-10 13:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-10 13:05 [PATCH] mci: imx: fix clk handling after clk driver update Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox