mmc: Keep track of current hard partition
eMMC may have several hard partitions such as BOOT and RPMB in addition
to the main USER partition. On resume(if card is reinitialized), the
current hard partition is always switched to the default USER partition.
But this switch to default partition is not propagated to the MMC block
driver, which may have set the hard partition to any partition(BOOT/RPMB)
other than USER before suspend. After resume, the MMC block driver still
assumes it is accessing the previously set partition(BOOT/RPMB), and
instead overwrites the USER partition(the current selected partition on
the eMMC device). To prevent this, make MMC block driver aware of the
partition switches done as part of card reinitialization.
CRs-Fixed: 439313
Change-Id: I3e959101a1c56c1e6631da3d660f4b914e100503
Signed-off-by: Oluwafemi Adeyemi <aadeyemi@codeaurora.org>
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
[subhashj@codeaurora.org: fixed trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[xiaonian@codeaurora.org: fixed trivial merge conflicts]
Signed-off-by: Xiaonian Wang <xiaonian@codeaurora.org>
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 1a9349a..f9fa2e6 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1265,7 +1265,8 @@
int ret;
struct mmc_blk_data *main_md = dev_get_drvdata(&card->dev);
- if (main_md->part_curr == md->part_type)
+ if ((main_md->part_curr == md->part_type) &&
+ (card->part_curr == md->part_type))
return 0;
if (mmc_card_mmc(card)) {
@@ -1287,6 +1288,7 @@
}
card->ext_csd.part_config = part_config;
+ card->part_curr = md->part_type;
if (main_md->part_curr == EXT_CSD_PART_CONFIG_ACC_RPMB)
mmc_retune_unpause(card->host);