bcm27xx: update 6.1 patches to latest version
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-6.1 / 950-0878-mmc-sdhci-of-dwcmshc-define-sdio-timeout-clocks.patch
1 From 4a5ac516ca0a820e7c006ae408872009e37e114b Mon Sep 17 00:00:00 2001
2 From: Liam Fraser <liam@raspberrypi.com>
3 Date: Thu, 14 Mar 2019 16:01:26 +0000
4 Subject: [PATCH] mmc: sdhci-of-dwcmshc: define sdio timeout clocks
5
6 Signed-off-by: Liam Fraser <liam@raspberrypi.com>
7 ---
8 drivers/mmc/host/sdhci-of-dwcmshc.c | 12 ++++++++++++
9 drivers/mmc/host/sdhci-pltfm.c | 8 ++++++++
10 drivers/mmc/host/sdhci-pltfm.h | 3 +++
11 3 files changed, 23 insertions(+)
12
13 --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
14 +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
15 @@ -330,6 +330,7 @@ static const struct sdhci_ops sdhci_dwcm
16 .set_bus_width = sdhci_set_bus_width,
17 .set_uhs_signaling = dwcmshc_set_uhs_signaling,
18 .get_max_clock = dwcmshc_get_max_clock,
19 + .get_timeout_clock = sdhci_pltfm_clk_get_timeout_clock,
20 .reset = sdhci_reset,
21 .adma_write_desc = dwcmshc_adma_write_desc,
22 };
23 @@ -500,6 +501,16 @@ static int dwcmshc_probe(struct platform
24 clk_prepare_enable(priv->bus_clk);
25 }
26
27 + pltfm_host->timeout_clk = devm_clk_get(&pdev->dev, "timeout");
28 + if (IS_ERR(pltfm_host->timeout_clk)) {
29 + err = PTR_ERR(pltfm_host->timeout_clk);
30 + dev_err(&pdev->dev, "failed to get timeout clk: %d\n", err);
31 + goto free_pltfm;
32 + }
33 + err = clk_prepare_enable(pltfm_host->timeout_clk);
34 + if (err)
35 + goto free_pltfm;
36 +
37 err = mmc_of_parse(host->mmc);
38 if (err)
39 goto err_clk;
40 @@ -550,6 +561,7 @@ err_setup_host:
41 sdhci_cleanup_host(host);
42 err_clk:
43 clk_disable_unprepare(pltfm_host->clk);
44 + clk_disable_unprepare(pltfm_host->timeout_clk);
45 clk_disable_unprepare(priv->bus_clk);
46 if (rk_priv)
47 clk_bulk_disable_unprepare(RK35xx_MAX_CLKS,
48 --- a/drivers/mmc/host/sdhci-pltfm.c
49 +++ b/drivers/mmc/host/sdhci-pltfm.c
50 @@ -33,6 +33,14 @@ unsigned int sdhci_pltfm_clk_get_max_clo
51 }
52 EXPORT_SYMBOL_GPL(sdhci_pltfm_clk_get_max_clock);
53
54 +unsigned int sdhci_pltfm_clk_get_timeout_clock(struct sdhci_host *host)
55 +{
56 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
57 +
58 + return clk_get_rate(pltfm_host->timeout_clk);
59 +}
60 +EXPORT_SYMBOL_GPL(sdhci_pltfm_clk_get_timeout_clock);
61 +
62 static const struct sdhci_ops sdhci_pltfm_ops = {
63 .set_clock = sdhci_set_clock,
64 .set_bus_width = sdhci_set_bus_width,
65 --- a/drivers/mmc/host/sdhci-pltfm.h
66 +++ b/drivers/mmc/host/sdhci-pltfm.h
67 @@ -20,6 +20,7 @@ struct sdhci_pltfm_data {
68
69 struct sdhci_pltfm_host {
70 struct clk *clk;
71 + struct clk *timeout_clk;
72
73 /* migrate from sdhci_of_host */
74 unsigned int clock;
75 @@ -106,6 +107,8 @@ extern int sdhci_pltfm_unregister(struct
76
77 extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);
78
79 +extern unsigned int sdhci_pltfm_clk_get_timeout_clock(struct sdhci_host *host);
80 +
81 static inline void *sdhci_pltfm_priv(struct sdhci_pltfm_host *host)
82 {
83 return host->private;