[PATCH v2] cmd: mmc: Add mmc reg read command for reading card registers

Lothar Waßmann LW at KARO-electronics.de
Tue Oct 31 09:26:41 CET 2023


Hi,

On Tue, 10 Oct 2023 14:47:28 +0200 Marek Vasut wrote:
> 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.
> 
> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
> Cc: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
> Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Cc: Jaehoon Chung <jh80.chung at samsung.com>
> Cc: Ramon Fried <rfried.dev at gmail.com>
> Cc: Roger Knecht <rknecht at pm.me>
> Cc: Sean Edmond <seanedmond at microsoft.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tobias Waldekranz <tobias at waldekranz.com>
> ---
> V2: - Update documentation
> ---
>  cmd/Kconfig           |  8 ++++
>  cmd/mmc.c             | 96 +++++++++++++++++++++++++++++++++++++++++++
>  doc/usage/cmd/mmc.rst | 26 ++++++++++++
>  3 files changed, 130 insertions(+)
> 
[...]
> +	if (!strcmp(argv[2], "ocr")) {
> +		printf("OCR: 0x%08x\n", mmc->ocr);
> +		if (argv[4])
> +			env_set_hex(argv[4], mmc->ocr);
> +		return CMD_RET_SUCCESS;
> +	}
> +	if (!strcmp(argv[2], "rca")) {
> +		printf("RCA: 0x%08x\n", mmc->rca);
> +		if (argv[4])
> +			env_set_hex(argv[4], mmc->rca);
> +		return CMD_RET_SUCCESS;
> +	}
> +	if (!strcmp(argv[2], "extcsd") &&
> +	    mmc->version >= MMC_VERSION_4_41) {
> +		ret = mmc_send_ext_csd(mmc, ext_csd);
> +		if (ret)
> +			return ret;
			return CMD_RET_FAILURE;


Lothar Waßmann


More information about the U-Boot mailing list