summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2012-04-16 21:47:17 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-04-17 22:02:54 +0200
commite38469d2ce755af449c058ea43cf83fe4de5983e (patch)
tree5d5d0e5193c2b34b0335e0e90b2e643d9d84b6d1 /drivers
parentb1109600d403ee05060ab2c8294b7a9aba34d266 (diff)
downloadbarebox-e38469d2ce755af449c058ea43cf83fe4de5983e.tar.gz
barebox-e38469d2ce755af449c058ea43cf83fe4de5983e.tar.xz
mci: pxamci fix R1b responses
The pxamci driver was not waiting for the BUSY line to be deasserted. This was specifically breaking the CMD12 at the end of block multiple writes, when the SD card had not time enough to commit the last write. Fix it by waiting for PRG_DONE bit (which is actually the busy signal end condition). Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mci/pxamci.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mci/pxamci.c b/drivers/mci/pxamci.c
index c51fb771a0..9665196c7c 100644
--- a/drivers/mci/pxamci.c
+++ b/drivers/mci/pxamci.c
@@ -239,13 +239,17 @@ static int pxamci_cmd_response(struct pxamci_host *host, struct mci_cmd *cmd)
static int pxamci_mmccmd(struct pxamci_host *host, struct mci_cmd *cmd,
struct mci_data *data, unsigned int cmddat)
{
- int ret = 0;
+ int ret = 0, stat_mask;
uint64_t start;
pxamci_start_cmd(host, cmd, cmddat);
+
+ stat_mask = STAT_END_CMD_RES;
+ if (cmd->resp_type & MMC_RSP_BUSY)
+ stat_mask |= STAT_PRG_DONE;
for (start = get_time_ns(), ret = -ETIMEDOUT;
ret && !is_timeout(start, CMD_TIMEOUT);)
- if (mmc_readl(MMC_STAT) & STAT_END_CMD_RES)
+ if ((mmc_readl(MMC_STAT) & stat_mask) == stat_mask)
ret = 0;
if (!ret && data)