aboutsummaryrefslogtreecommitdiff
path: root/hw/sd/allwinner-sdhost.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-08-14 11:23:44 +0200
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-08-21 16:35:35 +0200
commit62a21be60f8fdf0223fa099fb4e7a495eaf55cf9 (patch)
tree006638d6c214186881ebbc211308ab10b76b8dbe /hw/sd/allwinner-sdhost.c
parente35c343dd9c18d4d3e6424e2fab38f08085875d6 (diff)
hw/sd: Use sdbus_write_data() instead of sdbus_write_byte when possible
Use the recently added sdbus_write_data() to write multiple bytes at once, instead of looping calling sdbus_write_byte(). Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200814092346.21825-6-f4bug@amsat.org>
Diffstat (limited to 'hw/sd/allwinner-sdhost.c')
-rw-r--r--hw/sd/allwinner-sdhost.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c
index c004aa39da..eea5659c5f 100644
--- a/hw/sd/allwinner-sdhost.c
+++ b/hw/sd/allwinner-sdhost.c
@@ -333,10 +333,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s,
if (is_write) {
cpu_physical_memory_read((desc->addr & DESC_SIZE_MASK) + num_done,
buf, buf_bytes);
-
- for (uint32_t i = 0; i < buf_bytes; i++) {
- sdbus_write_byte(&s->sdbus, buf[i]);
- }
+ sdbus_write_data(&s->sdbus, buf, buf_bytes);
/* Read from SD bus */
} else {
@@ -548,6 +545,7 @@ static void allwinner_sdhost_write(void *opaque, hwaddr offset,
uint64_t value, unsigned size)
{
AwSdHostState *s = AW_SDHOST(opaque);
+ uint32_t u32;
trace_allwinner_sdhost_write(offset, value, size);
@@ -654,11 +652,9 @@ static void allwinner_sdhost_write(void *opaque, hwaddr offset,
s->startbit_detect = value;
break;
case REG_SD_FIFO: /* Read/Write FIFO */
- sdbus_write_byte(&s->sdbus, value & 0xff);
- sdbus_write_byte(&s->sdbus, (value >> 8) & 0xff);
- sdbus_write_byte(&s->sdbus, (value >> 16) & 0xff);
- sdbus_write_byte(&s->sdbus, (value >> 24) & 0xff);
- allwinner_sdhost_update_transfer_cnt(s, sizeof(uint32_t));
+ u32 = cpu_to_le32(value);
+ sdbus_write_data(&s->sdbus, &u32, sizeof(u32));
+ allwinner_sdhost_update_transfer_cnt(s, sizeof(u32));
allwinner_sdhost_auto_stop(s);
allwinner_sdhost_update_irq(s);
break;