X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fmmc%2Fmxsmmc.c;h=089602840333758e8a6c058788ff8312ab3c7c28;hb=895549a2d994ecf1ca1636792e55019e56be2d7d;hp=2fa4eeef441f16b552e0742571dd6c625cf85cd5;hpb=93bfd6167713a5cc1a78bcf60fa63f990fd3f4b3;p=u-boot diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c index 2fa4eeef44..0896028403 100644 --- a/drivers/mmc/mxsmmc.c +++ b/drivers/mmc/mxsmmc.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -84,7 +84,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 +120,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); @@ -142,7 +142,7 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) uint32_t ctrl0; int ret; - debug("MMC%d: CMD%d\n", mmc->block_dev.dev, cmd->cmdidx); + debug("MMC%d: CMD%d\n", mmc->block_dev.devnum, cmd->cmdidx); /* Check bus busy */ timeout = MXSMMC_MAX_TIMEOUT; @@ -157,14 +157,14 @@ 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.dev); - return TIMEOUT; + printf("MMC%d: Bus busy timeout!\n", mmc->block_dev.devnum); + return -ETIMEDOUT; } /* See if card is present */ if (!mxsmmc_cd(priv)) { - printf("MMC%d: No card detected!\n", mmc->block_dev.dev); - return NO_CARD_ERR; + printf("MMC%d: No card detected!\n", mmc->block_dev.devnum); + return -ENOMEDIUM; } /* Start building CTRL0 contents */ @@ -200,10 +200,10 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) if (data->flags & MMC_DATA_READ) { ctrl0 |= SSP_CTRL0_READ; } else if (priv->mmc_is_wp && - priv->mmc_is_wp(mmc->block_dev.dev)) { + priv->mmc_is_wp(mmc->block_dev.devnum)) { printf("MMC%d: Can not write a locked card!\n", - mmc->block_dev.dev); - return UNUSABLE_ERR; + mmc->block_dev.devnum); + return -EOPNOTSUPP; } ctrl0 |= SSP_CTRL0_DATA_XFER; @@ -243,22 +243,22 @@ 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.dev, cmd->cmdidx); - return TIMEOUT; + mmc->block_dev.devnum, cmd->cmdidx); + return -ETIMEDOUT; } /* Check command timeout */ if (reg & SSP_STATUS_RESP_TIMEOUT) { printf("MMC%d: Command %d timeout (status 0x%08x)\n", - mmc->block_dev.dev, cmd->cmdidx, reg); - return TIMEOUT; + mmc->block_dev.devnum, cmd->cmdidx, reg); + 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.dev, cmd->cmdidx, reg); - return COMM_ERR; + mmc->block_dev.devnum, cmd->cmdidx, reg); + return -ECOMM; } /* Copy response to response buffer */ @@ -279,14 +279,14 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) if (ret) { printf("MMC%d: Data timeout with command %d " "(status 0x%08x)!\n", - mmc->block_dev.dev, cmd->cmdidx, reg); + mmc->block_dev.devnum, cmd->cmdidx, reg); return ret; } } else { ret = mxsmmc_send_cmd_dma(priv, data); if (ret) { printf("MMC%d: DMA transfer failed\n", - mmc->block_dev.dev); + mmc->block_dev.devnum); return ret; } } @@ -297,8 +297,8 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) (SSP_STATUS_TIMEOUT | SSP_STATUS_DATA_CRC_ERR | SSP_STATUS_FIFO_OVRFLW | SSP_STATUS_FIFO_UNDRFLW)) { printf("MMC%d: Data error with command %d (status 0x%08x)!\n", - mmc->block_dev.dev, cmd->cmdidx, reg); - return COMM_ERR; + mmc->block_dev.devnum, cmd->cmdidx, reg); + return -ECOMM; } return 0; @@ -330,7 +330,7 @@ static void mxsmmc_set_ios(struct mmc *mmc) SSP_CTRL0_BUS_WIDTH_MASK, priv->buswidth); debug("MMC%d: Set %d bits bus width\n", - mmc->block_dev.dev, mmc->bus_width); + mmc->block_dev.devnum, mmc->bus_width); } static int mxsmmc_init(struct mmc *mmc) @@ -405,8 +405,7 @@ int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int), int (*cd)(int)) priv->cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34; priv->cfg.host_caps = MMC_MODE_4BIT | MMC_MODE_8BIT | - MMC_MODE_HS_52MHz | MMC_MODE_HS | - MMC_MODE_HC; + MMC_MODE_HS_52MHz | MMC_MODE_HS; /* * SSPCLK = 480 * 18 / 29 / 1 = 297.731 MHz