[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 22/26] hw/sd: Add sd_cmd_ALL_SEND_CID() handler
From: |
Cédric Le Goater |
Subject: |
[PULL 22/26] hw/sd: Add sd_cmd_ALL_SEND_CID() handler |
Date: |
Fri, 1 Sep 2023 11:42:10 +0200 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Message-Id: <20210624142209.1193073-10-f4bug@amsat.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/sd/sd.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index bd67c50894fe..33ecff496ade 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1037,6 +1037,17 @@ static sd_rsp_type_t sd_cmd_SEND_OP_CMD(SDState *sd,
SDRequest req)
return sd_r1;
}
+static sd_rsp_type_t sd_cmd_ALL_SEND_CID(SDState *sd, SDRequest req)
+{
+ if (sd->state != sd_ready_state) {
+ return sd_invalid_state_for_cmd(sd, req);
+ }
+
+ sd->state = sd_identification_state;
+
+ return sd_r2_i;
+}
+
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
{
uint32_t rca = 0x0000;
@@ -1076,17 +1087,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
SDRequest req)
switch (req.cmd) {
/* Basic commands (Class 0 and Class 1) */
- case 2: /* CMD2: ALL_SEND_CID */
- switch (sd->state) {
- case sd_ready_state:
- sd->state = sd_identification_state;
- return sd_r2_i;
-
- default:
- break;
- }
- break;
-
case 3: /* CMD3: SEND_RELATIVE_ADDR */
switch (sd->state) {
case sd_identification_state:
@@ -2148,6 +2148,7 @@ static const SDProto sd_proto_sd = {
.cmd = {
[0] = sd_cmd_GO_IDLE_STATE,
[1] = sd_cmd_illegal,
+ [2] = sd_cmd_ALL_SEND_CID,
[5] = sd_cmd_illegal,
[52 ... 54] = sd_cmd_illegal,
[58] = sd_cmd_illegal,
--
2.41.0
- [PULL 11/26] m25p80: Introduce an helper to retrieve the BlockBackend of a device, (continued)
- [PULL 11/26] m25p80: Introduce an helper to retrieve the BlockBackend of a device, Cédric Le Goater, 2023/09/01
- [PULL 10/26] aspeed: Create flash devices only when defaults are enabled, Cédric Le Goater, 2023/09/01
- [PULL 13/26] hw/sd/sdcard: Return ILLEGAL for CMD19/CMD23 prior SD spec v3.01, Cédric Le Goater, 2023/09/01
- [PULL 14/26] hw/sd: When card is in wrong state, log which state it is, Cédric Le Goater, 2023/09/01
- [PULL 17/26] hw/sd: Introduce sd_cmd_handler type, Cédric Le Goater, 2023/09/01
- [PULL 15/26] hw/sd: When card is in wrong state, log which spec version is used, Cédric Le Goater, 2023/09/01
- [PULL 19/26] hw/sd: Add sd_cmd_unimplemented() handler, Cédric Le Goater, 2023/09/01
- [PULL 16/26] hw/sd: Move proto_name to SDProto structure, Cédric Le Goater, 2023/09/01
- [PULL 18/26] hw/sd: Add sd_cmd_illegal() handler, Cédric Le Goater, 2023/09/01
- [PULL 21/26] hw/sd: Add sd_cmd_SEND_OP_CMD() handler, Cédric Le Goater, 2023/09/01
- [PULL 22/26] hw/sd: Add sd_cmd_ALL_SEND_CID() handler,
Cédric Le Goater <=
- [PULL 23/26] hw/sd: Add sd_cmd_SEND_RELATIVE_ADDR() handler, Cédric Le Goater, 2023/09/01
- [PULL 24/26] hw/sd: Add sd_cmd_SEND_TUNING_BLOCK() handler, Cédric Le Goater, 2023/09/01
- [PULL 20/26] hw/sd: Add sd_cmd_GO_IDLE_STATE() handler, Cédric Le Goater, 2023/09/01
- [PULL 25/26] hw/sd: Add sd_cmd_SET_BLOCK_COUNT() handler, Cédric Le Goater, 2023/09/01
- [PULL 26/26] hw/sd: Introduce a "sd-card" SPI variant model, Cédric Le Goater, 2023/09/01
- Re: [PULL 00/26] aspeed queue, Stefan Hajnoczi, 2023/09/06
- Re: [PULL 00/26] aspeed queue, Cédric Le Goater, 2023/09/08