summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/stm32-usart.h
diff options
context:
space:
mode:
authorValentin Caron <valentin.caron@foss.st.com>2022-01-04 19:24:43 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-06 15:58:46 +0100
commit9a135f16d228857c5c1212a58050196883343d1e (patch)
treeec5a72138a714b95f3c5b2154cf6979b6d520b23 /drivers/tty/serial/stm32-usart.h
parent56a23f9319e86e1d62a109896e2c7e52c414e67d (diff)
downloadlinux-stable-9a135f16d228857c5c1212a58050196883343d1e.tar.gz
linux-stable-9a135f16d228857c5c1212a58050196883343d1e.tar.bz2
linux-stable-9a135f16d228857c5c1212a58050196883343d1e.zip
serial: stm32: rework TX DMA state condition
TX DMA state condition is handled by tx_dma_busy boolean. This boolean is set when dma descriptor is requested and reset when dma channel is stopped (dma_terminate). In stm32_usart_serial_remove(), stm32_usart_stop_tx() and stm32_usart_transmit_chars_dma() fallback error case, DMA channel is stopped but tx_dma_busy is not handled. Rework the driver by using two new functions to solve this issue: - stm32_usart_tx_dma_started return true if DMA TX have a descriptor. - stm32_usart_tx_dma_enabled return true if DMAT bit is set. stm32_usart_tx_dma_started uses tx_dma_busy flag to prevent dual DMA transaction at the same time. This flag is set when a DMA transaction begins and is unset when dmaengine_terminate_async function is called. A new DMA transaction cannot be created if this flag is set. Create a new function "stm32_usart_tx_dma_terminate" to be sure the flag is unset after each call of dmaengine_terminate_async. Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com> Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> Link: https://lore.kernel.org/r/20220104182445.4195-3-valentin.caron@foss.st.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/stm32-usart.h')
-rw-r--r--drivers/tty/serial/stm32-usart.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h
index e23916bfbb60..feab952aec16 100644
--- a/drivers/tty/serial/stm32-usart.h
+++ b/drivers/tty/serial/stm32-usart.h
@@ -264,7 +264,7 @@ struct stm32_port {
u32 cr1_irq; /* USART_CR1_RXNEIE or RTOIE */
u32 cr3_irq; /* USART_CR3_RXFTIE */
int last_res;
- bool tx_dma_busy; /* dma tx busy */
+ bool tx_dma_busy; /* dma tx transaction in progress */
bool throttled; /* port throttled */
bool hw_flow_control;
bool swap; /* swap RX & TX pins */