]> Git Repo - J-u-boot.git/blobdiff - drivers/mmc/rockchip_sdhci.c
dm: core: Replace of_offset with accessor
[J-u-boot.git] / drivers / mmc / rockchip_sdhci.c
index c56e1a3a1c5ba5afb0f3e0cecfb8e0e82b6b0d66..bd91f917580ae3a779f5d5f7247cd2c1e53fd612 100644 (file)
@@ -12,7 +12,9 @@
 #include <libfdt.h>
 #include <malloc.h>
 #include <sdhci.h>
+#include <clk.h>
 
+DECLARE_GLOBAL_DATA_PTR;
 /* 400KHz is max freq for card ID etc. Use that as min */
 #define EMMC_MIN_FREQ  400000
 
@@ -32,12 +34,25 @@ static int arasan_sdhci_probe(struct udevice *dev)
        struct rockchip_sdhc_plat *plat = dev_get_platdata(dev);
        struct rockchip_sdhc *prv = dev_get_priv(dev);
        struct sdhci_host *host = &prv->host;
-       int ret;
+       int max_frequency, ret;
+       struct clk clk;
+
+
+       max_frequency = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                       "max-frequency", 0);
+       ret = clk_get_by_index(dev, 0, &clk);
+       if (!ret) {
+               ret = clk_set_rate(&clk, max_frequency);
+               if (IS_ERR_VALUE(ret))
+                       printf("%s clk set rate fail!\n", __func__);
+       } else {
+               printf("%s fail to get clk\n", __func__);
+       }
 
        host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD;
+       host->max_clk = max_frequency;
 
-       ret = sdhci_setup_cfg(&plat->cfg, host, CONFIG_ROCKCHIP_SDHCI_MAX_FREQ,
-                       EMMC_MIN_FREQ);
+       ret = sdhci_setup_cfg(&plat->cfg, host, 0, EMMC_MIN_FREQ);
 
        host->mmc = &plat->mmc;
        if (ret)
This page took 0.027284 seconds and 4 git commands to generate.