Merge branch 'master' of git://git.denx.de/u-boot-usb
[oweals/u-boot.git] / drivers / mmc / tegra2_mmc.c
index 3191557c5be62e08304444149ea0983884516abe..fb8a57d162fcb2bf6ced82e1ac035f909a105895 100644 (file)
@@ -162,7 +162,7 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
        struct mmc_host *host = (struct mmc_host *)mmc->priv;
        int flags, i;
        int result;
-       unsigned int mask;
+       unsigned int mask = 0;
        unsigned int retry = 0x100000;
        debug(" mmc_send_cmd called\n");
 
@@ -227,16 +227,19 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
 
        if (i == retry) {
                printf("%s: waiting for status update\n", __func__);
+               writel(mask, &host->reg->norintsts);
                return TIMEOUT;
        }
 
        if (mask & TEGRA_MMC_NORINTSTS_CMD_TIMEOUT) {
                /* Timeout Error */
                debug("timeout: %08x cmd %d\n", mask, cmd->cmdidx);
+               writel(mask, &host->reg->norintsts);
                return TIMEOUT;
        } else if (mask & TEGRA_MMC_NORINTSTS_ERR_INTERRUPT) {
                /* Error Interrupt */
                debug("error: %08x cmd %d\n", mask, cmd->cmdidx);
+               writel(mask, &host->reg->norintsts);
                return -1;
        }
 
@@ -265,6 +268,7 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
 
                        if (i == retry) {
                                printf("%s: card is still busy\n", __func__);
+                               writel(mask, &host->reg->norintsts);
                                return TIMEOUT;
                        }