[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <355354ef-61ff-692d-aad-3b5721db420@linux.intel.com>
Date: Mon, 4 Jul 2022 12:51:28 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Lino Sanfilippo <LinoSanfilippo@....de>
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 Wunner <lukas@...ner.de>, p.rosenberger@...bus.com,
Lino Sanfilippo <l.sanfilippo@...bus.com>
Subject: Re: [PATCH v2 2/9] serial: core, 8250: set RS485 termination gpio
in serial core
On Sun, 3 Jul 2022, Lino Sanfilippo wrote:
> From: Lino Sanfilippo <l.sanfilippo@...bus.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@...bus.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.
--
i.
Powered by blists - more mailing lists