summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPragnesh Patel <pragnesh.patel@sifive.com>2020-06-29 15:17:27 +0530
committerPeng Fan <peng.fan@nxp.com>2020-07-14 16:19:44 +0800
commit70f176ae827823cb6fb7edccc8211c1f2f92b754 (patch)
tree22e88d34fa44262308f0cbbe1b4dad0f171582b5 /drivers/mmc
parent810bc13803027c63560504a3b910cf2ef3799194 (diff)
downloadu-boot-70f176ae827823cb6fb7edccc8211c1f2f92b754.tar.gz
u-boot-70f176ae827823cb6fb7edccc8211c1f2f92b754.tar.xz
u-boot-70f176ae827823cb6fb7edccc8211c1f2f92b754.zip
mmc: mmc_spi: Read R2 response for send status command - CMD13
Send status command (CMD13) will send R1 response under SD mode but R2 response under SPI mode. R2 response is 2 bytes long, so read 2 bytes for mmc SPI mode Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> Reviewed-by: Bin Meng <bin.meng@windriver.com> Tested-by: Bin Meng <bin.meng@windriver.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/mmc_spi.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c
index 18d36878ef..ee56de36ec 100644
--- a/drivers/mmc/mmc_spi.c
+++ b/drivers/mmc/mmc_spi.c
@@ -266,7 +266,7 @@ static int dm_mmc_spi_request(struct udevice *dev, struct mmc_cmd *cmd,
u8 *resp = NULL;
u32 resp_size = 0;
bool resp_match = false;
- u8 resp8 = 0, resp40[5] = { 0 }, resp_match_value = 0;
+ u8 resp8 = 0, resp16[2] = { 0 }, resp40[5] = { 0 }, resp_match_value = 0;
dm_spi_claim_bus(dev);
@@ -291,6 +291,9 @@ static int dm_mmc_spi_request(struct udevice *dev, struct mmc_cmd *cmd,
resp_size = sizeof(resp40);
break;
case MMC_CMD_SEND_STATUS:
+ resp = (u8 *)&resp16[0];
+ resp_size = sizeof(resp16);
+ break;
case MMC_CMD_SET_BLOCKLEN:
case MMC_CMD_SPI_CRC_ON_OFF:
case MMC_CMD_STOP_TRANSMISSION:
@@ -335,8 +338,10 @@ static int dm_mmc_spi_request(struct udevice *dev, struct mmc_cmd *cmd,
cmd->response[0] |= (uint)resp40[1] << 24;
break;
case MMC_CMD_SEND_STATUS:
- cmd->response[0] = (resp8 & 0xff) ?
- MMC_STATUS_ERROR : MMC_STATUS_RDY_FOR_DATA;
+ if (resp16[0] || resp16[1])
+ cmd->response[0] = MMC_STATUS_ERROR;
+ else
+ cmd->response[0] = MMC_STATUS_RDY_FOR_DATA;
break;
case MMC_CMD_SEND_CID:
case MMC_CMD_SEND_CSD: