brcm2708: update 4.1 patches
[openwrt.git] / target / linux / brcm2708 / patches-4.1 / 0130-bcm2835-sdhost-Ignore-CRC7-for-MMC-CMD1.patch
1 From 0bb775b407dab3bab972663ef47dde38b0d34c24 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Mon, 20 Jul 2015 17:32:18 +0100
4 Subject: [PATCH 130/171] bcm2835-sdhost: Ignore CRC7 for MMC CMD1
5
6 It seems that the sdhost interface returns CRC7 errors for CMD1,
7 which is the MMC-specific SEND_OP_COND. Returning these errors to
8 the MMC layer causes a downward spiral, but ignoring them seems
9 to be harmless.
10 ---
11  drivers/mmc/host/bcm2835-sdhost.c | 39 +++++++++++++++++++++++----------------
12  1 file changed, 23 insertions(+), 16 deletions(-)
13
14 --- a/drivers/mmc/host/bcm2835-sdhost.c
15 +++ b/drivers/mmc/host/bcm2835-sdhost.c
16 @@ -959,25 +959,32 @@ static void bcm2835_sdhost_finish_comman
17                                 mmc_hostname(host->mmc), sdcmd, sdhsts,
18                                 bcm2835_sdhost_read(host, SDEDM));
19  
20 -               if (sdhsts & SDHSTS_CMD_TIME_OUT) {
21 -                       switch (host->cmd->opcode) {
22 -                       case 5: case 52: case 53:
23 -                               /* Don't warn about SDIO commands */
24 -                               break;
25 -                       default:
26 -                               pr_err("%s: command timeout\n",
27 +               if ((sdhsts & SDHSTS_CRC7_ERROR) &&
28 +                   (host->cmd->opcode == 1)) {
29 +                       if (host->debug)
30 +                               pr_info("%s: ignoring CRC7 error for CMD1\n",
31 +                                       mmc_hostname(host->mmc));
32 +               } else {
33 +                       if (sdhsts & SDHSTS_CMD_TIME_OUT) {
34 +                               switch (host->cmd->opcode) {
35 +                               case 5: case 52: case 53:
36 +                                       /* Don't warn about SDIO commands */
37 +                                       break;
38 +                               default:
39 +                                       pr_err("%s: command timeout\n",
40 +                                              mmc_hostname(host->mmc));
41 +                                       break;
42 +                               }
43 +                               host->cmd->error = -ETIMEDOUT;
44 +                       } else {
45 +                               pr_err("%s: unexpected command error\n",
46                                        mmc_hostname(host->mmc));
47 -                               break;
48 +                               bcm2835_sdhost_dumpregs(host);
49 +                               host->cmd->error = -EIO;
50                         }
51 -                       host->cmd->error = -ETIMEDOUT;
52 -               } else {
53 -                       pr_err("%s: unexpected command error\n",
54 -                              mmc_hostname(host->mmc));
55 -                       bcm2835_sdhost_dumpregs(host);
56 -                       host->cmd->error = -EIO;
57 +                       tasklet_schedule(&host->finish_tasklet);
58 +                       return;
59                 }
60 -               tasklet_schedule(&host->finish_tasklet);
61 -               return;
62         }
63  
64         if (host->cmd->flags & MMC_RSP_PRESENT) {