Skip to content

Commit 7a830fb

Browse files
Phil Elwellpopcornmix
Phil Elwell
authored andcommitted
bcm2835-sdhost: Don't exit cmd wait loop on error
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]>
1 parent 32bd6a5 commit 7a830fb

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

drivers/mmc/host/bcm2835-sdhost.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host)
373373
pr_info("%s: SDRSP2 0x%08x\n",
374374
mmc_hostname(host->mmc),
375375
bcm2835_sdhost_read(host, SDRSP2));
376-
pr_err("%s: SDRSP3 0x%08x\n",
376+
pr_info("%s: SDRSP3 0x%08x\n",
377377
mmc_hostname(host->mmc),
378378
bcm2835_sdhost_read(host, SDRSP3));
379379
pr_info("%s: SDHSTS 0x%08x\n",
@@ -1183,9 +1183,8 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host,
11831183
retries = 1; // We've already waited long enough this time
11841184
}
11851185

1186-
retries = host->cmd_quick_poll_retries;
11871186
for (sdcmd = bcm2835_sdhost_read(host, SDCMD);
1188-
(sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries;
1187+
(sdcmd & SDCMD_NEW_FLAG) && retries;
11891188
retries--) {
11901189
cpu_relax();
11911190
sdcmd = bcm2835_sdhost_read(host, SDCMD);
@@ -1208,8 +1207,7 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host,
12081207
usleep_range(1, 10);
12091208
spin_lock_irqsave(&host->lock, *irq_flags);
12101209
sdcmd = bcm2835_sdhost_read(host, SDCMD);
1211-
if (!(sdcmd & SDCMD_NEW_FLAG) ||
1212-
(sdcmd & SDCMD_FAIL_FLAG))
1210+
if (!(sdcmd & SDCMD_NEW_FLAG))
12131211
break;
12141212
}
12151213
}
@@ -1892,8 +1890,6 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host)
18921890

18931891
mmc = host->mmc;
18941892

1895-
bcm2835_sdhost_reset_internal(host);
1896-
18971893
mmc->f_max = host->max_clk;
18981894
mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV;
18991895

0 commit comments

Comments
 (0)