From abf284e9fdae844196c4ae6740aaf18aaec4f59c Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 24 Apr 2017 13:58:21 +0300 Subject: [PATCH] Revert "serial: stm32: Give H/W a chance to set the TXE bit on transfer" Don't busy-wait in uart_stm32_fifo_fill(), this routine is supposed to be called on IRQ, and the waiting loop was shown to interfere with interrupt-driven UART handling. The original problem mentioned in the patch being reverted ("it is possible to evaluate the TXE bit *before* H/W has had the opportunity to detect that data is being processed") may still exist and may require handling in a different way. The most obvious way is to replace "while" loop with "if", because STM32 doesn't have multi-level FIFO anyway. But I was dissuaded to include such a change as part of this patch, so it's left for future analysis. This reverts commit 49c2858d946e972f8a67530be869c520722561ab. Change-Id: Ib27b53ba3a29b84c1a2dccff6d33f4118680cc19 Signed-off-by: Paul Sokolovsky --- drivers/serial/uart_stm32.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c index 881ed1676bb..bd615e0f26f 100644 --- a/drivers/serial/uart_stm32.c +++ b/drivers/serial/uart_stm32.c @@ -95,13 +95,6 @@ static int uart_stm32_fifo_fill(struct device *dev, const u8_t *tx_data, #else LL_USART_TransmitData8(UartHandle->Instance, tx_data[num_tx++]); #endif - /* - * Wait for H/W to set TXE flag, or else it will be evaluated - * again at the top of this loop *before* H/W has chance to - * initially detect that data is being processed. - */ - while (!__HAL_UART_GET_FLAG(UartHandle, UART_FLAG_TXE)) - ; } return num_tx;