Merge "ipq806x: Change the minimum write protect region size for Micron eMMC"

This commit is contained in:
Linux Build Service Account 2018-11-13 12:13:01 -08:00 committed by Gerrit - the friendly Code Review server
commit d1673a3783
2 changed files with 11 additions and 0 deletions

View file

@ -1920,6 +1920,9 @@ int mmc_write_protect(struct mmc *mmc, unsigned int start_blk,
}
wp_group_size = (mmc->wp_grp_size + 1) * mmc->erase_grp_size;
if ((MMC_GET_MID(mmc->cid[0]) == MMC_MID_MICRON) &&
(MMC_GET_PNM(mmc->cid[0], mmc->cid[1], mmc->cid[2]) == MMC_PNM_MICRON))
wp_group_size *= 2;
if (!cnt_blk || start_blk % wp_group_size || cnt_blk % wp_group_size) {
printf("Error: Unaligned offset/count. offset/count should be aligned to 0x%x blocks\n", wp_group_size);

View file

@ -14,6 +14,14 @@
#include <linux/compiler.h>
#include <part.h>
#define MMC_GET_MID(CID0) (CID0 >> 24)
#define MMC_GET_PNM(CID0, CID1, CID2) (((long long int)(CID0 & 0xff) << 40) | \
((long long int)CID1 << 8) | \
(CID2 >> 24))
#define MMC_MID_MICRON 0xFE
#define MMC_PNM_MICRON 0x4D4D43333247 // MMC32G
/* SD/MMC version bits; 8 flags, 8 major, 8 minor, 8 change */
#define SD_VERSION_SD (1U << 31)
#define MMC_VERSION_MMC (1U << 30)