Re: [PATCH v2 1/2] tty/serial: Add rx-tx-swap OF option to stm32-usart

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
>>> ---
>>>   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
> 



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux