On 28.05.24 17:39, Stefan Kerkmann wrote: > 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) Nitpick: We usually use . to denote namespaces in device parameters, should we change this to be cid.cbx and so on? > </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@xxxxxxxxxxxxxx> > --- > 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, -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |