brcm2708-gpu-fw: update to latest version
[oweals/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0497-bcm2835-sdhost-Don-t-exit-cmd-wait-loop-on-error.patch
1 From 0ca1a9040cff3ace3d7fce5cdd83f1cbaa8da50c Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Fri, 2 Sep 2016 17:21:42 +0100
4 Subject: [PATCH] bcm2835-sdhost: Don't exit cmd wait loop on error
5
6 The FAIL flag can be set in the CMD register before command processing
7 is complete, leading to spurious "failed to complete" errors. This has
8 the effect of promoting harmless CRC7 errors during CMD1 processing
9 into errors that can delay and even prevent booting.
10
11 Also:
12 1) Convert the last KERN_ERROR message in the register dumping to
13    KERN_INFO.
14 2) Remove an unnecessary reset call from  bcm2835_sdhost_add_host.
15
16 See: https://github.com/raspberrypi/linux/pull/1492
17
18 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
19 ---
20  drivers/mmc/host/bcm2835-sdhost.c | 10 +++-------
21  1 file changed, 3 insertions(+), 7 deletions(-)
22
23 --- a/drivers/mmc/host/bcm2835-sdhost.c
24 +++ b/drivers/mmc/host/bcm2835-sdhost.c
25 @@ -373,7 +373,7 @@ static void bcm2835_sdhost_dumpregs(stru
26         pr_info("%s: SDRSP2 0x%08x\n",
27                 mmc_hostname(host->mmc),
28                 bcm2835_sdhost_read(host, SDRSP2));
29 -       pr_err("%s: SDRSP3 0x%08x\n",
30 +       pr_info("%s: SDRSP3 0x%08x\n",
31                 mmc_hostname(host->mmc),
32                 bcm2835_sdhost_read(host, SDRSP3));
33         pr_info("%s: SDHSTS 0x%08x\n",
34 @@ -1183,9 +1183,8 @@ static void bcm2835_sdhost_finish_comman
35                 retries = 1; // We've already waited long enough this time
36         }
37  
38 -       retries = host->cmd_quick_poll_retries;
39         for (sdcmd = bcm2835_sdhost_read(host, SDCMD);
40 -            (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries;
41 +            (sdcmd & SDCMD_NEW_FLAG) && retries;
42              retries--) {
43                 cpu_relax();
44                 sdcmd = bcm2835_sdhost_read(host, SDCMD);
45 @@ -1208,8 +1207,7 @@ static void bcm2835_sdhost_finish_comman
46                         usleep_range(1, 10);
47                         spin_lock_irqsave(&host->lock, *irq_flags);
48                         sdcmd = bcm2835_sdhost_read(host, SDCMD);
49 -                       if (!(sdcmd & SDCMD_NEW_FLAG) ||
50 -                           (sdcmd & SDCMD_FAIL_FLAG))
51 +                       if (!(sdcmd & SDCMD_NEW_FLAG))
52                                 break;
53                 }
54         }
55 @@ -1892,8 +1890,6 @@ int bcm2835_sdhost_add_host(struct bcm28
56  
57         mmc = host->mmc;
58  
59 -       bcm2835_sdhost_reset_internal(host);
60 -
61         mmc->f_max = host->max_clk;
62         mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV;
63