[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/67] hw/sd/sdcard: Convert PROGRAM_CSD to generic_write_byte (CM
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 28/67] hw/sd/sdcard: Convert PROGRAM_CSD to generic_write_byte (CMD27) |
Date: |
Tue, 2 Jul 2024 11:20:11 +0200 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-34-philmd@linaro.org>
---
hw/sd/sd.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 0aead3c866..95ba4d0755 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1510,17 +1510,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
SDRequest req)
return sd_cmd_to_receivingdata(sd, req, 0, sizeof(sd->cid));
case 27: /* CMD27: PROGRAM_CSD */
- switch (sd->state) {
- case sd_transfer_state:
- sd->state = sd_receivingdata_state;
- sd->data_start = 0;
- sd->data_offset = 0;
- return sd_r1;
-
- default:
- break;
- }
- break;
+ return sd_cmd_to_receivingdata(sd, req, 0, sizeof(sd->csd));
/* Write protection (Class 6) */
case 28: /* CMD28: SET_WRITE_PROT */
@@ -2086,8 +2076,7 @@ void sd_write_byte(SDState *sd, uint8_t value)
break;
case 27: /* CMD27: PROGRAM_CSD */
- sd->data[sd->data_offset ++] = value;
- if (sd->data_offset >= sizeof(sd->csd)) {
+ if (sd_generic_write_byte(sd, value)) {
/* TODO: Check CRC before committing */
sd->state = sd_programming_state;
for (i = 0; i < sizeof(sd->csd); i ++)
--
2.41.0
- [PULL 17/67] hw/sd/sdcard: Duplicate READ_SINGLE_BLOCK / READ_MULTIPLE_BLOCK cases, (continued)
- [PULL 17/67] hw/sd/sdcard: Duplicate READ_SINGLE_BLOCK / READ_MULTIPLE_BLOCK cases, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 19/67] hw/sd/sdcard: Convert SEND_TUNING_BLOCK to generic_read_byte (CMD19), Philippe Mathieu-Daudé, 2024/07/02
- [PULL 20/67] hw/sd/sdcard: Convert SEND_WRITE_PROT to generic_read_byte (CMD30), Philippe Mathieu-Daudé, 2024/07/02
- [PULL 21/67] hw/sd/sdcard: Convert SD_STATUS to generic_read_byte (ACMD13), Philippe Mathieu-Daudé, 2024/07/02
- [PULL 22/67] hw/sd/sdcard: Convert SEND_NUM_WR_BLOCKS to generic_read_byte (ACMD22), Philippe Mathieu-Daudé, 2024/07/02
- [PULL 23/67] hw/sd/sdcard: Convert SEND_SCR to generic_read_byte (ACMD51), Philippe Mathieu-Daudé, 2024/07/02
- [PULL 24/67] hw/sd/sdcard: Introduce sd_cmd_to_receivingdata / sd_generic_write_byte, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 25/67] hw/sd/sdcard: Duplicate WRITE_SINGLE_BLOCK / WRITE_MULTIPLE_BLOCK cases, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 26/67] hw/sd/sdcard: Convert WRITE_SINGLE_BLOCK to generic_write_byte (CMD24), Philippe Mathieu-Daudé, 2024/07/02
- [PULL 27/67] hw/sd/sdcard: Convert PROGRAM_CID to generic_write_byte (CMD26), Philippe Mathieu-Daudé, 2024/07/02
- [PULL 28/67] hw/sd/sdcard: Convert PROGRAM_CSD to generic_write_byte (CMD27),
Philippe Mathieu-Daudé <=
- [PULL 29/67] hw/sd/sdcard: Convert LOCK_UNLOCK to generic_write_byte (CMD42), Philippe Mathieu-Daudé, 2024/07/02
- [PULL 30/67] hw/sd/sdcard: Move sd_[a]cmd_name() methods to sd.c, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 31/67] hw/sd/sdcard: Pass SDState as argument to sd_[a]cmd_name(), Philippe Mathieu-Daudé, 2024/07/02
- [PULL 32/67] hw/sd/sdcard: Prepare SDProto to contain more fields, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 33/67] hw/sd/sdcard: Store command name in SDProto, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 34/67] hw/sd/sdcard: Store command type in SDProto, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 36/67] hw/sd/sdcard: Remove SEND_DSR dead case (CMD4), Philippe Mathieu-Daudé, 2024/07/02
- [PULL 35/67] hw/sd/sdcard: Store command class in SDProto, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 38/67] hw/sd/sdcard: Register optional handlers from spec v6.00, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 41/67] hw/sd/sdcard: Add sd_cmd_SWITCH_FUNCTION handler (CMD6), Philippe Mathieu-Daudé, 2024/07/02