diff options
author | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2020-08-14 11:23:41 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2020-08-21 16:35:35 +0200 |
commit | 39017143d6d7a068573da272528d7df71d0d31b4 (patch) | |
tree | 4f81026994f8c93587ece9ab05a83533ca755f77 | |
parent | c769a88d4475f648595c6a270d9d0b0f3f7f3740 (diff) | |
download | qemu-39017143d6d7a068573da272528d7df71d0d31b4.zip qemu-39017143d6d7a068573da272528d7df71d0d31b4.tar.gz qemu-39017143d6d7a068573da272528d7df71d0d31b4.tar.bz2 |
hw/sd: Rename sdbus_write_data() as sdbus_write_byte()
The sdbus_write_data() method do a single byte access on the data
line of a SD bus. Rename it as sdbus_write_byte() and document it.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200814092346.21825-3-f4bug@amsat.org>
-rw-r--r-- | hw/sd/allwinner-sdhost.c | 10 | ||||
-rw-r--r-- | hw/sd/bcm2835_sdhost.c | 2 | ||||
-rw-r--r-- | hw/sd/core.c | 2 | ||||
-rw-r--r-- | hw/sd/milkymist-memcard.c | 8 | ||||
-rw-r--r-- | hw/sd/pl181.c | 2 | ||||
-rw-r--r-- | hw/sd/pxa2xx_mmci.c | 2 | ||||
-rw-r--r-- | hw/sd/sdhci.c | 8 | ||||
-rw-r--r-- | include/hw/sd/sd.h | 9 |
8 files changed, 25 insertions, 18 deletions
diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c index f404e1f..e05e8a3 100644 --- a/hw/sd/allwinner-sdhost.c +++ b/hw/sd/allwinner-sdhost.c @@ -335,7 +335,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, buf, buf_bytes); for (uint32_t i = 0; i < buf_bytes; i++) { - sdbus_write_data(&s->sdbus, buf[i]); + sdbus_write_byte(&s->sdbus, buf[i]); } /* Read from SD bus */ @@ -654,10 +654,10 @@ static void allwinner_sdhost_write(void *opaque, hwaddr offset, s->startbit_detect = value; break; case REG_SD_FIFO: /* Read/Write FIFO */ - sdbus_write_data(&s->sdbus, value & 0xff); - sdbus_write_data(&s->sdbus, (value >> 8) & 0xff); - sdbus_write_data(&s->sdbus, (value >> 16) & 0xff); - sdbus_write_data(&s->sdbus, (value >> 24) & 0xff); + 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)); allwinner_sdhost_auto_stop(s); allwinner_sdhost_update_irq(s); diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c index 4a80fbc..16aba7c 100644 --- a/hw/sd/bcm2835_sdhost.c +++ b/hw/sd/bcm2835_sdhost.c @@ -223,7 +223,7 @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) } n--; s->datacnt--; - sdbus_write_data(&s->sdbus, value & 0xff); + sdbus_write_byte(&s->sdbus, value & 0xff); value >>= 8; } } diff --git a/hw/sd/core.c b/hw/sd/core.c index 79d9657..13b5ca0 100644 --- a/hw/sd/core.c +++ b/hw/sd/core.c @@ -102,7 +102,7 @@ int sdbus_do_command(SDBus *sdbus, SDRequest *req, uint8_t *response) return 0; } -void sdbus_write_data(SDBus *sdbus, uint8_t value) +void sdbus_write_byte(SDBus *sdbus, uint8_t value) { SDState *card = get_card(sdbus); diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index e9f5db5..4128109 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -209,10 +209,10 @@ static void memcard_write(void *opaque, hwaddr addr, uint64_t value, if (!s->enabled) { break; } - sdbus_write_data(&s->sdbus, (value >> 24) & 0xff); - sdbus_write_data(&s->sdbus, (value >> 16) & 0xff); - sdbus_write_data(&s->sdbus, (value >> 8) & 0xff); - sdbus_write_data(&s->sdbus, value & 0xff); + sdbus_write_byte(&s->sdbus, (value >> 24) & 0xff); + sdbus_write_byte(&s->sdbus, (value >> 16) & 0xff); + sdbus_write_byte(&s->sdbus, (value >> 8) & 0xff); + sdbus_write_byte(&s->sdbus, value & 0xff); break; case R_ENABLE: s->regs[addr] = value; diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 574500c..771bae1 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -244,7 +244,7 @@ static void pl181_fifo_run(PL181State *s) } n--; s->datacnt--; - sdbus_write_data(&s->sdbus, value & 0xff); + sdbus_write_byte(&s->sdbus, value & 0xff); value >>= 8; } } diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 2996a2e..07ddc2e 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -184,7 +184,7 @@ static void pxa2xx_mmci_fifo_update(PXA2xxMMCIState *s) if (s->cmdat & CMDAT_WR_RD) { while (s->bytesleft && s->tx_len) { - sdbus_write_data(&s->sdbus, s->tx_fifo[s->tx_start++]); + sdbus_write_byte(&s->sdbus, s->tx_fifo[s->tx_start++]); s->tx_start &= 0x1f; s->tx_len --; s->bytesleft --; diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index deac181..4bf1ee8 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -515,7 +515,7 @@ static void sdhci_write_block_to_card(SDHCIState *s) } for (index = 0; index < (s->blksize & BLOCK_SIZE_MASK); index++) { - sdbus_write_data(&s->sdbus, s->fifo_buffer[index]); + sdbus_write_byte(&s->sdbus, s->fifo_buffer[index]); } /* Next data can be written through BUFFER DATORT register */ @@ -642,7 +642,7 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s) s->sdmasysad += s->data_count - begin; if (s->data_count == block_size) { for (n = 0; n < block_size; n++) { - sdbus_write_data(&s->sdbus, s->fifo_buffer[n]); + sdbus_write_byte(&s->sdbus, s->fifo_buffer[n]); } s->data_count = 0; if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { @@ -679,7 +679,7 @@ static void sdhci_sdma_transfer_single_block(SDHCIState *s) } else { dma_memory_read(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt); for (n = 0; n < datacnt; n++) { - sdbus_write_data(&s->sdbus, s->fifo_buffer[n]); + sdbus_write_byte(&s->sdbus, s->fifo_buffer[n]); } } s->blkcnt--; @@ -815,7 +815,7 @@ static void sdhci_do_adma(SDHCIState *s) dscr.addr += s->data_count - begin; if (s->data_count == block_size) { for (n = 0; n < block_size; n++) { - sdbus_write_data(&s->sdbus, s->fifo_buffer[n]); + sdbus_write_byte(&s->sdbus, s->fifo_buffer[n]); } s->data_count = 0; if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index b58b5a1..1e5ac95 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -158,7 +158,14 @@ void sdbus_set_voltage(SDBus *sdbus, uint16_t millivolts); uint8_t sdbus_get_dat_lines(SDBus *sdbus); bool sdbus_get_cmd_line(SDBus *sdbus); int sdbus_do_command(SDBus *sd, SDRequest *req, uint8_t *response); -void sdbus_write_data(SDBus *sd, uint8_t value); +/** + * Write a byte to a SD bus. + * @sd: bus + * @value: byte to write + * + * Write a byte on the data lines of a SD bus. + */ +void sdbus_write_byte(SDBus *sd, uint8_t value); uint8_t sdbus_read_data(SDBus *sd); bool sdbus_data_ready(SDBus *sd); bool sdbus_get_inserted(SDBus *sd); |