stm32-usart.c (f4518a8a75f5be1a121b0c95ad9c6b1eb27d920e) stm32-usart.c (f264c6f6aece81a9f8fbdf912b20bd3feb476a7a)
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 *

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

733{
734 struct stm32_port *stm32_port = to_stm32_port(port);
735 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
736 const struct stm32_usart_config *cfg = &stm32_port->info->cfg;
737 struct serial_rs485 *rs485conf = &port->rs485;
738 unsigned int baud, bits;
739 u32 usartdiv, mantissa, fraction, oversampling;
740 tcflag_t cflag = termios->c_cflag;
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 *

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

733{
734 struct stm32_port *stm32_port = to_stm32_port(port);
735 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
736 const struct stm32_usart_config *cfg = &stm32_port->info->cfg;
737 struct serial_rs485 *rs485conf = &port->rs485;
738 unsigned int baud, bits;
739 u32 usartdiv, mantissa, fraction, oversampling;
740 tcflag_t cflag = termios->c_cflag;
741 u32 cr1, cr2, cr3;
741 u32 cr1, cr2, cr3, isr;
742 unsigned long flags;
742 unsigned long flags;
743 int ret;
743
744 if (!stm32_port->hw_flow_control)
745 cflag &= ~CRTSCTS;
746
747 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 8);
748
749 spin_lock_irqsave(&port->lock, flags);
750
744
745 if (!stm32_port->hw_flow_control)
746 cflag &= ~CRTSCTS;
747
748 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 8);
749
750 spin_lock_irqsave(&port->lock, flags);
751
752 ret = readl_relaxed_poll_timeout_atomic(port->membase + ofs->isr,
753 isr,
754 (isr & USART_SR_TC),
755 10, 100000);
756
757 /* Send the TC error message only when ISR_TC is not set. */
758 if (ret)
759 dev_err(port->dev, "Transmission is not complete\n");
760
751 /* Stop serial port and reset value */
752 writel_relaxed(0, port->membase + ofs->cr1);
753
754 /* flush RX & TX FIFO */
755 if (ofs->rqr != UNDEF_REG)
756 stm32_usart_set_bits(port, ofs->rqr,
757 USART_RQR_TXFRQ | USART_RQR_RXFRQ);
758

--- 838 unchanged lines hidden ---
761 /* Stop serial port and reset value */
762 writel_relaxed(0, port->membase + ofs->cr1);
763
764 /* flush RX & TX FIFO */
765 if (ofs->rqr != UNDEF_REG)
766 stm32_usart_set_bits(port, ofs->rqr,
767 USART_RQR_TXFRQ | USART_RQR_RXFRQ);
768

--- 838 unchanged lines hidden ---