Skip to content

Commit

Permalink
bcm2835-sdhost: Don't exit cmd wait loop on error
Browse files Browse the repository at this point in the history
The FAIL flag can be set in the CMD register before command processing
is complete, leading to spurious "failed to complete" errors. This has
the effect of promoting harmless CRC7 errors during CMD1 processing
into errors that can delay and even prevent booting.

Also:
1) Convert the last KERN_ERROR message in the register dumping to
   KERN_INFO.
2) Remove an unnecessary reset call from  bcm2835_sdhost_add_host.

See: #1492

Signed-off-by: Phil Elwell <[email protected]>
  • Loading branch information
Phil Elwell authored and popcornmix committed Sep 5, 2016
1 parent 6e32787 commit bf8a6ca
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/mmc/host/bcm2835-sdhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host)
pr_info("%s: SDRSP2 0x%08x\n",
mmc_hostname(host->mmc),
bcm2835_sdhost_read(host, SDRSP2));
pr_err("%s: SDRSP3 0x%08x\n",
pr_info("%s: SDRSP3 0x%08x\n",
mmc_hostname(host->mmc),
bcm2835_sdhost_read(host, SDRSP3));
pr_info("%s: SDHSTS 0x%08x\n",
Expand Down Expand Up @@ -1183,9 +1183,8 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host,
retries = 1; // We've already waited long enough this time
}

retries = host->cmd_quick_poll_retries;
for (sdcmd = bcm2835_sdhost_read(host, SDCMD);
(sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries;
(sdcmd & SDCMD_NEW_FLAG) && retries;
retries--) {
cpu_relax();
sdcmd = bcm2835_sdhost_read(host, SDCMD);
Expand All @@ -1208,8 +1207,7 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host,
usleep_range(1, 10);
spin_lock_irqsave(&host->lock, *irq_flags);
sdcmd = bcm2835_sdhost_read(host, SDCMD);
if (!(sdcmd & SDCMD_NEW_FLAG) ||
(sdcmd & SDCMD_FAIL_FLAG))
if (!(sdcmd & SDCMD_NEW_FLAG))
break;
}
}
Expand Down Expand Up @@ -1892,8 +1890,6 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host)

mmc = host->mmc;

bcm2835_sdhost_reset_internal(host);

mmc->f_max = host->max_clk;
mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV;

Expand Down

0 comments on commit bf8a6ca

Please sign in to comment.