[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 17/25] hw/sd: Add sd_emmc_cmd_SEND_RELATIVE_ADDR() handler
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 17/25] hw/sd: Add sd_emmc_cmd_SEND_RELATIVE_ADDR() handler |
Date: |
Mon, 30 May 2022 21:38:08 +0200 |
From: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/sd/sd.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 5e315f171c..100fe191a7 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1048,6 +1048,25 @@ static sd_rsp_type_t sd_cmd_ALL_SEND_CID(SDState *sd,
SDRequest req)
return sd_r2_i;
}
+static void sd_emmc_set_rca(SDState *sd, uint16_t value)
+{
+ sd->rca = value;
+}
+
+static sd_rsp_type_t sd_emmc_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_emmc_set_rca(sd, req.arg >> 16);
+ return sd_r1;
+
+ default:
+ return sd_invalid_state_for_cmd(sd, req);
+ }
+}
+
static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR(SDState *sd, SDRequest req)
{
switch (sd->state) {
@@ -2189,6 +2208,7 @@ static const SDProto sd_proto_emmc = {
[0] = sd_cmd_GO_IDLE_STATE,
[1] = sd_emmc_cmd_SEND_OP_CMD,
[2] = sd_emmc_cmd_ALL_SEND_CID,
+ [3] = sd_emmc_cmd_SEND_RELATIVE_ADDR,
[5] = sd_cmd_illegal,
[19] = sd_cmd_SEND_TUNING_BLOCK,
[41] = sd_cmd_illegal,
--
2.36.1
- [PATCH v2 10/25] hw/sd: Add sd_cmd_ALL_SEND_CID() handler, (continued)
- [PATCH v2 10/25] hw/sd: Add sd_cmd_ALL_SEND_CID() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 11/25] hw/sd: Add sd_cmd_SEND_RELATIVE_ADDR() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 12/25] hw/sd: Add sd_cmd_SEND_TUNING_BLOCK() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 13/25] hw/sd: Add sd_cmd_SET_BLOCK_COUNT() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 14/25] hw/sd: Basis for eMMC support, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 15/25] hw/sd: Add sd_emmc_cmd_SEND_OP_CMD() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 16/25] hw/sd: Add sd_emmc_cmd_ALL_SEND_CID() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 17/25] hw/sd: Add sd_emmc_cmd_SEND_RELATIVE_ADDR() handler,
Philippe Mathieu-Daudé <=
- [PATCH v2 18/25] hw/sd: Add sd_emmc_cmd_APP_CMD() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 19/25] hw/sd: add sd_emmc_cmd_SEND_TUNING_BLOCK() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 20/25] hw/sd: Add CMD21 tuning sequence, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 21/25] hw/sd: Add mmc switch function support, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 22/25] hw/sd: Add sd_emmc_cmd_SEND_EXT_CSD() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 23/25] hw/sd: Support boot area in emmc image, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 24/25] hw/sd: Subtract bootarea size from blk, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 25/25] hw/sd: Add boot config support, Philippe Mathieu-Daudé, 2022/05/30
- Re: [PATCH v2 00/25] hw/sd: Rework models for eMMC support, Cédric Le Goater, 2022/05/31