[PATCH 4/4] mmc: sandbox: Set the response
Sean Anderson
seanga2 at gmail.com
Wed Mar 30 18:54:46 CEST 2022
The mmc subsystem checks the response, but we (almost) never set it. Add a
bare-bones implementation. Technically, we are supposed to return our
current state in our responses, but I don't think the subsystem checks it.
Signed-off-by: Sean Anderson <seanga2 at gmail.com>
---
drivers/mmc/sandbox_mmc.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c
index 60a6be0add..8922eeba2a 100644
--- a/drivers/mmc/sandbox_mmc.c
+++ b/drivers/mmc/sandbox_mmc.c
@@ -44,6 +44,9 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
struct mmc *mmc = mmc_get_mmc_dev(dev);
static ulong erase_start, erase_end;
+ /* Default R1 response */
+ cmd->response[0] = R1_READY_FOR_DATA;
+
switch (cmd->cmdidx) {
case MMC_CMD_ALL_SEND_CID:
memset(cmd->response, '\0', sizeof(cmd->response));
@@ -55,8 +58,8 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
case SD_CMD_SEND_IF_COND:
cmd->response[0] = 0xaa;
break;
- case MMC_CMD_SEND_STATUS:
- cmd->response[0] = MMC_STATUS_RDY_FOR_DATA;
+ case SD_CMD_APP_SD_STATUS:
+ cmd->response[0] |= R1_APP_CMD;
memset(data->dest, '\0', data->blocks * data->blocksize);
break;
case MMC_CMD_SELECT_CARD:
@@ -106,6 +109,7 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
cmd->response[2] = 0;
break;
case MMC_CMD_APP_CMD:
+ cmd->response[0] |= R1_APP_CMD;
break;
case MMC_CMD_SET_BLOCKLEN:
debug("block len %d\n", cmd->cmdarg);
@@ -113,11 +117,13 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
case SD_CMD_APP_SEND_SCR: {
u32 *scr = (u32 *)data->dest;
+ cmd->response[0] |= R1_APP_CMD;
scr[0] = cpu_to_be32(2 << 24 | 1 << 15); /* SD version 3 */
break;
}
default:
debug("%s: Unknown command %d\n", __func__, cmd->cmdidx);
+ cmd->response[0] |= R1_ILLEGAL_COMMAND;
break;
}
--
2.35.1
More information about the U-Boot
mailing list