diff options
| author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-07-31 11:17:52 +0200 |
|---|---|---|
| committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-08-05 16:05:56 +0200 |
| commit | 3c7bde41a37546a49e10adafc54e9201ac087585 (patch) | |
| tree | 9e6d361cb98ee531593deed3d4bdbe90ff7b02de /hw/sd/sd.c | |
| parent | 3241a61a1374b4d9b0e835fb3fa5b4085377eebb (diff) | |
| download | focaccia-qemu-3c7bde41a37546a49e10adafc54e9201ac087585.tar.gz focaccia-qemu-3c7bde41a37546a49e10adafc54e9201ac087585.zip | |
hw/sd/sdcard: Allow using SWITCH_FUNCTION in more SPI states
In SPI mode, SWITCH_FUNCTION is valid in all mode
(except the IDLE one).
Fixes: 775616c3ae8 ("Partial SD card SPI mode support")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250804133406.17456-8-philmd@linaro.org>
Diffstat (limited to 'hw/sd/sd.c')
| -rw-r--r-- | hw/sd/sd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/sd/sd.c b/hw/sd/sd.c index df2a272c6a..a9efa15859 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1488,8 +1488,14 @@ static sd_rsp_type_t sd_cmd_SWITCH_FUNCTION(SDState *sd, SDRequest req) if (sd->mode != sd_data_transfer_mode) { return sd_invalid_mode_for_cmd(sd, req); } - if (sd->state != sd_transfer_state) { - return sd_invalid_state_for_cmd(sd, req); + if (sd_is_spi(sd)) { + if (sd->state == sd_idle_state) { + return sd_invalid_state_for_cmd(sd, req); + } + } else { + if (sd->state != sd_transfer_state) { + return sd_invalid_state_for_cmd(sd, req); + } } sd_function_switch(sd, req.arg); |