mmc: core: Export device lifetime information through sysfs
In the eMMC 5.0 version of the spec, several EXT_CSD fields about device lifetime are added. - Two types of estimated indications reflected by averaged wear out of memory - An indication reflected by average reserved blocks Export the information through sysfs. Signed-off-by: Jungseung Lee <js07.lee@samsung.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
@@ -617,6 +617,12 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
|
||||
card->ext_csd.ffu_capable =
|
||||
(ext_csd[EXT_CSD_SUPPORTED_MODE] & 0x1) &&
|
||||
!(ext_csd[EXT_CSD_FW_CONFIG] & 0x1);
|
||||
|
||||
card->ext_csd.pre_eol_info = ext_csd[EXT_CSD_PRE_EOL_INFO];
|
||||
card->ext_csd.device_life_time_est_typ_a =
|
||||
ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A];
|
||||
card->ext_csd.device_life_time_est_typ_b =
|
||||
ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B];
|
||||
}
|
||||
|
||||
/* eMMC v5.1 or later */
|
||||
@@ -764,6 +770,10 @@ MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid);
|
||||
MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name);
|
||||
MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid);
|
||||
MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prv);
|
||||
MMC_DEV_ATTR(pre_eol_info, "%02x\n", card->ext_csd.pre_eol_info);
|
||||
MMC_DEV_ATTR(life_time, "0x%02x 0x%02x\n",
|
||||
card->ext_csd.device_life_time_est_typ_a,
|
||||
card->ext_csd.device_life_time_est_typ_b);
|
||||
MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
|
||||
MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
|
||||
card->ext_csd.enhanced_area_offset);
|
||||
@@ -817,6 +827,8 @@ static struct attribute *mmc_std_attrs[] = {
|
||||
&dev_attr_name.attr,
|
||||
&dev_attr_oemid.attr,
|
||||
&dev_attr_prv.attr,
|
||||
&dev_attr_pre_eol_info.attr,
|
||||
&dev_attr_life_time.attr,
|
||||
&dev_attr_serial.attr,
|
||||
&dev_attr_enhanced_area_offset.attr,
|
||||
&dev_attr_enhanced_area_size.attr,
|
||||
|
Reference in New Issue
Block a user