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

Hi,

On 25.06.22 at 12:40, Ilpo Järvinen wrote:
>> +
>> int uart_rs485_config(struct uart_port *port)
>> {
>> struct serial_rs485 *rs485 = &port->rs485;
>> int ret;
>>
>> uart_sanitize_serial_rs485(port, rs485);
>> + uart_set_rs485_termination(port, rs485);
>>
>> ret = port->rs485_config(port, rs485);
>> if (ret)
>> @@ -1400,6 +1411,7 @@ static int uart_set_rs485_config(struct uart_port *port,
>> if (ret)
>> return ret;
>> uart_sanitize_serial_rs485(port, &rs485);
>> + uart_set_rs485_termination(port, &rs485);
>>
>> spin_lock_irqsave(&port->lock, flags);
>> ret = port->rs485_config(port, &rs485);
>
> When port->rs485_config(port, &rs485) returns non-zero, the input got
> partially applied?
>
>
The thing is we dont know what the state of the termination GPIO (asserted or deasserted)
was before we set it and port->rs485_config() failed, so we cannot restore it.
We could read the GPIO before we change it but AFAIK this is unsafe since it is an output
pin. Maybe add a boolean variable "rs485_termination_gpio_asserted" to uart_port to track the
current state?


Regards,
Lino



\
 
 \ /
  Last update: 2022-06-26 17:43    [W:0.171 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site