diff mbox

[arm-devs,v2,5/5] sd/sd.c: Fix "inquiry" ACMD41

Message ID bce652b0217469954cca567c632ddebbb638a37a.1369370934.git.peter.crosthwaite@xilinx.com
State New
Headers show

Commit Message

Peter Crosthwaite May 24, 2013, 5:18 a.m. UTC
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

QEMU models two (of the three) ACMD41 has two modes, "inquiry" and
"first". The selection logic for which of the two is incorrect - it
compares != 0 for the entire argument value rather than only bits 23:0
as per the spec. Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
Changed since v1:
Total rewrite

 hw/sd/sd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Peter Maydell May 24, 2013, 8:14 a.m. UTC | #1
On 24 May 2013 06:18,  <peter.crosthwaite@xilinx.com> wrote:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> QEMU models two (of the three) ACMD41 has two modes, "inquiry" and
> "first". The selection logic for which of the two is incorrect - it
> compares != 0 for the entire argument value rather than only bits 23:0
> as per the spec. Fix.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> Changed since v1:
> Total rewrite
>
>  hw/sd/sd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index 2e0ef3e..4d26578 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -1278,8 +1278,9 @@ static sd_rsp_type_t sd_app_command(SDState *sd,
>          switch (sd->state) {
>          case sd_idle_state:
>              /* We accept any voltage.  10000 V is nothing.  */
> -            if (req.arg)
> +            if (req.arg & 0x00ffffff) {
>                  sd->state = sd_ready_state;
> +            }
>
>              return sd_r3;

Could we have a comment here please?

thanks
-- PMM
diff mbox

Patch

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 2e0ef3e..4d26578 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1278,8 +1278,9 @@  static sd_rsp_type_t sd_app_command(SDState *sd,
         switch (sd->state) {
         case sd_idle_state:
             /* We accept any voltage.  10000 V is nothing.  */
-            if (req.arg)
+            if (req.arg & 0x00ffffff) {
                 sd->state = sd_ready_state;
+            }
 
             return sd_r3;