lkml.org 
[lkml]   [2022]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 2/9] serial: core, 8250: set RS485 termination gpio in serial core
From


On 04.07.22 11:51, Ilpo Järvinen wrote:
> On Sun, 3 Jul 2022, Lino Sanfilippo wrote:
>
>> From: Lino Sanfilippo <l.sanfilippo@kunbus.com>
>>
>> In serial8250_em485_config() the termination GPIO is set with the uart_port
>> spinlock held. This is an issue if setting the GPIO line can sleep (e.g.
>> since the concerning GPIO expander is connected via SPI or I2C).
>>
>> Fix this by setting the termination line outside of the uart_port spinlock
>> in the serial core and using gpiod_set_value_cansleep() which instead of
>> gpiod_set_value() allows to sleep.
>>
>> Beside fixing the termination GPIO line setting for the 8250 driver this
>> change also makes setting the termination GPIO generic for all UART
>> drivers.
>>
>> Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
>> ---
>> drivers/tty/serial/8250/8250_port.c | 3 ---
>> drivers/tty/serial/serial_core.c | 12 ++++++++++++
>> 2 files changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
>> index ed2a606f2da7..72252d956f17 100644
>> --- a/drivers/tty/serial/8250/8250_port.c
>> +++ b/drivers/tty/serial/8250/8250_port.c
>> @@ -676,9 +676,6 @@ int serial8250_em485_config(struct uart_port *port, struct ktermios *termios,
>> rs485->flags &= ~SER_RS485_RTS_AFTER_SEND;
>> }
>>
>> - gpiod_set_value(port->rs485_term_gpio,
>> - rs485->flags & SER_RS485_TERMINATE_BUS);
>> -
>
> I sent a series to make .rs485_supported per uart_port and properly set
> SER_RS485_TERMINATE_BUS according to DT config. With that series added
> first, SER_RS485_TERMINATE_BUS should also be removed from
> serial8250_em485_supported so that serial core can properly manage
> it all.
>

Ok, I will rebase the next version of my patches on your series then.

Regards,
Lino

\
 
 \ /
  Last update: 2022-07-04 17:15    [W:0.229 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site