summaryrefslogtreecommitdiff
path: root/drivers/mmc/mmc_spi.c
diff options
context:
space:
mode:
authorJaehoon Chung <jh80.chung@samsung.com>2016-07-19 16:33:36 +0900
committerJaehoon Chung <jh80.chung@samsung.com>2016-08-05 11:21:25 +0900
commit915ffa5213756568f6185d05cda2cb2f6050f974 (patch)
tree7f0d304eabe717a9c1c871cb346e6cdf18157a40 /drivers/mmc/mmc_spi.c
parent70f862808e8ae4b97fe736ec9d9d496881ad84b2 (diff)
mmc: use the generic error number
Use the generic error number instead of specific error number. If use the generic error number, it can debug more easier. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'drivers/mmc/mmc_spi.c')
-rw-r--r--drivers/mmc/mmc_spi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c
index 7547e1aef8..25101179f6 100644
--- a/drivers/mmc/mmc_spi.c
+++ b/drivers/mmc/mmc_spi.c
@@ -5,6 +5,7 @@
* Licensed under the GPL-2 or later.
*/
#include <common.h>
+#include <errno.h>
#include <malloc.h>
#include <part.h>
#include <mmc.h>
@@ -182,13 +183,13 @@ static int mmc_spi_request(struct mmc *mmc, struct mmc_cmd *cmd,
spi_cs_activate(spi);
r1 = mmc_spi_sendcmd(mmc, cmd->cmdidx, cmd->cmdarg);
if (r1 == 0xff) { /* no response */
- ret = NO_CARD_ERR;
+ ret = -ENOMEDIUM;
goto done;
} else if (r1 & R1_SPI_COM_CRC) {
- ret = COMM_ERR;
+ ret = -ECOMM;
goto done;
} else if (r1 & ~R1_SPI_IDLE) { /* other errors */
- ret = TIMEOUT;
+ ret = -ETIMEDOUT;
goto done;
} else if (cmd->resp_type == MMC_RSP_R2) {
r1 = mmc_spi_readdata(mmc, cmd->response, 1, 16);
@@ -225,9 +226,9 @@ static int mmc_spi_request(struct mmc *mmc, struct mmc_cmd *cmd,
data->blocks, data->blocksize,
(cmd->cmdidx == MMC_CMD_WRITE_MULTIPLE_BLOCK));
if (r1 & R1_SPI_COM_CRC)
- ret = COMM_ERR;
+ ret = -ECOMM;
else if (r1) /* other errors */
- ret = TIMEOUT;
+ ret = -ETIMEDOUT;
}
done:
spi_cs_deactivate(spi);