Skip to contentSkip to conversation

cmd: mmc: Print life time info

PATCH In review Robert Krikke 3 participants 3 messages Nov 2, 2022 – Nov 3, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: mmc: Print life time info

Added life time info:
-EXT_CSD_PRE_EOL_INFO
-EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A
-EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B

---
 cmd/mmc.c     | 6 ++++++
 include/mmc.h | 3 +++
 2 files changed, 9 insertions(+)
cmd/mmc.c +6 -0
index 7bd4cd9e016..b940e320295 100644
@@ -127,6 +127,12 @@ static void print_mmcinfo(struct mmc *mmc)
 			}
 			wp >>= 2;
 		}
+
+		if (mmc->version >= MMC_VERSION_5_0) {
+                	printf("Pre EOL Information: 0x%02X\n", ext_csd[EXT_CSD_PRE_EOL_INFO]);
+			printf("Life Time Estimation A: 0x%02X\n", ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]);
+			printf("Life Time Estimation B: 0x%02X\n", ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]);
+		}
 	}
 }
 
include/mmc.h +3 -0
index f519d869725..d0c3e684595 100644
@@ -242,6 +242,9 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
 #define EXT_CSD_HC_ERASE_GRP_SIZE	224	/* RO */
 #define EXT_CSD_BOOT_MULT		226	/* RO */
 #define EXT_CSD_GENERIC_CMD6_TIME       248     /* RO */
+#define EXT_CSD_PRE_EOL_INFO		267	/* RO */
+#define EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A	268	/* RO */
+#define EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B	269	/* RO */
 #define EXT_CSD_BKOPS_SUPPORT		502	/* RO */
 
 /*
Signature · 1 line
2.38.1
#1 lore raw

Hi,

Review

Quoted 4 lines · Robert Krikke

Added life time info:

(quoted diff) +0 -3
-EXT_CSD_PRE_EOL_INFO
-EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A
-EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B

I'm not sure that it really needs to display this information as mmc info. I hope that mmc info command should be displayed essential information.

Quoted 13 lines
---
 cmd/mmc.c     | 6 ++++++
 include/mmc.h | 3 +++
 2 files changed, 9 insertions(+)
cmd/mmc.c +0 -0
index 7bd4cd9e016..b940e320295 100644

cmd/mmc.c static void print_mmcinfo(struct mmc *mmc) · line 131

Quoted 5 lines
cmd/mmc.c +2 -0
@@ -127,6 +127,12 @@ static void print_mmcinfo(struct mmc *mmc)
 			}
 			wp >>= 2;
 		}
+
+		if (mmc->version >= MMC_VERSION_5_0) {

Move to outside of MMC_VERSION_4_41 if statement.

cmd/mmc.c static void print_mmcinfo(struct mmc *mmc) · line 134

Quoted 3 lines
cmd/mmc.c +3 -0
+                	printf("Pre EOL Information: 0x%02X\n", ext_csd[EXT_CSD_PRE_EOL_INFO]);
+			printf("Life Time Estimation A: 0x%02X\n", ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]);
+			printf("Life Time Estimation B: 0x%02X\n", ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]);

It's not a readable value. If didn't check the eMMC5.0 spec, it's difficult to know what means 0x01, 0x02..etc..

Best Regards,
Jaehoon Chung

Quoted 18 lines
cmd/mmc.c +1 -0
+		}
 	}
 }
 
include/mmc.h +3 -0
index f519d869725..d0c3e684595 100644
@@ -242,6 +242,9 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
 #define EXT_CSD_HC_ERASE_GRP_SIZE	224	/* RO */
 #define EXT_CSD_BOOT_MULT		226	/* RO */
 #define EXT_CSD_GENERIC_CMD6_TIME       248     /* RO */
+#define EXT_CSD_PRE_EOL_INFO		267	/* RO */
+#define EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A	268	/* RO */
+#define EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B	269	/* RO */
 #define EXT_CSD_BKOPS_SUPPORT		502	/* RO */
 
 /*
#2 lore raw

Hello all,

Quoted 41 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Jaehoon Chung
Sent: Wednesday, November 2, 2022 11:49 PM
To: Robert Krikke <[email protected]>; [email protected]
Cc: Robert Krikke <[email protected]>; Harm Berntsen <[email protected]>
Subject: Re: [PATCH] cmd: mmc: Print life time info

Hi,

Review

Quoted 4 lines · Robert Krikke

Added life time info:

(quoted diff) +0 -3
-EXT_CSD_PRE_EOL_INFO
-EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A
-EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B

I'm not sure that it really needs to display this information as mmc info. I hope that mmc info command should be displayed essential information.

Quoted 13 lines
---
 cmd/mmc.c     | 6 ++++++
 include/mmc.h | 3 +++
 2 files changed, 9 insertions(+)
cmd/mmc.c +0 -0
index 7bd4cd9e016..b940e320295 100644

cmd/mmc.c static void print_mmcinfo(struct mmc *mmc) · line 131

Quoted 5 lines
cmd/mmc.c +2 -0
@@ -127,6 +127,12 @@ static void print_mmcinfo(struct mmc *mmc)
 			}
 			wp >>= 2;
 		}
+
+		if (mmc->version >= MMC_VERSION_5_0) {

Move to outside of MMC_VERSION_4_41 if statement.

cmd/mmc.c static void print_mmcinfo(struct mmc *mmc) · line 132

Quoted 1 line
cmd/mmc.c +1 -0
+                	printf("Pre EOL Information: 0x%02X\n",
Quoted 8 lines

ext_csd[EXT_CSD_PRE_EOL_INFO]);

cmd/mmc.c static void print_mmcinfo(struct mmc *mmc) · line 133

Quoted 1 line
cmd/mmc.c +1 -0
+			printf("Life Time Estimation A: 0x%02X\n",

ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]);

cmd/mmc.c static void print_mmcinfo(struct mmc *mmc) · line 134

Quoted 1 line
cmd/mmc.c +1 -0
+			printf("Life Time Estimation B: 0x%02X\n",

ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]);

It's not a readable value. If didn't check the eMMC5.0 spec, it's difficult to know what means 0x01, 0x02..etc..

According to JEDEC spec, this value shows the "used lifetime of the device in <value> x 10%".

PRE_EOL_INFO [267] provides indication about device life time reflected by average reserved blocks, and it can take only values:
- 0x00 [Not Defined]
- 0x01 [Normal Normal]
- 0x02 [Warning: Consumed 80% of reserved block]
- 0x03 [Urgent]
Everything else is Reserved.

I would also have the same comment here as Jaehoon, as from the commit message it is not clear what is the Use Case you're trying to solve?

If it is designed for automation - then the output is a bit cluttered and hard to parse. If it is designed for user readability, then I would rather suggest to convert it to what the field in ExtCSD really
shows: percentage and status accordingly.

A bit more context would be appreciated here, preferably in commit message.

All-in-all, I really doubt that this info is useful in U-Boot. Linux has a full readout of the ExtCSD, where the same value can be obtained. If it is designed to stop the update and report that eMMC is at the end of its life - then it is rather "automation" Use Case, and as I said above - the output is way too cluttered to parse.

Quoted 21 lines

Best Regards,
Jaehoon Chung

Quoted 17 lines
cmd/mmc.c +1 -0
+		}
 	}
 }
 
include/mmc.h +3 -0
index f519d869725..d0c3e684595 100644
@@ -242,6 +242,9 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
 #define EXT_CSD_HC_ERASE_GRP_SIZE	224	/* RO */
 #define EXT_CSD_BOOT_MULT		226	/* RO */
 #define EXT_CSD_GENERIC_CMD6_TIME       248     /* RO */
+#define EXT_CSD_PRE_EOL_INFO		267	/* RO */
+#define EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A	268	/* RO */
+#define EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B	269	/* RO */
 #define EXT_CSD_BKOPS_SUPPORT		502	/* RO */
 
Quoted 1 line

include/mmc.h static inline bool mmc_is_tuning_cmd(uint cmdidx) · line 250

Quoted 1 line
include/mmc.h +0 -0
 /*

Regards,
Andrey