Re: [PATCH v2 1/2] tty/serial: Add rx-tx-swap OF option to stm32-usart
From: Martin DEVERA <hidden>
Date: 2021-03-02 07:32:03
Also in:
linux-devicetree, linux-serial, lkml
From: Martin DEVERA <hidden>
Date: 2021-03-02 07:32:03
Also in:
linux-devicetree, linux-serial, lkml
On 3/1/21 11:28 AM, Fabrice Gasnier wrote:
On 2/27/21 5:41 PM, Martin Devera wrote:quoted
STM32 F7/H7 usarts supports RX & TX pin swapping. Add option to turn it on. Tested on STM32MP157. Signed-off-by: Martin Devera <redacted> --- drivers/tty/serial/stm32-usart.c | 3 ++- drivers/tty/serial/stm32-usart.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index b3675cf25a69..3650c8798061 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c@@ -758,7 +758,7 @@ static void stm32_usart_set_termios(struct uart_port *port, cr1 = USART_CR1_TE | USART_CR1_RE; if (stm32_port->fifoen) cr1 |= USART_CR1_FIFOEN; - cr2 = 0; + cr2 = stm32_port->swap ? USART_CR2_SWAP : 0;Hi Martin, Same could be done in the startup routine, that enables the port for reception (as described in Documentation/driver-api/serial/driver.rst)
Hello Fabrice, I already incorporated all your comments but I'm struggling with the one above. The code must be in stm32_usart_set_termios too, because CR2 is modified. What is the reason to have it in startup() ? Is it because USART can be started without calling set_termios at all ? Like to reuse bootloader's last settings ? Thanks, Martin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel