When mmc card initiailize,
if read the wrong revsion value(upper than 0x6), eMMC-init should be failed.
But If we known already eMMC card revision, we can init with
quirk_broken_revision.
(Assume we know exactly eMMC card revision,and use the MMC_FIXUP() for specific 
eMMC card.)

Signed-off-by: Jaehoon Chung <jh80.ch...@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.p...@samsung.com>
---
 drivers/mmc/core/mmc.c   |   13 +++++++++----
 include/linux/mmc/card.h |    1 +
 include/linux/mmc/host.h |    1 +
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 0811fb7..9297bdb 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -293,10 +293,15 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 
*ext_csd)
 
        card->ext_csd.rev = ext_csd[EXT_CSD_REV];
        if (card->ext_csd.rev > 7) {
-               pr_err("%s: unrecognised EXT_CSD revision %d\n",
-                       mmc_hostname(card->host), card->ext_csd.rev);
-               err = -EINVAL;
-               goto out;
+               if ((card->quirks & MMC_QUIRK_BROKEN_REV) &&
+                               card->host->known_rev)
+                       card->ext_csd.rev = card->host->known_rev;
+               else {
+                       pr_err("%s: unrecognised EXT_CSD revision %d\n",
+                               mmc_hostname(card->host), card->ext_csd.rev);
+                       err = -EINVAL;
+                       goto out;
+               }
        }
 
        card->ext_csd.raw_sectors[0] = ext_csd[EXT_CSD_SEC_CNT + 0];
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 111aca5..47241cc 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -240,6 +240,7 @@ struct mmc_card {
 #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8)  /* Avoid sending 512 bytes in */
 #define MMC_QUIRK_LONG_READ_TIME (1<<9)                /* Data read time > CSD 
says */
                                                /* byte mode */
+#define MMC_QUIRK_BROKEN_REV   (1<<10)         /* If broken card revision, set 
to known revision */
        unsigned int    poweroff_notify_state;  /* eMMC4.5 notify feature */
 #define MMC_NO_POWER_NOTIFICATION      0
 #define MMC_POWERED_ON                 1
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index f578a71..4506bfa 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -192,6 +192,7 @@ struct mmc_host {
        u32                     max_current_330;
        u32                     max_current_300;
        u32                     max_current_180;
+       u8                      known_rev;      /* Set to known revision */
 
 #define MMC_VDD_165_195                0x00000080      /* VDD voltage 1.65 - 
1.95 */
 #define MMC_VDD_20_21          0x00000100      /* VDD voltage 2.0 ~ 2.1 */
-- 
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to