[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aa851698-ff26-a319-500a-575a9c669d95@gmx.de>
Date: Sun, 26 Jun 2022 17:41:35 +0200
From: Lino Sanfilippo <LinoSanfilippo@....de>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
vz@...ia.com, linux-arm-kernel@...ts.infradead.org,
devicetree@...r.kernel.org,
linux-serial <linux-serial@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, lukas@...ner.de,
p.rosenberger@...bus.com, Lino Sanfilippo <l.sanfilippo@...bus.com>
Subject: Re: [PATCH 2/8] serial: core, 8250: set RS485 termination gpio in
serial core
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
Powered by blists - more mailing lists