[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <019b62e9-ec9b-d366-ee77-59c980d66a07@foss.st.com>
Date: Tue, 2 Mar 2021 11:20:07 +0100
From: Fabrice Gasnier <fabrice.gasnier@...s.st.com>
To: Martin DEVERA <devik@...labs.cz>, <linux-kernel@...r.kernel.org>
CC: <devicetree@...r.kernel.org>,
Alexandre Torgue <alexandre.torgue@...com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
<linux-serial@...r.kernel.org>, Jiri Slaby <jirislaby@...nel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
Le Ray <erwan.leray@...com>
Subject: Re: [PATCH v2 1/2] tty/serial: Add rx-tx-swap OF option to
stm32-usart
On 3/1/21 11:40 PM, Martin DEVERA wrote:
> 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@...labs.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.
Hi Martin,
Yes, sure,
> What is the reason to have it in startup() ?
RX is enabled at both places. So the swap setting should be there too.
> Is it because USART can be started without calling set_termios at all ?
Yes, that's what the driver API expects: "startup(port)" ... "Enable the
port for reception."
Best Regards,
Fabrice
> Like
> to reuse bootloader's last settings ?
>
> Thanks, Martin
>
Powered by blists - more mailing lists