Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208422
b: refs/heads/master
c: 6da24b7
h: refs/heads/master
v: v3
  • Loading branch information
Kyungmin Park authored and Linus Torvalds committed Aug 11, 2010
1 parent a4c99ff commit 3cb673f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a892e2d7dcdfa6c76e60c50a8c7385c65587a2a6
refs/heads/master: 6da24b786ed1963a7f872c1899627968c76d17d7
26 changes: 19 additions & 7 deletions trunk/drivers/mmc/core/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,18 @@ static int mmc_decode_cid(struct mmc_card *card)
static int mmc_decode_csd(struct mmc_card *card)
{
struct mmc_csd *csd = &card->csd;
unsigned int e, m, csd_struct;
unsigned int e, m;
u32 *resp = card->raw_csd;

/*
* We only understand CSD structure v1.1 and v1.2.
* v1.2 has extra information in bits 15, 11 and 10.
* We also support eMMC v4.4 & v4.41.
*/
csd_struct = UNSTUFF_BITS(resp, 126, 2);
if (csd_struct != 1 && csd_struct != 2) {
csd->structure = UNSTUFF_BITS(resp, 126, 2);
if (csd->structure == 0) {
printk(KERN_ERR "%s: unrecognised CSD structure version %d\n",
mmc_hostname(card->host), csd_struct);
mmc_hostname(card->host), csd->structure);
return -EINVAL;
}

Expand Down Expand Up @@ -207,11 +208,22 @@ static int mmc_read_ext_csd(struct mmc_card *card)
goto out;
}

/* Version is coded in the CSD_STRUCTURE byte in the EXT_CSD register */
if (card->csd.structure == 3) {
int ext_csd_struct = ext_csd[EXT_CSD_STRUCTURE];
if (ext_csd_struct > 2) {
printk(KERN_ERR "%s: unrecognised EXT_CSD structure "
"version %d\n", mmc_hostname(card->host),
ext_csd_struct);
err = -EINVAL;
goto out;
}
}

card->ext_csd.rev = ext_csd[EXT_CSD_REV];
if (card->ext_csd.rev > 5) {
printk(KERN_ERR "%s: unrecognised EXT_CSD structure "
"version %d\n", mmc_hostname(card->host),
card->ext_csd.rev);
printk(KERN_ERR "%s: unrecognised EXT_CSD revision %d\n",
mmc_hostname(card->host), card->ext_csd.rev);
err = -EINVAL;
goto out;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mmc/card.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct mmc_cid {
};

struct mmc_csd {
unsigned char structure;
unsigned char mmca_vsn;
unsigned short cmdclass;
unsigned short tacc_clks;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mmc/mmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ struct _mmc_csd {
#define EXT_CSD_BUS_WIDTH 183 /* R/W */
#define EXT_CSD_HS_TIMING 185 /* R/W */
#define EXT_CSD_CARD_TYPE 196 /* RO */
#define EXT_CSD_STRUCTURE 194 /* RO */
#define EXT_CSD_REV 192 /* RO */
#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
#define EXT_CSD_S_A_TIMEOUT 217
Expand Down

0 comments on commit 3cb673f

Please sign in to comment.