[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/26] hw/sd: Add sd_cmd_SET_BLOCK_COUNT() handler
From: |
Cédric Le Goater |
Subject: |
[PULL 25/26] hw/sd: Add sd_cmd_SET_BLOCK_COUNT() handler |
Date: |
Fri, 1 Sep 2023 11:42:13 +0200 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/sd/sd.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 00a59450b726..d1c0b132c227 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1078,6 +1078,21 @@ static sd_rsp_type_t sd_cmd_SEND_TUNING_BLOCK(SDState
*sd, SDRequest req)
return sd_r1;
}
+static sd_rsp_type_t sd_cmd_SET_BLOCK_COUNT(SDState *sd, SDRequest req)
+{
+ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) {
+ return sd_cmd_illegal(sd, req);
+ }
+
+ if (sd->state != sd_transfer_state) {
+ return sd_invalid_state_for_cmd(sd, req);
+ }
+
+ sd->multi_blk_cnt = req.arg;
+
+ return sd_r1;
+}
+
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
{
uint32_t rca = 0x0000;
@@ -1321,20 +1336,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
SDRequest req)
}
break;
- case 23: /* CMD23: SET_BLOCK_COUNT */
- if (sd->spec_version < SD_PHY_SPECv3_01_VERS) {
- return sd_invalid_state_for_cmd(sd, req);
- }
- switch (sd->state) {
- case sd_transfer_state:
- sd->multi_blk_cnt = req.arg;
- return sd_r1;
-
- default:
- break;
- }
- break;
-
/* Block write commands (Class 4) */
case 24: /* CMD24: WRITE_SINGLE_BLOCK */
case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */
@@ -2158,6 +2159,7 @@ static const SDProto sd_proto_sd = {
[3] = sd_cmd_SEND_RELATIVE_ADDR,
[5] = sd_cmd_illegal,
[19] = sd_cmd_SEND_TUNING_BLOCK,
+ [23] = sd_cmd_SET_BLOCK_COUNT,
[52 ... 54] = sd_cmd_illegal,
[58] = sd_cmd_illegal,
[59] = sd_cmd_illegal,
--
2.41.0
- [PULL 17/26] hw/sd: Introduce sd_cmd_handler type, (continued)
- [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, 2023/09/01
- [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 <=
- [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