]> git.sur5r.net Git - u-boot/blobdiff - drivers/mmc/mxsmmc.c
spi: mxc_spi: Fix chipselect on DM_SPI driver uclass
[u-boot] / drivers / mmc / mxsmmc.c
index 9fa87d57173f685984528070bf2fd762caf3bb46..92db4ae5a66ddb25f31326a7e0c59d5ae5bd3f7a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Freescale i.MX28 SSP MMC driver
  *
  * Based vaguely on the pxa mmc code:
  * (C) Copyright 2003
  * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
 #include <malloc.h>
 #include <mmc.h>
-#include <asm/errno.h>
+#include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
-#include <asm/imx-common/dma.h>
+#include <asm/mach-imx/dma.h>
 #include <bouncebuf.h>
 
 struct mxsmmc_priv {
@@ -84,7 +83,7 @@ static int mxsmmc_send_cmd_pio(struct mxsmmc_priv *priv, struct mmc_data *data)
                }
        }
 
-       return timeout ? 0 : COMM_ERR;
+       return timeout ? 0 : -ECOMM;
 }
 
 static int mxsmmc_send_cmd_dma(struct mxsmmc_priv *priv, struct mmc_data *data)
@@ -120,7 +119,7 @@ static int mxsmmc_send_cmd_dma(struct mxsmmc_priv *priv, struct mmc_data *data)
        mxs_dma_desc_append(dmach, priv->desc);
        if (mxs_dma_go(dmach)) {
                bounce_buffer_stop(&bbstate);
-               return COMM_ERR;
+               return -ECOMM;
        }
 
        bounce_buffer_stop(&bbstate);
@@ -158,13 +157,13 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 
        if (!timeout) {
                printf("MMC%d: Bus busy timeout!\n", mmc->block_dev.devnum);
-               return TIMEOUT;
+               return -ETIMEDOUT;
        }
 
        /* See if card is present */
        if (!mxsmmc_cd(priv)) {
                printf("MMC%d: No card detected!\n", mmc->block_dev.devnum);
-               return NO_CARD_ERR;
+               return -ENOMEDIUM;
        }
 
        /* Start building CTRL0 contents */
@@ -203,7 +202,7 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
                        priv->mmc_is_wp(mmc->block_dev.devnum)) {
                        printf("MMC%d: Can not write a locked card!\n",
                                mmc->block_dev.devnum);
-                       return UNUSABLE_ERR;
+                       return -EOPNOTSUPP;
                }
 
                ctrl0 |= SSP_CTRL0_DATA_XFER;
@@ -244,21 +243,21 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
        if (!timeout) {
                printf("MMC%d: Command %d busy\n",
                        mmc->block_dev.devnum, cmd->cmdidx);
-               return TIMEOUT;
+               return -ETIMEDOUT;
        }
 
        /* Check command timeout */
        if (reg & SSP_STATUS_RESP_TIMEOUT) {
                printf("MMC%d: Command %d timeout (status 0x%08x)\n",
                        mmc->block_dev.devnum, cmd->cmdidx, reg);
-               return TIMEOUT;
+               return -ETIMEDOUT;
        }
 
        /* Check command errors */
        if (reg & (SSP_STATUS_RESP_CRC_ERR | SSP_STATUS_RESP_ERR)) {
                printf("MMC%d: Command %d error (status 0x%08x)!\n",
                        mmc->block_dev.devnum, cmd->cmdidx, reg);
-               return COMM_ERR;
+               return -ECOMM;
        }
 
        /* Copy response to response buffer */
@@ -298,13 +297,13 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
                SSP_STATUS_FIFO_OVRFLW | SSP_STATUS_FIFO_UNDRFLW)) {
                printf("MMC%d: Data error with command %d (status 0x%08x)!\n",
                        mmc->block_dev.devnum, cmd->cmdidx, reg);
-               return COMM_ERR;
+               return -ECOMM;
        }
 
        return 0;
 }
 
-static void mxsmmc_set_ios(struct mmc *mmc)
+static int mxsmmc_set_ios(struct mmc *mmc)
 {
        struct mxsmmc_priv *priv = mmc->priv;
        struct mxs_ssp_regs *ssp_regs = priv->regs;
@@ -331,6 +330,8 @@ static void mxsmmc_set_ios(struct mmc *mmc)
 
        debug("MMC%d: Set %d bits bus width\n",
                mmc->block_dev.devnum, mmc->bus_width);
+
+       return 0;
 }
 
 static int mxsmmc_init(struct mmc *mmc)