mmc: sdhci: use the host version value in sdhci_setup_cfg
[oweals/u-boot.git] / drivers / mmc / kona_sdhci.c
index 77e42c8afe87c1d4cce3abe9fe377df497491c3d..c67a262c7ae8272b92b5b2fc72540a85982a4ebb 100644 (file)
@@ -7,7 +7,7 @@
 #include <common.h>
 #include <malloc.h>
 #include <sdhci.h>
-#include <asm/errno.h>
+#include <linux/errno.h>
 #include <asm/kona-common/clk.h>
 
 #define SDHCI_CORECTRL_OFFSET          0x00008000
@@ -113,21 +113,19 @@ int kona_sdhci_init(int dev_index, u32 min_clk, u32 quirks)
                       __func__, dev_index);
                ret = -EINVAL;
        }
-       if (ret)
+       if (ret) {
+               free(host);
                return ret;
+       }
 
        host->name = "kona-sdhci";
        host->ioaddr = reg_base;
        host->quirks = quirks;
-       host->host_caps = MMC_MODE_HC;
 
-       if (init_kona_mmc_core(host))
+       if (init_kona_mmc_core(host)) {
+               free(host);
                return -EINVAL;
-
-       if (quirks & SDHCI_QUIRK_REG32_RW)
-               host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
-       else
-               host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
+       }
 
        add_sdhci(host, max_clk, min_clk);
        return ret;