diff options
author | Andrei Warkentin <andreiw@motorola.com> | 2011-04-11 19:10:25 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-05-24 21:01:21 -0400 |
commit | 371a689f64b0da140c3bcd3f55305ffa1c3a58ef (patch) | |
tree | c0dff82d668378d395cb22ce33cd93e6dafef9eb /drivers/mmc/core/mmc.c | |
parent | 1a258db6f396e26c2c00b19c0107a891895d4584 (diff) |
mmc: MMC boot partitions support.
Allows device MMC boot partitions to be accessed. MMC partitions are
treated effectively as separate block devices on the same MMC card.
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core/mmc.c')
-rw-r--r-- | drivers/mmc/core/mmc.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 396cb23625d..a2c795e8f9d 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -288,7 +288,10 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
288 | 288 | ||
289 | if (card->ext_csd.rev >= 3) { | 289 | if (card->ext_csd.rev >= 3) { |
290 | u8 sa_shift = ext_csd[EXT_CSD_S_A_TIMEOUT]; | 290 | u8 sa_shift = ext_csd[EXT_CSD_S_A_TIMEOUT]; |
291 | card->ext_csd.bootconfig = ext_csd[EXT_CSD_BOOT_CONFIG]; | 291 | card->ext_csd.part_config = ext_csd[EXT_CSD_PART_CONFIG]; |
292 | |||
293 | /* EXT_CSD value is in units of 10ms, but we store in ms */ | ||
294 | card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME]; | ||
292 | 295 | ||
293 | /* Sleep / awake timeout in 100ns units */ | 296 | /* Sleep / awake timeout in 100ns units */ |
294 | if (sa_shift > 0 && sa_shift <= 0x17) | 297 | if (sa_shift > 0 && sa_shift <= 0x17) |
@@ -302,6 +305,12 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
302 | ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] << 10; | 305 | ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] << 10; |
303 | 306 | ||
304 | card->ext_csd.rel_sectors = ext_csd[EXT_CSD_REL_WR_SEC_C]; | 307 | card->ext_csd.rel_sectors = ext_csd[EXT_CSD_REL_WR_SEC_C]; |
308 | |||
309 | /* | ||
310 | * There are two boot regions of equal size, defined in | ||
311 | * multiples of 128K. | ||
312 | */ | ||
313 | card->ext_csd.boot_size = ext_csd[EXT_CSD_BOOT_MULT] << 17; | ||
305 | } | 314 | } |
306 | 315 | ||
307 | if (card->ext_csd.rev >= 4) { | 316 | if (card->ext_csd.rev >= 4) { |
@@ -576,10 +585,13 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
576 | /* | 585 | /* |
577 | * Ensure eMMC user default partition is enabled | 586 | * Ensure eMMC user default partition is enabled |
578 | */ | 587 | */ |
579 | if (card->ext_csd.bootconfig & 0x7) { | 588 | if (card->ext_csd.part_config & EXT_CSD_PART_CONFIG_ACC_MASK) { |
580 | card->ext_csd.bootconfig &= ~0x7; | 589 | card->ext_csd.part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK; |
581 | mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_CONFIG, | 590 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONFIG, |
582 | card->ext_csd.bootconfig, 0); | 591 | card->ext_csd.part_config, |
592 | card->ext_csd.part_time); | ||
593 | if (err && err != -EBADMSG) | ||
594 | goto free_card; | ||
583 | } | 595 | } |
584 | 596 | ||
585 | /* | 597 | /* |