aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c18
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h1
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index eb1310ca021e..1dd5ba858754 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -384,6 +384,20 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
384 } 384 }
385} 385}
386 386
387static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host)
388{
389 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
390 struct pltfm_imx_data *imx_data = pltfm_host->priv;
391 struct esdhc_platform_data *boarddata = &imx_data->boarddata;
392
393 u32 f_host = clk_get_rate(pltfm_host->clk);
394
395 if (boarddata->f_max && (boarddata->f_max < f_host))
396 return boarddata->f_max;
397 else
398 return f_host;
399}
400
387static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host) 401static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host)
388{ 402{
389 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 403 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -447,7 +461,7 @@ static const struct sdhci_ops sdhci_esdhc_ops = {
447 .write_w = esdhc_writew_le, 461 .write_w = esdhc_writew_le,
448 .write_b = esdhc_writeb_le, 462 .write_b = esdhc_writeb_le,
449 .set_clock = esdhc_pltfm_set_clock, 463 .set_clock = esdhc_pltfm_set_clock,
450 .get_max_clock = sdhci_pltfm_clk_get_max_clock, 464 .get_max_clock = esdhc_pltfm_get_max_clock,
451 .get_min_clock = esdhc_pltfm_get_min_clock, 465 .get_min_clock = esdhc_pltfm_get_min_clock,
452 .get_ro = esdhc_pltfm_get_ro, 466 .get_ro = esdhc_pltfm_get_ro,
453 .platform_bus_width = esdhc_pltfm_bus_width, 467 .platform_bus_width = esdhc_pltfm_bus_width,
@@ -490,6 +504,8 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
490 504
491 of_property_read_u32(np, "bus-width", &boarddata->max_bus_width); 505 of_property_read_u32(np, "bus-width", &boarddata->max_bus_width);
492 506
507 of_property_read_u32(np, "max-frequency", &boarddata->f_max);
508
493 return 0; 509 return 0;
494} 510}
495#else 511#else
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index b4a0521ce411..d44912d81578 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -40,5 +40,6 @@ struct esdhc_platform_data {
40 enum wp_types wp_type; 40 enum wp_types wp_type;
41 enum cd_types cd_type; 41 enum cd_types cd_type;
42 int max_bus_width; 42 int max_bus_width;
43 unsigned int f_max;
43}; 44};
44#endif /* __ASM_ARCH_IMX_ESDHC_H */ 45#endif /* __ASM_ARCH_IMX_ESDHC_H */