mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
mmc: Added erase quirk for eMMC part
eMMC part SDIN8DE1-8G is taking long time for the secure trim. This leads to erase timeout. Manufacturer ID based quirk is added for the specific part to use trim instead of secure trim for block erase. Change-Id: I13d5a9f19edf5daf9c1f4d5c2ec16b4f3b680159 Signed-off-by: Pradeep Das <pkdas@codeaurora.org>
This commit is contained in:
parent
4f02132690
commit
dc6c6754c7
3 changed files with 41 additions and 13 deletions
|
|
@ -1511,6 +1511,10 @@ static int mmc_startup(struct mmc *mmc)
|
|||
#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT)
|
||||
init_part(&mmc->block_dev);
|
||||
#endif
|
||||
/* Add device specific quirks */
|
||||
if (((mmc->cid[0] & MMC_MID_MASK) == MMC_MID_SANDISK) &&
|
||||
(strncmp(mmc->block_dev.product, "SEM08", 5) == 0))
|
||||
mmc->quirks |= MMC_QUIRK_SECURE_TRIM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,25 +140,38 @@ unsigned long mmc_berase(int dev_num, lbaint_t start, lbaint_t blkcnt)
|
|||
|
||||
return blk;
|
||||
} else {
|
||||
err = mmc_erase_t(mmc, start, blkcnt, arg);
|
||||
if ( mmc->quirks & MMC_QUIRK_SECURE_TRIM ) {
|
||||
arg = MMC_TRIM_ARG;
|
||||
err = mmc_erase_t(mmc, start, blkcnt, arg);
|
||||
|
||||
if (err)
|
||||
return -1;
|
||||
if (err)
|
||||
return -1;
|
||||
|
||||
/* Waiting for the ready status */
|
||||
if (mmc_send_status(mmc, timeout))
|
||||
return -1;
|
||||
/* Waiting for the ready status */
|
||||
if (mmc_send_status(mmc, timeout))
|
||||
return -1;
|
||||
} else {
|
||||
err = mmc_erase_t(mmc, start, blkcnt, arg);
|
||||
|
||||
arg = MMC_SECURE_TRIM2_ARG;
|
||||
err = mmc_erase_t(mmc, start, blkcnt, arg);
|
||||
if (err)
|
||||
return -1;
|
||||
|
||||
if (err)
|
||||
return -1;
|
||||
/* Waiting for the ready status */
|
||||
if (mmc_send_status(mmc, timeout))
|
||||
return -1;
|
||||
|
||||
/* Waiting for the ready status */
|
||||
if (mmc_send_status(mmc, timeout)) {
|
||||
return 0;
|
||||
arg = MMC_SECURE_TRIM2_ARG;
|
||||
err = mmc_erase_t(mmc, start, blkcnt, arg);
|
||||
|
||||
if (err)
|
||||
return -1;
|
||||
|
||||
/* Waiting for the ready status */
|
||||
if (mmc_send_status(mmc, timeout)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return blkcnt;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -299,6 +299,16 @@
|
|||
|
||||
/* Driver model support */
|
||||
|
||||
#define MMC_MID_MASK (0xFF << 24)
|
||||
#define MMC_MID_SANDISK (0x45 << 24)
|
||||
|
||||
/*
|
||||
* Quirks
|
||||
*/
|
||||
/* Some of Sandisk eMMC seeing more delay for secure trim,
|
||||
* below quirk will use trim instead secure trim for erase */
|
||||
#define MMC_QUIRK_SECURE_TRIM (1 << 0)
|
||||
|
||||
/**
|
||||
* struct mmc_uclass_priv - Holds information about a device used by the uclass
|
||||
*/
|
||||
|
|
@ -416,6 +426,7 @@ struct mmc {
|
|||
int ddr_mode;
|
||||
uchar sec_feature_support;
|
||||
unsigned int trim_timeout; /* In milliseconds */
|
||||
u32 quirks;
|
||||
};
|
||||
|
||||
struct mmc_hwpart_conf {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue