Commit 7198f3c9 authored by Adrian Hunter's avatar Adrian Hunter Committed by Linus Torvalds

mmc: fix incorrect interpretation of card type bits

In the extended CSD register the CARD_TYPE is an 8-bit value of which the
upper 6 bits were reserved in JEDEC specifications prior to version 4.4.
In version 4.4 two of the reserved bits were designated for identifying
support for the newly added High-Speed Dual Data Rate.  Unfortunately the
mmc_read_ext_csd() function required that the reserved bits be zero
instead of ignoring them as it should.

This patch makes mmc_read_ext_csd() ignore the CARD_TYPE bits that are
reserved or not yet supported.  It also stops the function jumping to the
end as though an error occurred, when it is only warns that the CARD_TYPE
bits (that it does interpret) are invalid.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3f8b5ee3
...@@ -225,7 +225,7 @@ static int mmc_read_ext_csd(struct mmc_card *card) ...@@ -225,7 +225,7 @@ static int mmc_read_ext_csd(struct mmc_card *card)
mmc_card_set_blockaddr(card); mmc_card_set_blockaddr(card);
} }
switch (ext_csd[EXT_CSD_CARD_TYPE]) { switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) {
case EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: case EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26:
card->ext_csd.hs_max_dtr = 52000000; card->ext_csd.hs_max_dtr = 52000000;
break; break;
...@@ -237,7 +237,6 @@ static int mmc_read_ext_csd(struct mmc_card *card) ...@@ -237,7 +237,6 @@ static int mmc_read_ext_csd(struct mmc_card *card)
printk(KERN_WARNING "%s: card is mmc v4 but doesn't " printk(KERN_WARNING "%s: card is mmc v4 but doesn't "
"support any high-speed modes.\n", "support any high-speed modes.\n",
mmc_hostname(card->host)); mmc_hostname(card->host));
goto out;
} }
if (card->ext_csd.rev >= 3) { if (card->ext_csd.rev >= 3) {
......
...@@ -268,6 +268,7 @@ struct _mmc_csd { ...@@ -268,6 +268,7 @@ struct _mmc_csd {
#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ #define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ #define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
#define EXT_CSD_CARD_TYPE_MASK 0x3 /* Mask out reserved and DDR bits */
#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ #define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ #define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment