X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fmmc%2Fkona_sdhci.c;h=2bbe673b91299d0d6d61b975cd43c44eb9e97f2f;hb=c05ed00afb95fa5237f16962fccf5810437317bf;hp=77e42c8afe87c1d4cce3abe9fe377df497491c3d;hpb=1ad6364eeb4f578e423081d1748e8a3fdf1ab01d;p=oweals%2Fu-boot.git diff --git a/drivers/mmc/kona_sdhci.c b/drivers/mmc/kona_sdhci.c index 77e42c8afe..2bbe673b91 100644 --- a/drivers/mmc/kona_sdhci.c +++ b/drivers/mmc/kona_sdhci.c @@ -1,13 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2013 Broadcom Corporation. - * - * SPDX-License-Identifier: GPL-2.0+ */ #include #include #include -#include +#include +#include #include #define SDHCI_CORECTRL_OFFSET 0x00008000 @@ -27,7 +27,7 @@ static int init_kona_mmc_core(struct sdhci_host *host) if (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & SDHCI_RESET_ALL) { printf("%s: sd host controller reset error\n", __func__); - return 1; + return -EBUSY; } /* For kona a hardware reset before anything else. */ @@ -39,7 +39,7 @@ static int init_kona_mmc_core(struct sdhci_host *host) do { if (timeout == 0) { printf("%s: reset timeout error\n", __func__); - return 1; + return -ETIMEDOUT; } timeout--; udelay(100); @@ -67,7 +67,7 @@ static int init_kona_mmc_core(struct sdhci_host *host) while (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) { if (timeout == 0) { printf("%s: CARD DETECT timeout error\n", __func__); - return 1; + return -ETIMEDOUT; } timeout--; udelay(100); @@ -113,22 +113,21 @@ 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; + host->max_clk = max_clk; - 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); + add_sdhci(host, 0, min_clk); return ret; }