[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 08/10] hw/sd: Add sd_cmd_SEND_OP_CMD() handler
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 08/10] hw/sd: Add sd_cmd_SEND_OP_CMD() handler |
Date: |
Thu, 24 Jun 2021 16:22:07 +0200 |
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/sd/sd.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 3ef6aca89da..b63d99f7da0 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -992,6 +992,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;
@@ -1031,10 +1038,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:
@@ -1579,11 +1582,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;
}
@@ -2088,6 +2086,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,
@@ -2097,6 +2096,7 @@ static const SDProto sd_proto_spi = {
},
.cmd = {
[6] = sd_cmd_unimplemented,
+ [41] = sd_cmd_SEND_OP_CMD,
},
};
--
2.31.1
- Re: [RFC PATCH 05/10] hw/sd: Add sd_cmd_illegal() handler, (continued)
[RFC PATCH 07/10] hw/sd: Add sd_cmd_GO_IDLE_STATE() handler, Philippe Mathieu-Daudé, 2021/06/24
[RFC PATCH 08/10] hw/sd: Add sd_cmd_SEND_OP_CMD() handler,
Philippe Mathieu-Daudé <=
[RFC PATCH 09/10] hw/sd: Add sd_cmd_ALL_SEND_CID() handler, Philippe Mathieu-Daudé, 2021/06/24
[RFC PATCH 10/10] hw/sd: Add sd_cmd_SEND_RELATIVE_ADDR() handler, Philippe Mathieu-Daudé, 2021/06/24
Re: [RFC PATCH 00/10] hw/sd: Start splitting SD vs SPI protocols, Cédric Le Goater, 2021/06/28