summaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-6.6/950-0532-mmc-sdhci-of-dwcmshc-define-sdio-timeout-clocks.patch
blob: 55def7c257b4efbc9e643d6ecd9033e8492401a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
From cd6b71c50ab49d71511f7a9c74cca5705bbe5fee Mon Sep 17 00:00:00 2001
From: Liam Fraser <liam@raspberrypi.com>
Date: Thu, 14 Mar 2019 16:01:26 +0000
Subject: [PATCH 0532/1085] mmc: sdhci-of-dwcmshc: define sdio timeout clocks

Signed-off-by: Liam Fraser <liam@raspberrypi.com>
---
 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
@@ -343,6 +343,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,
 };
@@ -514,6 +515,16 @@ static int dwcmshc_probe(struct platform
 			clk_prepare_enable(priv->bus_clk);
 	}
 
+	pltfm_host->timeout_clk = devm_clk_get(&pdev->dev, "timeout");
+	if (IS_ERR(pltfm_host->timeout_clk)) {
+		err = PTR_ERR(pltfm_host->timeout_clk);
+		dev_err(&pdev->dev, "failed to get timeout clk: %d\n", err);
+		goto free_pltfm;
+	}
+	err = clk_prepare_enable(pltfm_host->timeout_clk);
+	if (err)
+		goto free_pltfm;
+
 	err = mmc_of_parse(host->mmc);
 	if (err)
 		goto err_clk;
@@ -578,6 +589,7 @@ err_rpm:
 	pm_runtime_put_noidle(dev);
 err_clk:
 	clk_disable_unprepare(pltfm_host->clk);
+	clk_disable_unprepare(pltfm_host->timeout_clk);
 	clk_disable_unprepare(priv->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->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 void sdhci_pltfm_remove(struct pl
 
 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->private;