<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 4a5ac516ca0a820e7c006ae408872009e37e114b Mon Sep 17 00:00:00 2001
From: Liam Fraser &lt;liam@raspberrypi.com&gt;
Date: Thu, 14 Mar 2019 16:01:26 +0000
Subject: [PATCH] mmc: sdhci-of-dwcmshc: define sdio timeout clocks

Signed-off-by: Liam Fraser &lt;liam@raspberrypi.com&gt;
---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 12 ++++++++++++
 drivers/mmc/host/sdhci-pltfm.c      |  8 ++++++++
 drivers/mmc/host/sdhci-pltfm.h      |  3 +++
 3 files changed, 23 insertions(+)

--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -330,6 +330,7 @@ static const struct sdhci_ops sdhci_dwcm
 	.set_bus_width		= sdhci_set_bus_width,
 	.set_uhs_signaling	= dwcmshc_set_uhs_signaling,
 	.get_max_clock		= dwcmshc_get_max_clock,
+	.get_timeout_clock	= sdhci_pltfm_clk_get_timeout_clock,
 	.reset			= sdhci_reset,
 	.adma_write_desc	= dwcmshc_adma_write_desc,
 };
@@ -500,6 +501,16 @@ static int dwcmshc_probe(struct platform
 			clk_prepare_enable(priv-&gt;bus_clk);
 	}
 
+	pltfm_host-&gt;timeout_clk = devm_clk_get(&amp;pdev-&gt;dev, "timeout");
+	if (IS_ERR(pltfm_host-&gt;timeout_clk)) {
+		err = PTR_ERR(pltfm_host-&gt;timeout_clk);
+		dev_err(&amp;pdev-&gt;dev, "failed to get timeout clk: %d\n", err);
+		goto free_pltfm;
+	}
+	err = clk_prepare_enable(pltfm_host-&gt;timeout_clk);
+	if (err)
+		goto free_pltfm;
+
 	err = mmc_of_parse(host-&gt;mmc);
 	if (err)
 		goto err_clk;
@@ -550,6 +561,7 @@ err_setup_host:
 	sdhci_cleanup_host(host);
 err_clk:
 	clk_disable_unprepare(pltfm_host-&gt;clk);
+	clk_disable_unprepare(pltfm_host-&gt;timeout_clk);
 	clk_disable_unprepare(priv-&gt;bus_clk);
 	if (rk_priv)
 		clk_bulk_disable_unprepare(RK35xx_MAX_CLKS,
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -33,6 +33,14 @@ unsigned int sdhci_pltfm_clk_get_max_clo
 }
 EXPORT_SYMBOL_GPL(sdhci_pltfm_clk_get_max_clock);
 
+unsigned int sdhci_pltfm_clk_get_timeout_clock(struct sdhci_host *host)
+{
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+	return clk_get_rate(pltfm_host-&gt;timeout_clk);
+}
+EXPORT_SYMBOL_GPL(sdhci_pltfm_clk_get_timeout_clock);
+
 static const struct sdhci_ops sdhci_pltfm_ops = {
 	.set_clock = sdhci_set_clock,
 	.set_bus_width = sdhci_set_bus_width,
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -20,6 +20,7 @@ struct sdhci_pltfm_data {
 
 struct sdhci_pltfm_host {
 	struct clk *clk;
+	struct clk *timeout_clk;
 
 	/* migrate from sdhci_of_host */
 	unsigned int clock;
@@ -106,6 +107,8 @@ extern int sdhci_pltfm_unregister(struct
 
 extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);
 
+extern unsigned int sdhci_pltfm_clk_get_timeout_clock(struct sdhci_host *host);
+
 static inline void *sdhci_pltfm_priv(struct sdhci_pltfm_host *host)
 {
 	return host-&gt;private;
</pre></body></html>