lkml.org 
[lkml]   [2021]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 1/2] tty/serial: Add rx-tx-swap OF option to stm32-usart
From
Date
On 3/1/21 11:28 AM, Fabrice Gasnier wrote:
> On 2/27/21 5:41 PM, Martin Devera wrote:
>> STM32 F7/H7 usarts supports RX & TX pin swapping.
>> Add option to turn it on.
>> Tested on STM32MP157.
>>
>> Signed-off-by: Martin Devera <devik@eaxlabs.cz>
>> ---
>> 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

\
 
 \ /
  Last update: 2021-03-02 15:11    [W:0.128 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site