950-0878-mmc-sdhci-of-dwcmshc-define-sdio-timeout-clocks.patch 2.7 KB

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