Skip to content

Commit

Permalink
mmc: Ensure linux starts in eMMC user partition
Browse files Browse the repository at this point in the history
uBoot sometimes leaves eMMC pointing to the private boot partition.
Ensure we always start looking at the user partition.

Signed-off-by: Philip Rakity <[email protected]>
Signed-off-by: Bruce Clemens <[email protected]>
Signed-off-by: Mark F. Brown <[email protected]>
Signed-off-by: Chris Ball <[email protected]>
  • Loading branch information
Philip Rakity authored and cjb committed May 25, 2011
1 parent 7c21738 commit 41e2a48
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/mmc/core/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ static int mmc_read_ext_csd(struct mmc_card *card)

if (card->ext_csd.rev >= 3) {
u8 sa_shift = ext_csd[EXT_CSD_S_A_TIMEOUT];
card->ext_csd.bootconfig = ext_csd[EXT_CSD_BOOT_CONFIG];

/* Sleep / awake timeout in 100ns units */
if (sa_shift > 0 && sa_shift <= 0x17)
Expand Down Expand Up @@ -567,6 +568,15 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
}
}

/*
* Ensure eMMC user default partition is enabled
*/
if (card->ext_csd.bootconfig & 0x7) {
card->ext_csd.bootconfig &= ~0x7;
mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_CONFIG,
card->ext_csd.bootconfig);
}

/*
* Activate high speed (if supported)
*/
Expand Down
1 change: 1 addition & 0 deletions include/linux/mmc/card.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct mmc_ext_csd {
u8 rev;
u8 erase_group_def;
u8 sec_feature_support;
u8 bootconfig;
unsigned int sa_timeout; /* Units: 100ns */
unsigned int hs_max_dtr;
unsigned int sectors;
Expand Down
1 change: 1 addition & 0 deletions include/linux/mmc/mmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ struct _mmc_csd {
#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
#define EXT_CSD_BOOT_CONFIG 179 /* R/W */
#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
#define EXT_CSD_BUS_WIDTH 183 /* R/W */
#define EXT_CSD_HS_TIMING 185 /* R/W */
Expand Down

0 comments on commit 41e2a48

Please sign in to comment.