qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/sd/sdcard: fix SEND_STATUS for SPI cards
@ 2025-07-24 13:38 Ben Dooks
  2025-07-29 11:35 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2025-07-24 13:38 UTC (permalink / raw)
  To: qemu-block, philmd, bmeng.cn; +Cc: qemu-devel, Ben Dooks

When the code re-organisation for the SEND_STATUS command
was done it broke the ssi-sd code which is now throwing the
error "ssi_sd: error: Unexpected response to cmd 13" or a
similar one in newer code.

Fix this by returning sd_r1 instead of sd_r2_s

Fixes: 807f6adac3773c18772bf ("hw/sd/sdcard: Add sd_cmd_SEND_STATUS handler (CMD13)")
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 hw/sd/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 80b59c8ff9..4472d101f2 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1388,7 +1388,7 @@ static sd_rsp_type_t sd_cmd_SEND_STATUS(SDState *sd, SDRequest req)
     }
 
     if (sd_is_spi(sd)) {
-        return sd_r2_s;
+        return sd_r1;
     }
 
     return sd_req_rca_same(sd, req) ? sd_r1 : sd_r0;
-- 
2.37.2.352.g3c44437643



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hw/sd/sdcard: fix SEND_STATUS for SPI cards
  2025-07-24 13:38 [PATCH] hw/sd/sdcard: fix SEND_STATUS for SPI cards Ben Dooks
@ 2025-07-29 11:35 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-07-29 11:35 UTC (permalink / raw)
  To: Ben Dooks, qemu-block, bmeng.cn; +Cc: qemu-devel, Guenter Roeck

On 24/7/25 15:38, Ben Dooks wrote:
> When the code re-organisation for the SEND_STATUS command
> was done it broke the ssi-sd code which is now throwing the
> error "ssi_sd: error: Unexpected response to cmd 13" or a
> similar one in newer code.
> 
> Fix this by returning sd_r1 instead of sd_r2_s
> 
> Fixes: 807f6adac3773c18772bf ("hw/sd/sdcard: Add sd_cmd_SEND_STATUS handler (CMD13)")
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
>   hw/sd/sd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index 80b59c8ff9..4472d101f2 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -1388,7 +1388,7 @@ static sd_rsp_type_t sd_cmd_SEND_STATUS(SDState *sd, SDRequest req)
>       }
>   
>       if (sd_is_spi(sd)) {
> -        return sd_r2_s;
> +        return sd_r1;

Yeah this is what was suggested to Guenter previously:
https://lore.kernel.org/qemu-devel/e52b231d-f23e-4772-bfb2-08ddcc3e7ad0@linaro.org/

hw/sd/sd.c looks correct w.r.t. the spec; the issue seems to come
from hw/sd/ssi-sd.c "implementation". I'll post a fix, let's see
if it is acceptable for the next release.

>       }



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-29 11:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-24 13:38 [PATCH] hw/sd/sdcard: fix SEND_STATUS for SPI cards Ben Dooks
2025-07-29 11:35 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).