]> git.sur5r.net Git - u-boot/blobdiff - drivers/mmc/mmc_spi.c
mtd: nand: mxs_nand: move structs into header file
[u-boot] / drivers / mmc / mmc_spi.c
index 7547e1aef88c1bdee9937471e8e217a4b87793c7..a9d95fbd7470fa8bbca2e87d511486c255311c65 100644 (file)
@@ -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);
@@ -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)