Merge tag 'u-boot-imx-20200825' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
[platform/kernel/u-boot.git] / drivers / mmc / sdhci.c
index f4eb655..7673219 100644 (file)
@@ -15,7 +15,6 @@
 #include <malloc.h>
 #include <mmc.h>
 #include <sdhci.h>
-#include <dm.h>
 #include <asm/cache.h>
 #include <linux/bitops.h>
 #include <linux/delay.h>
@@ -749,9 +748,9 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
                                            "sdhci-caps-mask", 0);
        dt_caps = dev_read_u64_default(host->mmc->dev,
                                       "sdhci-caps", 0);
-       caps = ~(u32)dt_caps_mask &
+       caps = ~lower_32_bits(dt_caps_mask) &
               sdhci_readl(host, SDHCI_CAPABILITIES);
-       caps |= (u32)dt_caps;
+       caps |= lower_32_bits(dt_caps);
 #else
        caps = sdhci_readl(host, SDHCI_CAPABILITIES);
 #endif
@@ -794,9 +793,9 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
        /* Check whether the clock multiplier is supported or not */
        if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {
 #if CONFIG_IS_ENABLED(DM_MMC)
-               caps_1 = ~(u32)(dt_caps_mask >> 32) &
+               caps_1 = ~upper_32_bits(dt_caps_mask) &
                         sdhci_readl(host, SDHCI_CAPABILITIES_1);
-               caps_1 |= (u32)(dt_caps >> 32);
+               caps_1 |= upper_32_bits(dt_caps);
 #else
                caps_1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
 #endif
@@ -844,7 +843,10 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
        if (host->quirks & SDHCI_QUIRK_BROKEN_VOLTAGE)
                cfg->voltages |= host->voltages;
 
-       cfg->host_caps |= MMC_MODE_HS | MMC_MODE_HS_52MHz | MMC_MODE_4BIT;
+       if (caps & SDHCI_CAN_DO_HISPD)
+               cfg->host_caps |= MMC_MODE_HS | MMC_MODE_HS_52MHz;
+
+       cfg->host_caps |= MMC_MODE_4BIT;
 
        /* Since Host Controller Version3.0 */
        if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {