public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: linux-mmc@vger.kernel.org,  Avri Altman <avri.altman@wdc.com>,
	 Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH 1/2] mmc-utils: lsmmc.c: print_mmc_cid(): correct year/month parsing
Date: Wed, 05 Nov 2025 07:56:43 +0100	[thread overview]
Message-ID: <87v7jp6k7o.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <af77b269-a9e3-470b-a6bf-81636235bf5e@rock-chips.com> (Shawn Lin's message of "Wed, 5 Nov 2025 10:04:12 +0800")

>>>>> "Shawn" == Shawn Lin <shawn.lin@rock-chips.com> writes:

 > 在 2025/11/05 星期三 4:00, Peter Korsgaard 写道:
 >> The parsing logic for the MMC manufacturing date had the year and month
 >> swapped.  From JESD84:
 >> The manufacturing date, MDT, is composed of two hexadecimal digits,
 >> four
 >> bits each, representing a two digits date code m/y; The “m” field, most
 >> significant nibble, is the month code.  1 = January.  The “y” field, least
 >> significant nibble, is the year code.
 >> Notice that this is the opposite of the SD bit ordering.
 >> 

 > That's ture.

 > Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

 > Another problem I noticed when reading the code is:

 >  628                 printf("\tMDT: 0x%01x%01x %u %s\n", mdt_month,
 >  mdt_year,
 >  629                        1997 + mdt_year, months[mdt_month]);
 >  630                 printf("\tCRC: 0x%02x\n", crc);

 > From the JESD84-B51, section 7.2.7,

 > For e•MMC 4.41 and later devices, indicated by a value larger than 4 in
 > EXT_CSD_REV [192], the 4-bit“y” field shall roll over after 2012, so
 > that y=0 shall be used for 2013. See Table 77 for a list of valid y
 > values for specific e•MMC versions.

 > So mdt_year + 1997 seems wrong, too.

Yes, I noticed that as well. The print_mmc_cid() function does not
directly have access to the EXT_CSD_REV register though, so not trivial
to fix - Unless we read it at startup and stick it in the config
structure?

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2025-11-05  6:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 20:00 [PATCH 1/2] mmc-utils: lsmmc.c: print_mmc_cid(): correct year/month parsing Peter Korsgaard
2025-11-04 20:00 ` [PATCH 2/2] mmc-utils: lsmmc.c: print_{mmc,sd}_cid(): correct month names Peter Korsgaard
2025-11-11 17:36   ` Ulf Hansson
2025-11-05  2:04 ` [PATCH 1/2] mmc-utils: lsmmc.c: print_mmc_cid(): correct year/month parsing Shawn Lin
2025-11-05  6:56   ` Peter Korsgaard [this message]
2025-11-05  7:07   ` Peter Korsgaard
2025-11-05  7:23     ` Shawn Lin
2025-11-05 19:57       ` Avri Altman
2025-11-05 20:16         ` Peter Korsgaard
2025-11-07  1:39         ` Shawn Lin
2025-11-11 17:26         ` Ulf Hansson
2025-11-11 17:36 ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v7jp6k7o.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.com \
    --cc=avri.altman@wdc.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox