summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAnish Trivedi <anish@freescale.com>2011-09-08 17:18:01 -0500
committerJustin Waters <justin.waters@timesys.com>2012-09-05 14:57:51 -0400
commitc14e7393f1431ee63c61b290c8f56a6024b9c899 (patch)
tree96950b0680a145960c3b627ef1debedfd49215a2 /drivers
parent3fb6711fa0bd0187bf610196f65c2593f353d922 (diff)
ENGR00156304 eMMC: Need to update partition config after changing boot partition
After enabling boot partition on an eMMC using "mmc bootpart" command, the partition configuration variable that is supposed to track this value on the eMMC is not updated. This leads to stale and possibly inaccurate boot partition number being printed when "mmcinfo" command is used, thereby confusing the user. The fix is to update the part_config variable of mmc struct with the new value that was just written to the eMMC. Also removed condition that restricted boot_bus_width programming (for fastboot) to eMMC with DDR support only. Now, even non-DDR capable eMMCs can be programmed for fastboot (in SDR mode). Signed-off-by: Anish Trivedi <anish@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/mmc.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b5d200f4b5e..e5a0ec906bf 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -766,10 +766,11 @@ int mmc_switch_boot_part(int dev_num, unsigned int part_num)
goto err_rtn;
}
+ /* Leave access to current partition as is */
boot_config = ext_csd[EXT_CSD_PART_CONF] &
EXT_CSD_BOOT_PARTITION_ACCESS_MASK;
- /* Enable access plus boot from that partition and boot_ack bit */
+ /* Enable boot from that partition and boot_ack bit */
boot_config |= (char)(part_num << 3 | 1 << 6);
err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL,
@@ -790,41 +791,41 @@ int mmc_switch_boot_part(int dev_num, unsigned int part_num)
if (boot_config != ext_csd[EXT_CSD_PART_CONF]) {
printf("Warning: Boot partition switch failed!\n");
goto err_rtn;
- }
+ } else
+ mmc->part_config = ext_csd[EXT_CSD_PART_CONF];
- /* Program boot_bus_width field for eMMC 4.4 boot mode */
- if (ext_csd[EXT_CSD_CARD_TYPE] & 0xC) {
- /* Configure according to this card's capabilities */
- if (mmc->card_caps & EMMC_MODE_8BIT_DDR)
- boot_bus_width = EXT_CSD_BOOT_BUS_WIDTH_DDR |
- EXT_CSD_BOOT_BUS_WIDTH_8BIT;
- else if (mmc->card_caps & EMMC_MODE_4BIT_DDR)
- boot_bus_width = EXT_CSD_BOOT_BUS_WIDTH_DDR |
- EXT_CSD_BOOT_BUS_WIDTH_4BIT;
- else if (mmc->card_caps & MMC_MODE_8BIT)
- boot_bus_width = EXT_CSD_BOOT_BUS_WIDTH_8BIT;
- else if (mmc->card_caps & MMC_MODE_4BIT)
- boot_bus_width = EXT_CSD_BOOT_BUS_WIDTH_4BIT;
- else
- boot_bus_width = 0;
+ /* Program boot_bus_width field for eMMC fastboot mode
+ * according to this card's capabilities
+ */
+ if (mmc->card_caps & EMMC_MODE_8BIT_DDR)
+ boot_bus_width = EXT_CSD_BOOT_BUS_WIDTH_DDR |
+ EXT_CSD_BOOT_BUS_WIDTH_8BIT;
+ else if (mmc->card_caps & EMMC_MODE_4BIT_DDR)
+ boot_bus_width = EXT_CSD_BOOT_BUS_WIDTH_DDR |
+ EXT_CSD_BOOT_BUS_WIDTH_4BIT;
+ else if (mmc->card_caps & MMC_MODE_8BIT)
+ boot_bus_width = EXT_CSD_BOOT_BUS_WIDTH_8BIT;
+ else if (mmc->card_caps & MMC_MODE_4BIT)
+ boot_bus_width = EXT_CSD_BOOT_BUS_WIDTH_4BIT;
+ else
+ boot_bus_width = 0;
- err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL,
- EXT_CSD_BOOT_BUS_WIDTH, boot_bus_width);
+ err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL,
+ EXT_CSD_BOOT_BUS_WIDTH, boot_bus_width);
- /* Ensure that it programmed properly */
- err = mmc_send_ext_csd(mmc, ext_csd);
- if (err) {
- printf("Warning: fail to get ext csd for MMC!\n");
- goto err_rtn;
- }
+ /* Ensure that it programmed properly */
+ err = mmc_send_ext_csd(mmc, ext_csd);
+ if (err) {
+ printf("Warning: fail to get ext csd for MMC!\n");
+ goto err_rtn;
+ }
- card_boot_bus_width = ext_csd[EXT_CSD_BOOT_BUS_WIDTH];
- if (card_boot_bus_width != boot_bus_width) {
- printf("Warning: current boot_bus_width, 0x%x, is "
- "not same as requested boot_bus_width 0x%x!\n",
- card_boot_bus_width, boot_bus_width);
- goto err_rtn;
- }
+ card_boot_bus_width = ext_csd[EXT_CSD_BOOT_BUS_WIDTH];
+ if (card_boot_bus_width != boot_bus_width) {
+ printf("Warning: current boot_bus_width, 0x%x, is "
+ "not same as requested boot_bus_width 0x%x!\n",
+ card_boot_bus_width, boot_bus_width);
+ goto err_rtn;
}
return 0;