mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/9] mci: core: add CID as parameters and fix parsing
@ 2024-05-28 15:39 Stefan Kerkmann
  2024-05-28 15:39 ` [PATCH 1/9] mci: core: rename mtd to mdt Stefan Kerkmann
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Stefan Kerkmann @ 2024-05-28 15:39 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Stefan Kerkmann

This series adds the fields of the CID register found in MMC and SD
cards as parameters to the device. The intention is to use these
parameters in scripting e.g. for safety checks before applying
potentially destructive changes.

During the implementation I found several bugs in the implementation of
the CID parsing that usually stem from not discerning between MMC and
SD cards.

For a proof of work I have attached these outputs of both an internal
eMMC and SD card on an Phyboard Polis imx8mm device. The first output is
mmc-utils and the second barebox at the state of this patch series:

eMMC:

root@phyboard-polis-imx8mm-4:~ mmc cid read /sys/class/block/mmcblk2/device -v
======MMC/CID======
        MID: 0x13 (Micron)
        CBX: 0x1 (BGA)
        OID: 0x4e
        PNM: Q2J55L
        PRV: 0x10 (1.0)
        PSN: 0x13723b3f
        MDT: 0x93 2000 oct <-- This is likely a bug in mmc-utils
        CRC: 0x00

barebox@PHYTEC phyBOARD-Polis-i.MX8MM RDK: devinfo mmc2
Card information:
<snip>
  Manufacturer ID: 0x13
  OEM/Application ID: 0x4E
  CBX: 1
  Product name: 'Q2J55L'
  Product revision: 1.0
  Serial no: 326253375
  Manufacturing date: 2022.3
</snip>
Parameters:
<snip>
  cid_cbx: 1 (type: uint32)
  cid_mdt: 2022.3 (type: string)
  cid_mid: 0x13 (type: uint32)
  cid_oid: 0x4E (type: string)
  cid_pnm: Q2J55L (type: string)
  cid_prv: 1.0 (type: string)
  cid_psn: 326253375 (type: uint32)
</snip>

SD card:

root@phyboard-polis-imx8mm-4:~ mmc cid read /sys/class/block/mmcblk1/device -v
======SD/CID======
        MID: 0x63 (Unlisted)
        OID: C`
        PNM: CACTU
        PRV: 0x02 (0.2)
        PSN: 0x583010d2
        MDT: 0x158 2021 sep
        CRC: 0x00

barebox@PHYTEC phyBOARD-Polis-i.MX8MM RDK:/ devinfo mmc1
Card information:
<snip>
  Manufacturer ID: 0x63
  OEM/Application ID: C`
  Product name: 'CACTU'
  Product revision: 0.2
  Serial no: 2139062282
  Manufacturing date: 2021.8
</snip>
Parameters:
<snip>
  cid_mdt: 2021.8 (type: string)
  cid_mid: 0x63 (type: uint32)
  cid_oid: C` (type: string)
  cid_pnm: CACTU (type: string)
  cid_prv: 0.2 (type: string)
  cid_psn: 2139062282 (type: uint32)
</snip>

Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>
---
Stefan Kerkmann (9):
      mci: core: rename mtd to mdt
      mci: core: add cbx extraction function
      mci: core: add product name extraction function
      mci: core: add manufacturing date extraction function
      mci: core: parse cid into parameters
      mci: core: fix extract_prv and write to string buffer
      mci: core: add CBX field as parameter and print it
      mci: core: fix extract_oid and write to string buffer
      mci: core: add missing slice range for extract_psn function

 drivers/mci/mci-core.c | 119 ++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 98 insertions(+), 21 deletions(-)
---
base-commit: 80d7c9d3d80e75e2335a123d414fd7fe83508291
change-id: 20240528-feature-mmc-cid-as-parameters-685158ffc027

Best regards,
-- 
Stefan Kerkmann <s.kerkmann@pengutronix.de>




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-05-29  7:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-28 15:39 [PATCH 0/9] mci: core: add CID as parameters and fix parsing Stefan Kerkmann
2024-05-28 15:39 ` [PATCH 1/9] mci: core: rename mtd to mdt Stefan Kerkmann
2024-05-28 15:39 ` [PATCH 2/9] mci: core: add cbx extraction function Stefan Kerkmann
2024-05-28 15:39 ` [PATCH 3/9] mci: core: add product name " Stefan Kerkmann
2024-05-28 15:39 ` [PATCH 4/9] mci: core: add manufacturing date " Stefan Kerkmann
2024-05-28 15:39 ` [PATCH 5/9] mci: core: parse cid into parameters Stefan Kerkmann
2024-05-28 15:39 ` [PATCH 6/9] mci: core: fix extract_prv and write to string buffer Stefan Kerkmann
2024-05-28 15:39 ` [PATCH 7/9] mci: core: add CBX field as parameter and print it Stefan Kerkmann
2024-05-28 15:39 ` [PATCH 8/9] mci: core: fix extract_oid and write to string buffer Stefan Kerkmann
2024-05-28 15:39 ` [PATCH 9/9] mci: core: add missing slice range for extract_psn function Stefan Kerkmann
2024-05-29  6:17 ` [PATCH 0/9] mci: core: add CID as parameters and fix parsing Sascha Hauer
2024-05-29  7:24 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox