mmc: core: add argument check for cmd1

According to eMMC specification v5.1 section A6.1, the R3 response
value should be 0x00FF8080, 0x40FF8080, 0x80FF8080 or 0xC0FF8080.
The EMMC device may be abnormal if a wrong OCR data is configured.

Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Change-Id: I5b19c0a937b55dc75e9d1abf7f9c8cf9a5d083b5
This commit is contained in:
Yifeng Zhao
2021-12-22 18:09:40 +08:00
committed by Tao Huang
parent 44f46d2c06
commit 69da1839de

View File

@@ -184,6 +184,15 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
if (err)
break;
/*
* According to eMMC specification v5.1 section A6.1, the R3
* response value should be 0x00FF8080, 0x40FF8080, 0x80FF8080
* or 0xC0FF8080. The EMMC device may be abnormal if a wrong
* OCR data is configured.
*/
if ((cmd.resp[0] & 0xFFFFFF) != 0x00FF8080)
continue;
/* wait until reset completes */
if (mmc_host_is_spi(host)) {
if (!(cmd.resp[0] & R1_SPI_IDLE))