[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/20] sdcard: Use the ldst API
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH 01/20] sdcard: Use the ldst API |
Date: |
Fri, 4 May 2018 12:58:59 -0300 |
The load/store API will ease further code movement.
Per the Physical Layer Simplified Spec. "3.6 Bus Protocol":
"In the CMD line the Most Significant Bit (MSB) is transmitted
first, the Least Significant Bit (LSB) is the last."
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/sd/milkymist-memcard.c | 3 +--
hw/sd/ssi-sd.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c
index 5570c1e9a0..ff2b92dc64 100644
--- a/hw/sd/milkymist-memcard.c
+++ b/hw/sd/milkymist-memcard.c
@@ -100,8 +100,7 @@ static void memcard_sd_command(MilkymistMemcardState *s)
SDRequest req;
req.cmd = s->command[0] & 0x3f;
- req.arg = (s->command[1] << 24) | (s->command[2] << 16)
- | (s->command[3] << 8) | s->command[4];
+ req.arg = ldl_be_p(s->command + 1);
req.crc = s->command[5];
s->response[0] = req.cmd;
diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
index ae04b6641b..0bb26e596d 100644
--- a/hw/sd/ssi-sd.c
+++ b/hw/sd/ssi-sd.c
@@ -97,8 +97,7 @@ static uint32_t ssi_sd_transfer(SSISlave *dev, uint32_t val)
uint8_t longresp[16];
/* FIXME: Check CRC. */
request.cmd = s->cmd;
- request.arg = (s->cmdarg[0] << 24) | (s->cmdarg[1] << 16)
- | (s->cmdarg[2] << 8) | s->cmdarg[3];
+ request.arg = ldl_be_p(s->cmdarg);
DPRINTF("CMD%d arg 0x%08x\n", s->cmd, request.arg);
s->arglen = sdbus_do_command(&s->sdbus, &request, longresp);
if (s->arglen <= 0) {
--
2.17.0
- [Qemu-devel] [PATCH 00/20] sdcard: proper implementation of CRC, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 03/20] sdcard: Rename the SDRequest as SDFrame48, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 02/20] sdcard: Extract sd_calc_frame48_crc7() from sd_req_crc_validate(), Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 01/20] sdcard: Use the ldst API,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 04/20] sdcard: Add sd_prepare_request[_with_crc](), Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 06/20] sdcard: Add a "validate-crc" property, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 05/20] sdcard: Use the sd_prepare_request*() functions, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 07/20] sdcard: Constify sd_crc*()'s message argument, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 08/20] sdcard: Fix sd_crc*() style, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 09/20] sdcard: Expose sd_crc*() functions for QTest use, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 10/20] sdcard: Expose sd_prepare_request*() functions for QTest use, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 11/20] sdcard: Add test_sd_request_frame_crc7() qtest (request command CRC7), Philippe Mathieu-Daudé, 2018/05/04