diff mbox series

[19/32] hw/sd: add emmc_cmd_SEND_TUNING_BLOCK() handler

Message ID 20230703132509.2474225-20-clg@kaod.org
State New
Headers show
Series hw/sd: eMMC support | expand

Commit Message

Cédric Le Goater July 3, 2023, 1:24 p.m. UTC
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/sd/sd.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 95cb46b87519..4b4a4cda2e68 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -2212,6 +2212,17 @@  static sd_rsp_type_t emmc_cmd_APP_CMD(SDState *sd, SDRequest req)
     return sd_r0;
 }
 
+static sd_rsp_type_t emmc_cmd_SEND_TUNING_BLOCK(SDState *sd, SDRequest req)
+{
+    if (sd->state != sd_transfer_state) {
+        sd_invalid_state_for_cmd(sd, req);
+    }
+
+    sd->state = sd_sendingdata_state;
+    sd->data_offset = 0;
+    return sd_r1;
+}
+
 static const SDProto sd_proto_emmc = {
     .name = "eMMC",
     .cmd = {
@@ -2222,6 +2233,7 @@  static const SDProto sd_proto_emmc = {
         [5]         = sd_cmd_illegal,
         [19]        = sd_cmd_SEND_TUNING_BLOCK,
         [23]        = sd_cmd_SET_BLOCK_COUNT,
+        [21]        = emmc_cmd_SEND_TUNING_BLOCK,
         [41]        = sd_cmd_illegal,
         [52 ... 54] = sd_cmd_illegal,
         [55]        = emmc_cmd_APP_CMD,