Skip to content

Commit a39ab55

Browse files
maass-hamburgkartben
authored andcommitted
drivers: serial: litex: only ack tx event, when full
only ack tx event, when full, so we don't have to fill the fifo with zeros as a workaround. Signed-off-by: Fin Maaß <[email protected]>
1 parent 087cb96 commit a39ab55

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/serial/uart_litex.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,18 @@ static int uart_litex_fifo_fill(const struct device *dev,
189189
const struct uart_litex_device_config *config = dev->config;
190190
int i;
191191

192-
litex_write8(UART_EV_TX, config->ev_pending_addr);
193192
for (i = 0; i < size && !litex_read8(config->txfull_addr); i++) {
194193
litex_write8(tx_data[i], config->rxtx_addr);
195194
}
196-
while (!litex_read8(config->txfull_addr)) {
197-
litex_write8(0, config->rxtx_addr);
195+
196+
if (litex_read8(config->txfull_addr)) {
197+
/* only flush TX event if TX is really full */
198+
litex_write8(UART_EV_TX, config->ev_pending_addr);
199+
200+
/* fallback if we maybe missed the TX interrupt */
201+
while (!litex_read8(config->txfull_addr)) {
202+
litex_write8(0, config->rxtx_addr);
203+
}
198204
}
199205

200206
return i;

0 commit comments

Comments
 (0)