mmc: sdhci: use the generic error number
Use the generic error number instead of meaningless value. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
895549a2d9
commit
2cb5d67c1a
@ -157,7 +157,7 @@ int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq)
|
|||||||
bcm_host = calloc(1, sizeof(*bcm_host));
|
bcm_host = calloc(1, sizeof(*bcm_host));
|
||||||
if (!bcm_host) {
|
if (!bcm_host) {
|
||||||
printf("sdhci_host calloc fail!\n");
|
printf("sdhci_host calloc fail!\n");
|
||||||
return 1;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -21,7 +21,7 @@ int ftsdc021_sdhci_init(u32 regbase)
|
|||||||
host = calloc(1, sizeof(struct sdhci_host));
|
host = calloc(1, sizeof(struct sdhci_host));
|
||||||
if (!host) {
|
if (!host) {
|
||||||
puts("sdh_host malloc fail!\n");
|
puts("sdh_host malloc fail!\n");
|
||||||
return 1;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
host->name = "FTSDC021";
|
host->name = "FTSDC021";
|
||||||
|
@ -27,7 +27,7 @@ static int init_kona_mmc_core(struct sdhci_host *host)
|
|||||||
|
|
||||||
if (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & SDHCI_RESET_ALL) {
|
if (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & SDHCI_RESET_ALL) {
|
||||||
printf("%s: sd host controller reset error\n", __func__);
|
printf("%s: sd host controller reset error\n", __func__);
|
||||||
return 1;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For kona a hardware reset before anything else. */
|
/* For kona a hardware reset before anything else. */
|
||||||
@ -39,7 +39,7 @@ static int init_kona_mmc_core(struct sdhci_host *host)
|
|||||||
do {
|
do {
|
||||||
if (timeout == 0) {
|
if (timeout == 0) {
|
||||||
printf("%s: reset timeout error\n", __func__);
|
printf("%s: reset timeout error\n", __func__);
|
||||||
return 1;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
timeout--;
|
timeout--;
|
||||||
udelay(100);
|
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)) {
|
while (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) {
|
||||||
if (timeout == 0) {
|
if (timeout == 0) {
|
||||||
printf("%s: CARD DETECT timeout error\n", __func__);
|
printf("%s: CARD DETECT timeout error\n", __func__);
|
||||||
return 1;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
timeout--;
|
timeout--;
|
||||||
udelay(100);
|
udelay(100);
|
||||||
|
@ -71,7 +71,7 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks)
|
|||||||
host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
|
host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
|
||||||
if (!host) {
|
if (!host) {
|
||||||
printf("sdh_host malloc fail!\n");
|
printf("sdh_host malloc fail!\n");
|
||||||
return 1;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
host->name = MVSDH_NAME;
|
host->name = MVSDH_NAME;
|
||||||
|
@ -100,7 +100,7 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width)
|
|||||||
struct sdhci_host *host = calloc(1, sizeof(struct sdhci_host));
|
struct sdhci_host *host = calloc(1, sizeof(struct sdhci_host));
|
||||||
if (!host) {
|
if (!host) {
|
||||||
printf("sdhci__host allocation fail!\n");
|
printf("sdhci__host allocation fail!\n");
|
||||||
return 1;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
host->ioaddr = (void *)regbase;
|
host->ioaddr = (void *)regbase;
|
||||||
host->index = index;
|
host->index = index;
|
||||||
@ -154,7 +154,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
|
|||||||
dev_id = pinmux_decode_periph_id(blob, node);
|
dev_id = pinmux_decode_periph_id(blob, node);
|
||||||
if (dev_id < PERIPH_ID_SDMMC0 && dev_id > PERIPH_ID_SDMMC3) {
|
if (dev_id < PERIPH_ID_SDMMC0 && dev_id > PERIPH_ID_SDMMC3) {
|
||||||
debug("MMC: Can't get device id\n");
|
debug("MMC: Can't get device id\n");
|
||||||
return -1;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
host->index = dev_id - PERIPH_ID_SDMMC0;
|
host->index = dev_id - PERIPH_ID_SDMMC0;
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
|
|||||||
bus_width = fdtdec_get_int(blob, node, "samsung,bus-width", 0);
|
bus_width = fdtdec_get_int(blob, node, "samsung,bus-width", 0);
|
||||||
if (bus_width <= 0) {
|
if (bus_width <= 0) {
|
||||||
debug("MMC: Can't get bus-width\n");
|
debug("MMC: Can't get bus-width\n");
|
||||||
return -1;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
host->bus_width = bus_width;
|
host->bus_width = bus_width;
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
|
|||||||
base = fdtdec_get_addr(blob, node, "reg");
|
base = fdtdec_get_addr(blob, node, "reg");
|
||||||
if (!base) {
|
if (!base) {
|
||||||
debug("MMC: Can't get base address\n");
|
debug("MMC: Can't get base address\n");
|
||||||
return -1;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
host->ioaddr = (void *)base;
|
host->ioaddr = (void *)base;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
|
|||||||
if (stat & SDHCI_INT_ERROR) {
|
if (stat & SDHCI_INT_ERROR) {
|
||||||
printf("%s: Error detected in status(0x%X)!\n",
|
printf("%s: Error detected in status(0x%X)!\n",
|
||||||
__func__, stat);
|
__func__, stat);
|
||||||
return -1;
|
return -EIO;
|
||||||
}
|
}
|
||||||
if (stat & rdy) {
|
if (stat & rdy) {
|
||||||
if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & mask))
|
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);
|
udelay(10);
|
||||||
else {
|
else {
|
||||||
printf("%s: Transfer data timeout\n", __func__);
|
printf("%s: Transfer data timeout\n", __func__);
|
||||||
return -1;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
} while (!(stat & SDHCI_INT_DATA_END));
|
} while (!(stat & SDHCI_INT_DATA_END));
|
||||||
return 0;
|
return 0;
|
||||||
@ -303,7 +303,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
|
|||||||
if (timeout == 0) {
|
if (timeout == 0) {
|
||||||
printf("%s: Timeout to wait cmd & data inhibit\n",
|
printf("%s: Timeout to wait cmd & data inhibit\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -1;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout--;
|
timeout--;
|
||||||
@ -374,7 +374,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
|
|||||||
if (timeout == 0) {
|
if (timeout == 0) {
|
||||||
printf("%s: Internal clock never stabilised.\n",
|
printf("%s: Internal clock never stabilised.\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -1;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
timeout--;
|
timeout--;
|
||||||
udelay(1000);
|
udelay(1000);
|
||||||
@ -477,7 +477,7 @@ static int sdhci_init(struct mmc *mmc)
|
|||||||
if (!aligned_buffer) {
|
if (!aligned_buffer) {
|
||||||
printf("%s: Aligned buffer alloc failed!!!\n",
|
printf("%s: Aligned buffer alloc failed!!!\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -1;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +631,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk)
|
|||||||
host->mmc = mmc_create(&host->cfg, host);
|
host->mmc = mmc_create(&host->cfg, host);
|
||||||
if (host->mmc == NULL) {
|
if (host->mmc == NULL) {
|
||||||
printf("%s: mmc create fail!\n", __func__);
|
printf("%s: mmc create fail!\n", __func__);
|
||||||
return -1;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user