summaryrefslogtreecommitdiff
path: root/drivers/mmc/sdhci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/sdhci.c')
-rw-r--r--drivers/mmc/sdhci.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index b2bf5a0..837c538 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -87,7 +87,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
if (stat & SDHCI_INT_ERROR) {
printf("%s: Error detected in status(0x%X)!\n",
__func__, stat);
- return -1;
+ return -EIO;
}
if (stat & rdy) {
if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & mask))
@@ -110,7 +110,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
udelay(10);
else {
printf("%s: Transfer data timeout\n", __func__);
- return -1;
+ return -ETIMEDOUT;
}
} while (!(stat & SDHCI_INT_DATA_END));
return 0;
@@ -303,7 +303,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
if (timeout == 0) {
printf("%s: Timeout to wait cmd & data inhibit\n",
__func__);
- return -1;
+ return -EBUSY;
}
timeout--;
@@ -374,7 +374,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
if (timeout == 0) {
printf("%s: Internal clock never stabilised.\n",
__func__);
- return -1;
+ return -EBUSY;
}
timeout--;
udelay(1000);
@@ -477,7 +477,7 @@ static int sdhci_init(struct mmc *mmc)
if (!aligned_buffer) {
printf("%s: Aligned buffer alloc failed!!!\n",
__func__);
- return -1;
+ return -ENOMEM;
}
}
@@ -546,7 +546,11 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
return -EINVAL;
}
#endif
- host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
+ if (host->quirks & SDHCI_QUIRK_REG32_RW)
+ host->version =
+ sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
+ else
+ host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
cfg->name = host->name;
#ifndef CONFIG_DM_MMC_OPS
@@ -627,7 +631,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk)
host->mmc = mmc_create(&host->cfg, host);
if (host->mmc == NULL) {
printf("%s: mmc create fail!\n", __func__);
- return -1;
+ return -ENOMEM;
}
return 0;