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: 775616c3ae ("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>
This commit is contained in:
parent
3241a61a13
commit
3c7bde41a3
1 changed files with 8 additions and 2 deletions
10
hw/sd/sd.c
10
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue