OSDN Git Service

Merge android-4.4.191 (6da3fbc) into msm-4.4
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / mmc / core / sd.c
index 9a7f9d2..f24c6ad 100644 (file)
@@ -224,6 +224,14 @@ static int mmc_decode_scr(struct mmc_card *card)
 
        if (scr->sda_spec3)
                scr->cmds = UNSTUFF_BITS(resp, 32, 2);
+
+       /* SD Spec says: any SD Card shall set at least bits 0 and 2 */
+       if (!(scr->bus_widths & SD_SCR_BUS_WIDTH_1) ||
+           !(scr->bus_widths & SD_SCR_BUS_WIDTH_4)) {
+               pr_err("%s: invalid bus width\n", mmc_hostname(card->host));
+               return -EINVAL;
+       }
+
        return 0;
 }
 
@@ -1483,6 +1491,12 @@ int mmc_attach_sd(struct mmc_host *host)
                        goto err;
        }
 
+       /*
+        * Some SD cards claims an out of spec VDD voltage range. Let's treat
+        * these bits as being in-valid and especially also bit7.
+        */
+       ocr &= ~0x7FFF;
+
        rocr = mmc_select_voltage(host, ocr);
 
        /*