[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/32] hw/sd: Add sd_cmd_SEND_RELATIVE_ADDR() handler
From: |
Cédric Le Goater |
Subject: |
[PATCH 10/32] hw/sd: Add sd_cmd_SEND_RELATIVE_ADDR() handler |
Date: |
Mon, 3 Jul 2023 15:24:47 +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-11-f4bug@amsat.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/sd/sd.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 33ecff496ade..b46072424108 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1048,6 +1048,20 @@ static sd_rsp_type_t sd_cmd_ALL_SEND_CID(SDState *sd,
SDRequest req)
return sd_r2_i;
}
+static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR(SDState *sd, SDRequest req)
+{
+ switch (sd->state) {
+ case sd_identification_state:
+ case sd_standby_state:
+ sd->state = sd_standby_state;
+ sd_set_rca(sd);
+ return sd_r6;
+
+ default:
+ return sd_invalid_state_for_cmd(sd, req);
+ }
+}
+
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
{
uint32_t rca = 0x0000;
@@ -1087,19 +1101,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
SDRequest req)
switch (req.cmd) {
/* Basic commands (Class 0 and Class 1) */
- case 3: /* CMD3: SEND_RELATIVE_ADDR */
- switch (sd->state) {
- case sd_identification_state:
- case sd_standby_state:
- sd->state = sd_standby_state;
- sd_set_rca(sd);
- return sd_r6;
-
- default:
- break;
- }
- break;
-
case 4: /* CMD4: SEND_DSR */
switch (sd->state) {
case sd_standby_state:
@@ -2149,6 +2150,7 @@ static const SDProto sd_proto_sd = {
[0] = sd_cmd_GO_IDLE_STATE,
[1] = sd_cmd_illegal,
[2] = sd_cmd_ALL_SEND_CID,
+ [3] = sd_cmd_SEND_RELATIVE_ADDR,
[5] = sd_cmd_illegal,
[52 ... 54] = sd_cmd_illegal,
[58] = sd_cmd_illegal,
--
2.41.0
- [PATCH 00/32] hw/sd: eMMC support, Cédric Le Goater, 2023/07/03
- [PATCH 01/32] hw/sd: When card is in wrong state, log which state it is, Cédric Le Goater, 2023/07/03
- [PATCH 02/32] hw/sd: When card is in wrong state, log which spec version is used, Cédric Le Goater, 2023/07/03
- [PATCH 03/32] hw/sd: Move proto_name to SDProto structure, Cédric Le Goater, 2023/07/03
- [PATCH 04/32] hw/sd: Introduce sd_cmd_handler type, Cédric Le Goater, 2023/07/03
- [PATCH 05/32] hw/sd: Add sd_cmd_illegal() handler, Cédric Le Goater, 2023/07/03
- [PATCH 06/32] hw/sd: Add sd_cmd_unimplemented() handler, Cédric Le Goater, 2023/07/03
- [PATCH 07/32] hw/sd: Add sd_cmd_GO_IDLE_STATE() handler, Cédric Le Goater, 2023/07/03
- [PATCH 08/32] hw/sd: Add sd_cmd_SEND_OP_CMD() handler, Cédric Le Goater, 2023/07/03
- [PATCH 09/32] hw/sd: Add sd_cmd_ALL_SEND_CID() handler, Cédric Le Goater, 2023/07/03
- [PATCH 10/32] hw/sd: Add sd_cmd_SEND_RELATIVE_ADDR() handler,
Cédric Le Goater <=
- [PATCH 12/32] hw/sd: Add sd_cmd_SET_BLOCK_COUNT() handler, Cédric Le Goater, 2023/07/03
- [PATCH 11/32] hw/sd: Add sd_cmd_SEND_TUNING_BLOCK() handler, Cédric Le Goater, 2023/07/03
- [PATCH 13/32] hw/sd: Introduce a "sd-card" SPI variant model, Cédric Le Goater, 2023/07/03
- [PATCH 14/32] hw/sd: Basis for eMMC support, Cédric Le Goater, 2023/07/03
- [PATCH 15/32] hw/sd: Add emmc_cmd_SEND_OP_CMD() handler, Cédric Le Goater, 2023/07/03
- [PATCH 16/32] hw/sd: Add emmc_cmd_ALL_SEND_CID() handler, Cédric Le Goater, 2023/07/03
- [PATCH 17/32] hw/sd: Add emmc_cmd_SEND_RELATIVE_ADDR() handler, Cédric Le Goater, 2023/07/03
- [PATCH 18/32] hw/sd: Add emmc_cmd_APP_CMD() handler, Cédric Le Goater, 2023/07/03
- [PATCH 21/32] hw/sd: Add mmc switch function support, Cédric Le Goater, 2023/07/03
- [PATCH 22/32] hw/sd: Add emmc_cmd_SEND_EXT_CSD() handler, Cédric Le Goater, 2023/07/03