Skip to content

Commit 56a23f9

Browse files
VCASTMgregkh
authored andcommitted
serial: stm32: move tx dma terminate DMA to shutdown
Terminate DMA transaction and clear CR3_DMAT when shutdown is requested, instead of when remove is requested. If DMA transfer is not stopped in shutdown ops, driver will fail to start a new DMA transfer after next startup ops. Fixes: 3489187 ("serial: stm32: adding dma support") Signed-off-by: Erwan Le Ray <[email protected]> Signed-off-by: Valentin Caron <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 49a8042 commit 56a23f9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/tty/serial/stm32-usart.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,11 @@ static void stm32_usart_shutdown(struct uart_port *port)
883883
u32 val, isr;
884884
int ret;
885885

886+
if (stm32_port->tx_dma_busy) {
887+
dmaengine_terminate_async(stm32_port->tx_ch);
888+
stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAT);
889+
}
890+
886891
/* Disable modem control interrupts */
887892
stm32_usart_disable_ms(port);
888893

@@ -1570,7 +1575,6 @@ static int stm32_usart_serial_remove(struct platform_device *pdev)
15701575
writel_relaxed(cr3, port->membase + ofs->cr3);
15711576

15721577
if (stm32_port->tx_ch) {
1573-
dmaengine_terminate_async(stm32_port->tx_ch);
15741578
stm32_usart_of_dma_tx_remove(stm32_port, pdev);
15751579
dma_release_channel(stm32_port->tx_ch);
15761580
}

0 commit comments

Comments
 (0)