X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fmmc%2Fmmc_spi.c;h=a9d95fbd7470fa8bbca2e87d511486c255311c65;hb=bf1ae4426b89bd8b3e036e012acc4bc88fec4c6e;hp=7547e1aef88c1bdee9937471e8e217a4b87793c7;hpb=312a6c016a2d81aa3fbc605f5c0c315b6a4e3464;p=oweals%2Fu-boot.git diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c index 7547e1aef8..a9d95fbd74 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 +#include #include #include #include @@ -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); @@ -235,13 +236,14 @@ done: return ret; } -static void mmc_spi_set_ios(struct mmc *mmc) +static int mmc_spi_set_ios(struct mmc *mmc) { struct spi_slave *spi = mmc->priv; debug("%s: clock %u\n", __func__, mmc->clock); if (mmc->clock) spi_set_speed(spi, mmc->clock); + return 0; } static int mmc_spi_init_p(struct mmc *mmc)