mmc: Ensure linux starts in eMMC user partition
authorPhilip Rakity <prakity@marvell.com>
Sat, 19 Mar 2011 18:10:33 +0000 (14:10 -0400)
committerChris Ball <cjb@laptop.org>
Wed, 25 May 2011 00:59:13 +0000 (20:59 -0400)
uBoot sometimes leaves eMMC pointing to the private boot partition.
Ensure we always start looking at the user partition.

Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Bruce Clemens <bpclemens@marvell.com>
Signed-off-by: Mark F. Brown <markb@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/mmc.c
include/linux/mmc/card.h
include/linux/mmc/mmc.h

index 772d0d0a541b6f9bbfc5208cba135e03ea38b57f..5c611a6e0080fce2b93c4be1d67764aa2cdb9301 100644 (file)
@@ -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)
@@ -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)
         */
index adb4888248be9a06219f71f39dceb06c60edd15d..557b73263390fc5fb0602aba85a86995659627e3 100644 (file)
@@ -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;
index 264ba5451e3b98449832d94693d167792cec1f7b..b5ec88fd1352d921e21e465e7cab370d2013c059 100644 (file)
@@ -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 */