diff mbox series

[RFC,12/19] hw/sd/sdcard: Adapt sd_cmd_ALL_SEND_CID handler for eMMC (CMD2)

Message ID 20240627171059.84349-13-philmd@linaro.org
State Superseded
Headers show
Series hw/sd: Add support for eMMC cards | expand

Commit Message

Philippe Mathieu-Daudé June 27, 2024, 5:10 p.m. UTC
From: Cédric Le Goater <clg@kaod.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
[PMD: Use aspeed_emmc_kludge]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/sd/sd.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index dc692fe1fa..f875fcd741 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1218,7 +1218,13 @@  static sd_rsp_type_t emmc_cmd_SEND_OP_COND(SDState *sd, SDRequest req)
 static sd_rsp_type_t sd_cmd_ALL_SEND_CID(SDState *sd, SDRequest req)
 {
     switch (sd->state) {
+    case sd_idle_state:
+        if (!sd->aspeed_emmc_kludge) {
+            return sd_invalid_state_for_cmd(sd, req);
+        }
+        /* fall-through */
     case sd_ready_state:
+        /* Bus always won */
         sd->state = sd_identification_state;
         return sd_r2_i;
     default: