[PATCH 4/9] mci: core: add manufacturing date extraction function
Stefan Kerkmann
s.kerkmann at pengutronix.de
Tue May 28 08:39:23 PDT 2024
This function operates on a string buffer and concatenates both the year
and month. It will be used later when the mdt is added as a parameter.
Signed-off-by: Stefan Kerkmann <s.kerkmann at pengutronix.de>
---
drivers/mci/mci-core.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index df72445edd..48eee35f2c 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -2030,6 +2030,20 @@ static unsigned extract_mdt_year(struct mci *mci)
return year;
}
+/**
+ * Extract the manufacturing date from the CID
+ * @param mci Instance data
+ *
+ * The 'MDT' is encoded in bit 19:8 in the CID
+ */
+static void extract_mdt(struct mci *mci, char mdt[static 8])
+{
+ unsigned month = extract_mdt_month(mci);
+ unsigned year = extract_mdt_year(mci);
+
+ snprintf(mdt, 8, "%u.%u", year, month);
+}
+
static const char *mci_timing_tostr(unsigned timing)
{
switch (timing) {
--
2.39.2
More information about the barebox
mailing list