serial: stm32: add support for "flush_buffer" ops
Add the support for "flush_buffer" ops in order to flush any write buffers, reset any DMA state and stop any ongoing DMA transfers when the port->state->xmit circular buffer is cleared. Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com> Link: https://lore.kernel.org/r/20210304162308.8984-14-erwan.leray@foss.st.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3db1d52466
commit
3d82be8be6
@ -597,6 +597,19 @@ static void stm32_usart_start_tx(struct uart_port *port)
|
|||||||
stm32_usart_transmit_chars(port);
|
stm32_usart_transmit_chars(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Flush the transmit buffer. */
|
||||||
|
static void stm32_usart_flush_buffer(struct uart_port *port)
|
||||||
|
{
|
||||||
|
struct stm32_port *stm32_port = to_stm32_port(port);
|
||||||
|
const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
|
||||||
|
|
||||||
|
if (stm32_port->tx_ch) {
|
||||||
|
dmaengine_terminate_async(stm32_port->tx_ch);
|
||||||
|
stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAT);
|
||||||
|
stm32_port->tx_dma_busy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Throttle the remote when input buffer is about to overflow. */
|
/* Throttle the remote when input buffer is about to overflow. */
|
||||||
static void stm32_usart_throttle(struct uart_port *port)
|
static void stm32_usart_throttle(struct uart_port *port)
|
||||||
{
|
{
|
||||||
@ -992,6 +1005,7 @@ static const struct uart_ops stm32_uart_ops = {
|
|||||||
.break_ctl = stm32_usart_break_ctl,
|
.break_ctl = stm32_usart_break_ctl,
|
||||||
.startup = stm32_usart_startup,
|
.startup = stm32_usart_startup,
|
||||||
.shutdown = stm32_usart_shutdown,
|
.shutdown = stm32_usart_shutdown,
|
||||||
|
.flush_buffer = stm32_usart_flush_buffer,
|
||||||
.set_termios = stm32_usart_set_termios,
|
.set_termios = stm32_usart_set_termios,
|
||||||
.pm = stm32_usart_pm,
|
.pm = stm32_usart_pm,
|
||||||
.type = stm32_usart_type,
|
.type = stm32_usart_type,
|
||||||
|
Loading…
Reference in New Issue
Block a user