From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Cc: Peng Fan <peng.fan@nxp.com>, Simon Glass <sjg@chromium.org>,
Jaehoon Chung <jh80.chung@samsung.com>,
Sean Anderson <seanga2@gmail.com>
Subject: [PATCH 4/4] mmc: sandbox: Set the response
Date: Wed, 30 Mar 2022 12:54:46 -0400 [thread overview]
Message-ID: <20220330165446.438925-5-seanga2@gmail.com> (raw)
In-Reply-To: <20220330165446.438925-1-seanga2@gmail.com>
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@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
next prev parent reply other threads:[~2022-03-30 16:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 16:54 [PATCH 0/4] mmc: sandbox: Some small fixes Sean Anderson
2022-03-30 16:54 ` [PATCH 1/4] mmc: sandbox: Initialize the status register Sean Anderson
2022-04-22 12:03 ` Jaehoon Chung
2022-04-26 7:56 ` Jaehoon Chung
2022-08-13 15:26 ` Sean Anderson
2022-09-08 11:38 ` Jaehoon Chung
2022-03-30 16:54 ` [PATCH 2/4] mmc: sandbox: Initialize backing buffer Sean Anderson
2022-04-22 12:03 ` Jaehoon Chung
2022-03-30 16:54 ` [PATCH 3/4] mmc: Import some defines for R1 responses Sean Anderson
2022-04-22 12:03 ` Jaehoon Chung
2022-03-30 16:54 ` Sean Anderson [this message]
2022-04-22 12:03 ` [PATCH 4/4] mmc: sandbox: Set the response Jaehoon Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220330165446.438925-5-seanga2@gmail.com \
--to=seanga2@gmail.com \
--cc=jh80.chung@samsung.com \
--cc=peng.fan@nxp.com \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox