stm32-usart.c (48ee4835b73c48590d05a54730dc8037ebd39d3b) stm32-usart.c (d3d079bde07e1b7deaeb57506dc0b86010121d17)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) Maxime Coquelin 2015
4 * Copyright (C) STMicroelectronics SA 2017
5 * Authors: Maxime Coquelin <mcoquelin.stm32@gmail.com>
6 * Gerald Baeza <gerald.baeza@foss.st.com>
7 * Erwan Le Ray <erwan.leray@foss.st.com>
8 *

--- 536 unchanged lines hidden (view full) ---

545 stm32_usart_transmit_chars_pio(port);
546}
547
548static void stm32_usart_transmit_chars(struct uart_port *port)
549{
550 struct stm32_port *stm32_port = to_stm32_port(port);
551 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
552 struct circ_buf *xmit = &port->state->xmit;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) Maxime Coquelin 2015
4 * Copyright (C) STMicroelectronics SA 2017
5 * Authors: Maxime Coquelin <mcoquelin.stm32@gmail.com>
6 * Gerald Baeza <gerald.baeza@foss.st.com>
7 * Erwan Le Ray <erwan.leray@foss.st.com>
8 *

--- 536 unchanged lines hidden (view full) ---

545 stm32_usart_transmit_chars_pio(port);
546}
547
548static void stm32_usart_transmit_chars(struct uart_port *port)
549{
550 struct stm32_port *stm32_port = to_stm32_port(port);
551 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
552 struct circ_buf *xmit = &port->state->xmit;
553 u32 isr;
554 int ret;
553
554 if (port->x_char) {
555 if (stm32_usart_tx_dma_started(stm32_port) &&
556 stm32_usart_tx_dma_enabled(stm32_port))
557 stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAT);
555
556 if (port->x_char) {
557 if (stm32_usart_tx_dma_started(stm32_port) &&
558 stm32_usart_tx_dma_enabled(stm32_port))
559 stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAT);
560
561 /* Check that TDR is empty before filling FIFO */
562 ret =
563 readl_relaxed_poll_timeout_atomic(port->membase + ofs->isr,
564 isr,
565 (isr & USART_SR_TXE),
566 10, 1000);
567 if (ret)
568 dev_warn(port->dev, "1 character may be erased\n");
569
558 writel_relaxed(port->x_char, port->membase + ofs->tdr);
559 port->x_char = 0;
560 port->icount.tx++;
561 if (stm32_usart_tx_dma_started(stm32_port))
562 stm32_usart_set_bits(port, ofs->cr3, USART_CR3_DMAT);
563 return;
564 }
565

--- 1327 unchanged lines hidden ---
570 writel_relaxed(port->x_char, port->membase + ofs->tdr);
571 port->x_char = 0;
572 port->icount.tx++;
573 if (stm32_usart_tx_dma_started(stm32_port))
574 stm32_usart_set_bits(port, ofs->cr3, USART_CR3_DMAT);
575 return;
576 }
577

--- 1327 unchanged lines hidden ---