* MCI print revision @ 2016-05-30 9:01 Alexander Shiyan 2016-05-31 6:26 ` Sascha Hauer 0 siblings, 1 reply; 8+ messages in thread From: Alexander Shiyan @ 2016-05-30 9:01 UTC (permalink / raw) To: barebox Hello. Commit dbd7190295298acfb4996ec1aba5165a7be28fdc (mci: Print versions with micro levels correctly) seems to be incorrect. barebox@Informer:/ mmc0.probe=1 mmc0: detected SD card version 1.a mmc0: registered mmc0 Thanks. --- _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: MCI print revision 2016-05-30 9:01 MCI print revision Alexander Shiyan @ 2016-05-31 6:26 ` Sascha Hauer 2016-05-31 7:02 ` Re[2]: " Alexander Shiyan 0 siblings, 1 reply; 8+ messages in thread From: Sascha Hauer @ 2016-05-31 6:26 UTC (permalink / raw) To: Alexander Shiyan; +Cc: barebox, Trent Piepho +Cc Trent On Mon, May 30, 2016 at 12:01:12PM +0300, Alexander Shiyan wrote: > Hello. > > Commit dbd7190295298acfb4996ec1aba5165a7be28fdc (mci: Print versions with micro levels correctly) > seems to be incorrect. > > barebox@Informer:/ mmc0.probe=1 > mmc0: detected SD card version 1.a > mmc0: registered mmc0 So what's the expected printout and was it correct without this patch? Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re[2]: MCI print revision 2016-05-31 6:26 ` Sascha Hauer @ 2016-05-31 7:02 ` Alexander Shiyan 2016-05-31 7:23 ` Sascha Hauer 0 siblings, 1 reply; 8+ messages in thread From: Alexander Shiyan @ 2016-05-31 7:02 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox, Trent Piepho > Вторник, 31 мая 2016, 9:26 +03:00 от Sascha Hauer <s.hauer@pengutronix.de>: > > +Cc Trent > > On Mon, May 30, 2016 at 12:01:12PM +0300, Alexander Shiyan wrote: > > Hello. > > > > Commit dbd7190295298acfb4996ec1aba5165a7be28fdc (mci: Print versions with micro levels correctly) > > seems to be incorrect. > > > > barebox@Informer:/ mmc0.probe=1 > > mmc0: detected SD card version 1.a > > mmc0: registered mmc0 > > So what's the expected printout and was it correct without this patch? Host information: current clock: 25000000 current buswidth: 4 capabilities: 4bit sd-hs mmc-hs Card information: Attached is an SD Card (Version: 1.10) Capacity: 1962 MiB CID: 1C535653-44432020-1000013C-7E007200 CSD: 005E0032-5F5A83D5-2DB7FFBF-96800000 Max. transfer speed: 25000000 Hz capabilities: 4bit sd-hs Manufacturer ID: 1C OEM/Application ID: 5356 Product name: 'SDC ' Product revision: 1.0 Serial no: 3086991254 Manufacturing date: 2.2007 ... So, expected 1.1 --- _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: MCI print revision 2016-05-31 7:02 ` Re[2]: " Alexander Shiyan @ 2016-05-31 7:23 ` Sascha Hauer 2016-05-31 7:33 ` Re[2]: " Alexander Shiyan 2016-05-31 19:56 ` Trent Piepho 0 siblings, 2 replies; 8+ messages in thread From: Sascha Hauer @ 2016-05-31 7:23 UTC (permalink / raw) To: Alexander Shiyan; +Cc: barebox, Trent Piepho On Tue, May 31, 2016 at 10:02:48AM +0300, Alexander Shiyan wrote: > > Вторник, 31 мая 2016, 9:26 +03:00 от Sascha Hauer <s.hauer@pengutronix.de>: > > > > +Cc Trent > > > > On Mon, May 30, 2016 at 12:01:12PM +0300, Alexander Shiyan wrote: > > > Hello. > > > > > > Commit dbd7190295298acfb4996ec1aba5165a7be28fdc (mci: Print versions with micro levels correctly) > > > seems to be incorrect. > > > > > > barebox@Informer:/ mmc0.probe=1 > > > mmc0: detected SD card version 1.a > > > mmc0: registered mmc0 > > > > So what's the expected printout and was it correct without this patch? > > Host information: > current clock: 25000000 > current buswidth: 4 > capabilities: 4bit sd-hs mmc-hs > Card information: > Attached is an SD Card (Version: 1.10) So the %x for printing the minor should really be a %u? Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re[2]: MCI print revision 2016-05-31 7:23 ` Sascha Hauer @ 2016-05-31 7:33 ` Alexander Shiyan 2016-05-31 19:56 ` Trent Piepho 1 sibling, 0 replies; 8+ messages in thread From: Alexander Shiyan @ 2016-05-31 7:33 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox, Trent Piepho > Вторник, 31 мая 2016, 10:23 +03:00 от Sascha Hauer <s.hauer@pengutronix.de>: > > On Tue, May 31, 2016 at 10:02:48AM +0300, Alexander Shiyan wrote: > > > Вторник, 31 мая 2016, 9:26 +03:00 от Sascha Hauer <s.hauer@pengutronix.de>: > > > > > > +Cc Trent > > > > > > On Mon, May 30, 2016 at 12:01:12PM +0300, Alexander Shiyan wrote: > > > > Hello. > > > > > > > > Commit dbd7190295298acfb4996ec1aba5165a7be28fdc (mci: Print versions with micro levels correctly) > > > > seems to be incorrect. > > > > > > > > barebox@Informer:/ mmc0.probe=1 > > > > mmc0: detected SD card version 1.a > > > > mmc0: registered mmc0 > > > > > > So what's the expected printout and was it correct without this patch? > > > > Host information: > > current clock: 25000000 > > current buswidth: 4 > > capabilities: 4bit sd-hs mmc-hs > > Card information: > > Attached is an SD Card (Version: 1.10) > > So the %x for printing the minor should really be a %u? I think yes. AFAIK there is no "1a" revision for SD card, but 1.01 and 1.1 is correct. --- _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: MCI print revision 2016-05-31 7:23 ` Sascha Hauer 2016-05-31 7:33 ` Re[2]: " Alexander Shiyan @ 2016-05-31 19:56 ` Trent Piepho 2016-05-31 19:58 ` [PATCH] mci: Fix version numbers again Trent Piepho 1 sibling, 1 reply; 8+ messages in thread From: Trent Piepho @ 2016-05-31 19:56 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox On Tue, 2016-05-31 at 09:23 +0200, Sascha Hauer wrote: > On Tue, May 31, 2016 at 10:02:48AM +0300, Alexander Shiyan wrote: > > > Вторник, 31 мая 2016, 9:26 +03:00 от Sascha Hauer <s.hauer@pengutronix.de>: > > > > > > +Cc Trent > > > > > > On Mon, May 30, 2016 at 12:01:12PM +0300, Alexander Shiyan wrote: > > > > Hello. > > > > > > > > Commit dbd7190295298acfb4996ec1aba5165a7be28fdc (mci: Print versions with micro levels correctly) > > > > seems to be incorrect. > > > > > > > > barebox@Informer:/ mmc0.probe=1 > > > > mmc0: detected SD card version 1.a > > > > mmc0: registered mmc0 > > > > > > So what's the expected printout and was it correct without this patch? > > > > Host information: > > current clock: 25000000 > > current buswidth: 4 > > capabilities: 4bit sd-hs mmc-hs > > Card information: > > Attached is an SD Card (Version: 1.10) > > So the %x for printing the minor should really be a %u? No, that will print MMC version 4.41 incorrectly as 4.65. I think the issue is the value of the version codes and how they should be printed. AFAICT, the codes originated in u-boot but were changed in commit "mci: Fix version handling" in 2014. The original u-boot code was easier to print, using "0x429" for version 4.41 so it would print correctly with "%u", but since 0x29 > 0x05 this resulted in 4.41 being sorted after 4.5. I think the fundamental problem here is fault of the people who created the SD and eMMC standards giving us this: 1.10 > 1.01 4.41 < 4.5 It's just not consistent. In one case the last two digits are single number but in the other they are a minor,micro version pair. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] mci: Fix version numbers again 2016-05-31 19:56 ` Trent Piepho @ 2016-05-31 19:58 ` Trent Piepho 2016-06-07 6:07 ` Sascha Hauer 0 siblings, 1 reply; 8+ messages in thread From: Trent Piepho @ 2016-05-31 19:58 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox The SD and eMMC version numbers are a pain to print and sort, since they are inconsistent in if a two digit minor version shdoulde be treated as a single number or as minor and micro version numbers. This allows version 1.10 and 4.5 and 4.41, where 41 is less than 5. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> --- drivers/mci/mci-core.c | 14 +++++++++----- include/mci.h | 7 ++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index 59f6675..42dde06 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -949,14 +949,18 @@ out: static char *mci_version_string(struct mci *mci) { - static char version[sizeof("x.xx")]; - unsigned major, minor; + static char version[sizeof("xx.xxx")]; + unsigned major, minor, micro; + int n; major = (mci->version >> 8) & 0xf; - minor = mci->version & 0xff; + minor = (mci->version >> 4) & 0xf; + micro = mci->version & 0xf; - /* Shift off last digit of minor if it's 0 */ - sprintf(version, "%u.%x", major, minor & 0xf ? minor : minor >> 4); + n = sprintf(version, "%u.%u", major, minor); + /* Omit zero micro versions */ + if (micro) + sprintf(version + n, "%u", micro); return version; } diff --git a/include/mci.h b/include/mci.h index 174d150..001c86c 100644 --- a/include/mci.h +++ b/include/mci.h @@ -30,11 +30,16 @@ #include <block.h> #include <regulator.h> +/* These codes should be sorted numerically in order of newness. If the last + * nybble is a zero, it will not be printed. So 0x120 -> "1.2" and 0x123 -> + * "1.23", 0x1a0 -> "1.10", 0x1b0 and 0x111 -> "1.11" but sort differently. + * It's not possible to create "1.20". */ + /* Firmware revisions for SD cards */ #define SD_VERSION_SD 0x20000 -#define SD_VERSION_2 (SD_VERSION_SD | 0x200) #define SD_VERSION_1_0 (SD_VERSION_SD | 0x100) #define SD_VERSION_1_10 (SD_VERSION_SD | 0x1a0) +#define SD_VERSION_2 (SD_VERSION_SD | 0x200) /* Firmware revisions for MMC cards */ #define MMC_VERSION_MMC 0x10000 -- 2.7.0.25.gfc10eb5.dirty _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mci: Fix version numbers again 2016-05-31 19:58 ` [PATCH] mci: Fix version numbers again Trent Piepho @ 2016-06-07 6:07 ` Sascha Hauer 0 siblings, 0 replies; 8+ messages in thread From: Sascha Hauer @ 2016-06-07 6:07 UTC (permalink / raw) To: Trent Piepho; +Cc: barebox On Tue, May 31, 2016 at 07:58:56PM +0000, Trent Piepho wrote: > The SD and eMMC version numbers are a pain to print and sort, since > they are inconsistent in if a two digit minor version shdoulde be > treated as a single number or as minor and micro version numbers. > > This allows version 1.10 and 4.5 and 4.41, where 41 is less than 5. > > Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> > --- Applied, thanks Sascha > drivers/mci/mci-core.c | 14 +++++++++----- > include/mci.h | 7 ++++++- > 2 files changed, 15 insertions(+), 6 deletions(-) > > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c > index 59f6675..42dde06 100644 > --- a/drivers/mci/mci-core.c > +++ b/drivers/mci/mci-core.c > @@ -949,14 +949,18 @@ out: > > static char *mci_version_string(struct mci *mci) > { > - static char version[sizeof("x.xx")]; > - unsigned major, minor; > + static char version[sizeof("xx.xxx")]; > + unsigned major, minor, micro; > + int n; > > major = (mci->version >> 8) & 0xf; > - minor = mci->version & 0xff; > + minor = (mci->version >> 4) & 0xf; > + micro = mci->version & 0xf; > > - /* Shift off last digit of minor if it's 0 */ > - sprintf(version, "%u.%x", major, minor & 0xf ? minor : minor >> 4); > + n = sprintf(version, "%u.%u", major, minor); > + /* Omit zero micro versions */ > + if (micro) > + sprintf(version + n, "%u", micro); > > return version; > } > diff --git a/include/mci.h b/include/mci.h > index 174d150..001c86c 100644 > --- a/include/mci.h > +++ b/include/mci.h > @@ -30,11 +30,16 @@ > #include <block.h> > #include <regulator.h> > > +/* These codes should be sorted numerically in order of newness. If the last > + * nybble is a zero, it will not be printed. So 0x120 -> "1.2" and 0x123 -> > + * "1.23", 0x1a0 -> "1.10", 0x1b0 and 0x111 -> "1.11" but sort differently. > + * It's not possible to create "1.20". */ > + > /* Firmware revisions for SD cards */ > #define SD_VERSION_SD 0x20000 > -#define SD_VERSION_2 (SD_VERSION_SD | 0x200) > #define SD_VERSION_1_0 (SD_VERSION_SD | 0x100) > #define SD_VERSION_1_10 (SD_VERSION_SD | 0x1a0) > +#define SD_VERSION_2 (SD_VERSION_SD | 0x200) > > /* Firmware revisions for MMC cards */ > #define MMC_VERSION_MMC 0x10000 > -- > 2.7.0.25.gfc10eb5.dirty > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-06-07 6:07 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-05-30 9:01 MCI print revision Alexander Shiyan 2016-05-31 6:26 ` Sascha Hauer 2016-05-31 7:02 ` Re[2]: " Alexander Shiyan 2016-05-31 7:23 ` Sascha Hauer 2016-05-31 7:33 ` Re[2]: " Alexander Shiyan 2016-05-31 19:56 ` Trent Piepho 2016-05-31 19:58 ` [PATCH] mci: Fix version numbers again Trent Piepho 2016-06-07 6:07 ` Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox