@@ -166,7 +166,15 @@ int sdbus_do_command(SDBus *sd, SDRequest *req, uint8_t *response);
* 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);
+/**
+ * Read a byte from a SD bus.
+ * @sd: bus
+ *
+ * Read a byte from the data lines of a SD bus.
+ *
+ * Return: byte value read
+ */
+uint8_t sdbus_read_byte(SDBus *sd);
bool sdbus_data_ready(SDBus *sd);
bool sdbus_get_inserted(SDBus *sd);
bool sdbus_get_readonly(SDBus *sd);
@@ -341,7 +341,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_data(&s->sdbus);
+ buf[i] = sdbus_read_byte(&s->sdbus);
}
cpu_physical_memory_write((desc->addr & DESC_SIZE_MASK) + num_done,
buf, buf_bytes);
@@ -521,10 +521,10 @@ 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_data(&s->sdbus);
- res |= sdbus_read_data(&s->sdbus) << 8;
- res |= sdbus_read_data(&s->sdbus) << 16;
- res |= sdbus_read_data(&s->sdbus) << 24;
+ 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;
allwinner_sdhost_update_transfer_cnt(s, sizeof(uint32_t));
allwinner_sdhost_auto_stop(s);
allwinner_sdhost_update_irq(s);
@@ -190,7 +190,7 @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s)
if (is_read) {
n = 0;
while (s->datacnt && s->fifo_len < BCM2835_SDHOST_FIFO_LEN) {
- value |= (uint32_t)sdbus_read_data(&s->sdbus) << (n * 8);
+ value |= (uint32_t)sdbus_read_byte(&s->sdbus) << (n * 8);
s->datacnt--;
n++;
if (n == 4) {
@@ -114,7 +114,7 @@ void sdbus_write_byte(SDBus *sdbus, uint8_t value)
}
}
-uint8_t sdbus_read_data(SDBus *sdbus)
+uint8_t sdbus_read_byte(SDBus *sdbus)
{
SDState *card = get_card(sdbus);
uint8_t value = 0;
@@ -152,10 +152,10 @@ static uint64_t memcard_read(void *opaque, hwaddr addr,
r = 0xffffffff;
} else {
r = 0;
- r |= sdbus_read_data(&s->sdbus) << 24;
- r |= sdbus_read_data(&s->sdbus) << 16;
- r |= sdbus_read_data(&s->sdbus) << 8;
- r |= sdbus_read_data(&s->sdbus);
+ r |= sdbus_read_byte(&s->sdbus) << 24;
+ r |= sdbus_read_byte(&s->sdbus) << 16;
+ r |= sdbus_read_byte(&s->sdbus) << 8;
+ r |= sdbus_read_byte(&s->sdbus);
}
break;
case R_CLK2XDIV:
@@ -223,7 +223,7 @@ static void pl181_fifo_run(PL181State *s)
if (is_read) {
n = 0;
while (s->datacnt && s->fifo_len < PL181_FIFO_LEN) {
- value |= (uint32_t)sdbus_read_data(&s->sdbus) << (n * 8);
+ value |= (uint32_t)sdbus_read_byte(&s->sdbus) << (n * 8);
s->datacnt--;
n++;
if (n == 4) {
@@ -194,7 +194,7 @@ static void pxa2xx_mmci_fifo_update(PXA2xxMMCIState *s)
} else
while (s->bytesleft && s->rx_len < 32) {
s->rx_fifo[(s->rx_start + (s->rx_len ++)) & 0x1f] =
- sdbus_read_data(&s->sdbus);
+ sdbus_read_byte(&s->sdbus);
s->bytesleft --;
s->intreq |= INT_RXFIFO_REQ;
}
@@ -409,7 +409,7 @@ static void sdhci_read_block_from_card(SDHCIState *s)
}
for (index = 0; index < blk_size; index++) {
- data = sdbus_read_data(&s->sdbus);
+ data = sdbus_read_byte(&s->sdbus);
if (!FIELD_EX32(s->hostctl2, SDHC_HOSTCTL2, EXECUTE_TUNING)) {
/* Device is not in tuning */
s->fifo_buffer[index] = data;
@@ -601,7 +601,7 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s)
while (s->blkcnt) {
if (s->data_count == 0) {
for (n = 0; n < block_size; n++) {
- s->fifo_buffer[n] = sdbus_read_data(&s->sdbus);
+ s->fifo_buffer[n] = sdbus_read_byte(&s->sdbus);
}
}
begin = s->data_count;
@@ -673,7 +673,7 @@ static void sdhci_sdma_transfer_single_block(SDHCIState *s)
if (s->trnmod & SDHC_TRNS_READ) {
for (n = 0; n < datacnt; n++) {
- s->fifo_buffer[n] = sdbus_read_data(&s->sdbus);
+ s->fifo_buffer[n] = sdbus_read_byte(&s->sdbus);
}
dma_memory_write(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt);
} else {
@@ -774,7 +774,7 @@ static void sdhci_do_adma(SDHCIState *s)
while (length) {
if (s->data_count == 0) {
for (n = 0; n < block_size; n++) {
- s->fifo_buffer[n] = sdbus_read_data(&s->sdbus);
+ s->fifo_buffer[n] = sdbus_read_byte(&s->sdbus);
}
}
begin = s->data_count;
@@ -190,7 +190,7 @@ static uint32_t ssi_sd_transfer(SSISlave *dev, uint32_t val)
s->mode = SSI_SD_DATA_READ;
return 0xfe;
case SSI_SD_DATA_READ:
- val = sdbus_read_data(&s->sdbus);
+ val = sdbus_read_byte(&s->sdbus);
if (!sdbus_data_ready(&s->sdbus)) {
DPRINTF("Data read end\n");
s->mode = SSI_SD_CMD;