diff options
author | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2020-08-14 11:23:46 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2020-08-21 16:35:35 +0200 |
commit | 618e0be1bac7ffe794242b422f7a9767f2a8be79 (patch) | |
tree | e16ef3db024ddf1ff92e38b4fa0976a9114dde2c /hw/sd/allwinner-sdhost.c | |
parent | 6505a91a77d4efcc6d54b35851abcb137cdca30a (diff) |
hw/sd: Use sdbus_read_data() instead of sdbus_read_byte() when possible
Use the recently added sdbus_read_data() to read multiple
bytes at once, instead of looping calling sdbus_read_byte().
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200814092346.21825-8-f4bug@amsat.org>
Diffstat (limited to 'hw/sd/allwinner-sdhost.c')
-rw-r--r-- | hw/sd/allwinner-sdhost.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c index eea5659c5f..f9eb92c09e 100644 --- a/hw/sd/allwinner-sdhost.c +++ b/hw/sd/allwinner-sdhost.c @@ -337,9 +337,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, /* Read from SD bus */ } else { - for (uint32_t i = 0; i < buf_bytes; i++) { - buf[i] = sdbus_read_byte(&s->sdbus); - } + sdbus_read_data(&s->sdbus, buf, buf_bytes); cpu_physical_memory_write((desc->addr & DESC_SIZE_MASK) + num_done, buf, buf_bytes); } @@ -518,10 +516,8 @@ static uint64_t allwinner_sdhost_read(void *opaque, hwaddr offset, break; case REG_SD_FIFO: /* Read/Write FIFO */ if (sdbus_data_ready(&s->sdbus)) { - res = sdbus_read_byte(&s->sdbus); - res |= sdbus_read_byte(&s->sdbus) << 8; - res |= sdbus_read_byte(&s->sdbus) << 16; - res |= sdbus_read_byte(&s->sdbus) << 24; + sdbus_read_data(&s->sdbus, &res, sizeof(uint32_t)); + le32_to_cpus(&res); allwinner_sdhost_update_transfer_cnt(s, sizeof(uint32_t)); allwinner_sdhost_auto_stop(s); allwinner_sdhost_update_irq(s); |