summaryrefslogtreecommitdiff
path: root/cpu/at32ap/atmel_mci.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2007-06-29 18:22:34 +0200
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2007-12-17 10:34:11 +0100
commit4d5fa99c73f354e7cf985efcf417ea55ca2f6a5e (patch)
tree4d415166e53630dbac807b24d24f37c3b1ccc6c9 /cpu/at32ap/atmel_mci.c
parent41be969f4957115ed7b1fe8b890bfaee99d7a7a2 (diff)
downloadu-boot-imx-4d5fa99c73f354e7cf985efcf417ea55ca2f6a5e.zip
u-boot-imx-4d5fa99c73f354e7cf985efcf417ea55ca2f6a5e.tar.gz
u-boot-imx-4d5fa99c73f354e7cf985efcf417ea55ca2f6a5e.tar.bz2
atmel_mci: Show SR when block read fails
Show controller status as well as card status when an error occurs during block read. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'cpu/at32ap/atmel_mci.c')
-rw-r--r--cpu/at32ap/atmel_mci.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/cpu/at32ap/atmel_mci.c b/cpu/at32ap/atmel_mci.c
index cf48be1..f59dfb5 100644
--- a/cpu/at32ap/atmel_mci.c
+++ b/cpu/at32ap/atmel_mci.c
@@ -198,11 +198,11 @@ mmc_bread(int dev, unsigned long start, lbaint_t blkcnt,
/* Put the device into Transfer state */
ret = mmc_cmd(MMC_CMD_SELECT_CARD, mmc_rca << 16, resp, R1 | NCR);
- if (ret) goto fail;
+ if (ret) goto out;
/* Set block length */
ret = mmc_cmd(MMC_CMD_SET_BLOCKLEN, mmc_blkdev.blksz, resp, R1 | NCR);
- if (ret) goto fail;
+ if (ret) goto out;
pr_debug("MCI_DTOR = %08lx\n", mmci_readl(DTOR));
@@ -211,7 +211,7 @@ mmc_bread(int dev, unsigned long start, lbaint_t blkcnt,
start * mmc_blkdev.blksz, resp,
(R1 | NCR | TRCMD_START | TRDIR_READ
| TRTYP_BLOCK));
- if (ret) goto fail;
+ if (ret) goto out;
ret = -EIO;
wordcount = 0;
@@ -219,7 +219,7 @@ mmc_bread(int dev, unsigned long start, lbaint_t blkcnt,
do {
status = mmci_readl(SR);
if (status & (ERROR_FLAGS | MMCI_BIT(OVRE)))
- goto fail;
+ goto read_error;
} while (!(status & MMCI_BIT(RXRDY)));
if (status & MMCI_BIT(RXRDY)) {
@@ -244,9 +244,10 @@ out:
mmc_cmd(MMC_CMD_SELECT_CARD, 0, resp, NCR);
return i;
-fail:
+read_error:
mmc_cmd(MMC_CMD_SEND_STATUS, mmc_rca << 16, &card_status, R1 | NCR);
- printf("mmc: bread failed, card status = %08x\n", card_status);
+ printf("mmc: bread failed, status = %08x, card status = %08x\n",
+ status, card_status);
goto out;
}