cmd: mmc: Add mmc reg read command for reading card registers
PATCH v3 1/1 cmd: mmc: Add mmc reg read command for reading card registers
Add extension to the 'mmc' command to read out the card registers. Currently, only the eMMC OCR/CID/CSD/EXTCSD/RCA/DSR register are supported. A register value can either be displayed or read into an environment variable.
---
Cc: Abdellatif El Khlifi <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Roger Knecht <[email protected]>
Cc: Sean Edmond <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tobias Waldekranz <[email protected]>
---
V2: - Update documentation
V3: - Return CMD_RET_FAILURE on failure
- Add RB/TB from Jaehoon
--- cmd/Kconfig | 8 ++++ cmd/mmc.c | 96 +++++++++++++++++++++++++++++++++++++++++++ doc/usage/cmd/mmc.rst | 26 ++++++++++++ 3 files changed, 130 insertions(+)
cmd/Kconfig +8 -0
@@ -1313,6 +1313,14 @@ config CMD_BKOPS_ENABLE on a eMMC device. The feature is optionally available on eMMC devices conforming to standard >= 4.41. +config CMD_MMC_REG + bool "Enable support for reading card registers in the mmc command" + depends on CMD_MMC + default n + help + Enable the commands for reading card registers. This is useful + mostly for debugging or extracting details from the card. + config CMD_MMC_RPMB bool "Enable support for RPMB in the mmc command" depends on SUPPORT_EMMC_RPMB
cmd/mmc.c +96 -0
114 lines not on this page · raw message
doc/usage/cmd/mmc.rst +26 -0
@@ -21,6 +21,7 @@ Synopsis mmc bootpart-resize <dev> <dev part size MB> <RPMB part size MB> mmc partconf <dev> [[varname] | [<boot_ack> <boot_partition> <partition_access>]] mmc rst-function <dev> <value> + mmc reg read <reg> <offset> [env] Description -----------
@@ -183,6 +184,31 @@ The 'mmc rst-function' command changes the RST_n_FUNCTION field. 0x3 Reserved +The 'mmc reg read <reg> <offset> [env]' reads eMMC card register and +either print it to standard output, or store the value in environment +variable. + +<reg> with +optional offset <offset> into the register array, and print it to +standard output or store it into environment variable [env]. + + reg + cid + The Device IDentification (CID) register. Uses offset. + csd + The Device-Specific Data (CSD) register. Uses offset. + dsr + The driver stage register (DSR). + ocr + The operation conditions register (OCR). + rca + The relative Device address (RCA) register. + extcsd + The Extended CSD register. Uses offset. + offset + For 'cid'/'csd' 128 bit registers '[0..3]' in 32-bit increments. For 'extcsd' 512 bit register '[0..512,all]' in 8-bit increments, or 'all' to read the entire register. + env + Optional environment variable into which 32-bit value read from register should be stored. Examples --------
Signature · 1 line
2.42.0
Hi Marek,
cmd/Kconfig config CMD_BKOPS_ENABLE · line 1319
Quoted 4 lines · Marek Vasut
cmd/Kconfig +4
-0+config CMD_MMC_REG + bool "Enable support for reading card registers in the mmc command" + depends on CMD_MMC + default n
"default n" could be dropped, since it is already the default.
Quoted 10 lines · Fabio Estevam
Hi Marek,
cmd/Kconfig config CMD_BKOPS_ENABLE · line 1319
Quoted 4 lines · Marek Vasut
cmd/Kconfig +4
-0+config CMD_MMC_REG + bool "Enable support for reading card registers in the mmc command" + depends on CMD_MMC + default n"default n" could be dropped, since it is already the default.
Should be fixed in v4, thanks