summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-07-31 15:58:31 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-08-05 16:05:56 +0200
commit823d9b00452b62dcee1b0692c578c6fa5eef517e (patch)
tree08f75134f585665934267a4cf4a4480743bcf5e4
parent7574baef43f0d1bd6982be7d5087af3bca2a7a4f (diff)
downloadfocaccia-qemu-823d9b00452b62dcee1b0692c578c6fa5eef517e.tar.gz
focaccia-qemu-823d9b00452b62dcee1b0692c578c6fa5eef517e.zip
hw/sd/sdcard: Disable checking STBY mode in SPI SEND_CSD/CID
The card should be in STANDBY mode to process SEND_CSD or SEND_CID,
but is still in IDLE mode.

Unfortunately I don't have enough time to keep debugging this issue,
so disable the check for the time being and the next release, as it
blocks Linux. I'll keep looking.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Reported-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250804133406.17456-10-philmd@linaro.org>
-rw-r--r--hw/sd/sd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index ee81dc0999..22f3099771 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1591,9 +1591,20 @@ static sd_rsp_type_t emmc_cmd_SEND_EXT_CSD(SDState *sd, SDRequest req)
 static sd_rsp_type_t spi_cmd_SEND_CxD(SDState *sd, SDRequest req,
                                       const void *data, size_t size)
 {
+    /*
+     * XXX as of v10.1.0-rc1 command is reached in sd_idle_state,
+     * so disable this check.
     if (sd->state != sd_standby_state) {
         return sd_invalid_state_for_cmd(sd, req);
     }
+    */
+
+    /*
+     * Since SPI returns CSD and CID on the DAT lines,
+     * switch to sd_transfer_state.
+     */
+    sd->state = sd_transfer_state;
+
     return sd_cmd_to_sendingdata(sd, req, 0, data, size);
 }