diff mbox series

[RFC,07/17] hw/sd: Add sd_cmd_SEND_OP_CMD() handler

Message ID 20220318132824.1134400-8-clg@kaod.org
State New
Headers show
Series hw/sd: Rework models for eMMC support | expand

Commit Message

Cédric Le Goater March 18, 2022, 1:28 p.m. UTC
From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210624142209.1193073-9-f4bug@amsat.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/sd/sd.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Cédric Le Goater May 10, 2022, 6:57 a.m. UTC | #1
On 5/9/22 23:12, Philippe Mathieu-Daudé wrote:
> On 18/3/22 14:28, Cédric Le Goater wrote:
>> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> Message-Id: <20210624142209.1193073-9-f4bug@amsat.org>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>   hw/sd/sd.c | 18 +++++++++---------
>>   1 file changed, 9 insertions(+), 9 deletions(-)
> 
>> @@ -2111,6 +2109,7 @@ static const SDProto sd_proto_spi = {
>>       .name = "SPI",
>>       .cmd = {
>>           [0]         = sd_cmd_GO_IDLE_STATE,
>> +        [1]         = sd_cmd_SEND_OP_CMD,
>>           [2 ... 4]   = sd_cmd_illegal,
>>           [5]         = sd_cmd_illegal,
>>           [7]         = sd_cmd_illegal,
>> @@ -2120,6 +2119,7 @@ static const SDProto sd_proto_spi = {
>>       },
>>       .cmd = {
>>           [6]         = sd_cmd_unimplemented,
>> +        [41]        = sd_cmd_SEND_OP_CMD,
>>       },
>>   };
> 
> I missed adding the cmd_abbrev[1] entry.

Will you resend ?

Thanks,

C.
diff mbox series

Patch

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 30429e8954d3..a6ce54433388 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1010,6 +1010,13 @@  static sd_rsp_type_t sd_cmd_GO_IDLE_STATE(SDState *sd, SDRequest req)
     return sd->spi ? sd_r1 : sd_r0;
 }
 
+static sd_rsp_type_t sd_cmd_SEND_OP_CMD(SDState *sd, SDRequest req)
+{
+    sd->state = sd_transfer_state;
+
+    return sd_r1;
+}
+
 static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
 {
     uint32_t rca = 0x0000;
@@ -1049,10 +1056,6 @@  static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
 
     switch (req.cmd) {
     /* Basic commands (Class 0 and Class 1) */
-    case 1:	/* CMD1:   SEND_OP_CMD */
-        sd->state = sd_transfer_state;
-        return sd_r1;
-
     case 2:	/* CMD2:   ALL_SEND_CID */
         switch (sd->state) {
         case sd_ready_state:
@@ -1602,11 +1605,6 @@  static sd_rsp_type_t sd_app_command(SDState *sd,
         break;
 
     case 41:	/* ACMD41: SD_APP_OP_COND */
-        if (sd->spi) {
-            /* SEND_OP_CMD */
-            sd->state = sd_transfer_state;
-            return sd_r1;
-        }
         if (sd->state != sd_idle_state) {
             break;
         }
@@ -2111,6 +2109,7 @@  static const SDProto sd_proto_spi = {
     .name = "SPI",
     .cmd = {
         [0]         = sd_cmd_GO_IDLE_STATE,
+        [1]         = sd_cmd_SEND_OP_CMD,
         [2 ... 4]   = sd_cmd_illegal,
         [5]         = sd_cmd_illegal,
         [7]         = sd_cmd_illegal,
@@ -2120,6 +2119,7 @@  static const SDProto sd_proto_spi = {
     },
     .cmd = {
         [6]         = sd_cmd_unimplemented,
+        [41]        = sd_cmd_SEND_OP_CMD,
     },
 };