]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: rockchip: Allow clocks to be missing
authorSimon Glass <sjg@chromium.org>
Fri, 20 Sep 2024 07:24:40 +0000 (09:24 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 3 Oct 2024 17:52:17 +0000 (11:52 -0600)
Allow MMC init when clock support is not enabled in a particular phase.

Refactor the setting of priv->emmc_clk so it is a bit clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/mmc/rockchip_dw_mmc.c
drivers/mmc/rockchip_sdhci.c

index 7e341665aa34932c51e7c54cd0b85817e25a5872..5ba99d68b7df0a48b1e1c5996d68b242c0dfe7ca 100644 (file)
@@ -131,13 +131,11 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
        priv->minmax[1] = dtplat->max_frequency;
 
        ret = clk_get_by_phandle(dev, &dtplat->clocks[1], &priv->clk);
-       if (ret < 0)
-               return ret;
 #else
        ret = clk_get_by_index(dev, 1, &priv->clk);
-       if (ret < 0)
-               return ret;
 #endif
+       if (ret < 0 && ret != -ENOSYS)
+               return log_msg_ret("clk", ret);
        host->fifo_depth = priv->fifo_depth;
        host->fifo_mode = priv->fifo_mode;
 
index 35667b86b50b2c8829b280783b5970a9c204ddf9..15b4a39770aa54a4c011eb06db1579cceb53c495 100644 (file)
@@ -571,20 +571,19 @@ static int rockchip_sdhci_probe(struct udevice *dev)
        struct rockchip_sdhc *priv = dev_get_priv(dev);
        struct mmc_config *cfg = &plat->cfg;
        struct sdhci_host *host = &priv->host;
-       struct clk clk;
+       struct clk *clk = &priv->emmc_clk;
        int ret;
 
        host->max_clk = cfg->f_max;
-       ret = clk_get_by_index(dev, 0, &clk);
+       ret = clk_get_by_index(dev, 0, clk);
        if (!ret) {
-               ret = clk_set_rate(&clk, host->max_clk);
+               ret = clk_set_rate(clk, host->max_clk);
                if (IS_ERR_VALUE(ret))
                        printf("%s clk set rate fail!\n", __func__);
-       } else {
+       } else if (ret != -ENOSYS) {
                printf("%s fail to get clk\n", __func__);
        }
 
-       priv->emmc_clk = clk;
        priv->dev = dev;
 
        if (data->get_phy) {