Skip to content

Commit b899997

Browse files
maass-hamburgmmahadevan108
authored andcommitted
drivers: spi: litex: add flush of rx buffer
this flushes the rx buffer before the start of a new transaction. It is needed because the litex bios is not always reading the rx buffer. Signed-off-by: Fin Maaß <[email protected]>
1 parent 6261e2a commit b899997

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/spi/spi_litex_litespi.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@ static int spi_litex_xfer(const struct device *dev, const struct spi_config *con
152152

153153
litex_write32(BIT(config->slave), dev_config->core_master_cs_addr);
154154

155+
/* Flush RX buffer */
156+
while ((litex_read8(dev_config->core_master_status_addr) &
157+
BIT(SPIFLASH_CORE_MASTER_STATUS_RX_READY_OFFSET))) {
158+
rxd = litex_read32(dev_config->core_master_rxtx_addr);
159+
LOG_DBG("flushed rxd: 0x%x", rxd);
160+
}
161+
155162
do {
156163
len = MIN(spi_context_max_continuous_chunk(ctx), dev_config->core_master_rxtx_size);
157164
if (len != old_len) {

0 commit comments

Comments
 (0)