[PATCH] mmc: core: use eMMC lifetime info to warn user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that the new lifetime parameters are available in struct mmc_ext_csd
we can use this information to warn the user if card is close to or
beyond end of its lifetime.

Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>
---
 drivers/mmc/core/bus.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 30124651..ab20d242 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -345,6 +345,22 @@ int mmc_add_card(struct mmc_card *card)
 			uhs_bus_speed_mode, type, card->rca);
 	}
 
+	if (card->ext_csd.device_life_time_est_typ_a == 0xb ||
+	    card->ext_csd.device_life_time_est_typ_b == 0xb)
+		pr_err("%s: memory has exceeded its life time",
+			mmc_hostname(card->host));
+	else if (card->ext_csd.device_life_time_est_typ_a == 0xa ||
+		 card->ext_csd.device_life_time_est_typ_b == 0xa)
+		pr_warn("%s: memory has used more than 90%% of its life time\n",
+			mmc_hostname(card->host));
+
+	if (card->ext_csd.pre_eol_info == 3)
+		pr_err("%s: out of reserved blocks\n",
+			mmc_hostname(card->host));
+	else if (card->ext_csd.pre_eol_info == 2)
+		pr_warn("%s: more than 80%% of reserved blocks consumed\n",
+			mmc_hostname(card->host));
+
 #ifdef CONFIG_DEBUG_FS
 	mmc_add_card_debugfs(card);
 #endif
-- 
2.11.1

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux