From: sashiko-bot@kernel.org
To: "Nicolas Thibert" <nithibert@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: 8250_of: set UART_CAP_NOTEMT for rts-gpios RS485 direction
Date: Mon, 07 Sep 2026 15:37:31 +0000 [thread overview]
Message-ID: <20260907153732.089061F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907152744.1084359-1-nithibert@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The newly added UART_CAP_NOTEMT flag is either silently overwritten or causes the port to lose all of its default hardware capabilities.
--
commit 1d8dc615b4080d6f9bde37f54eafa34f59649ede
Author: Nicolas Thibert <nithibert@gmail.com>
serial: 8250_of: set UART_CAP_NOTEMT for rts-gpios RS485 direction
This patch sets UART_CAP_NOTEMT for RS485 ports using rts-gpios to prevent
the direction GPIO from getting stuck due to missing TEMT interrupts.
> diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
> index b1561c499acda..600a77e1e6143 100644
> --- a/drivers/tty/serial/8250/8250_of.c
> +++ b/drivers/tty/serial/8250/8250_of.c
> @@ -212,6 +212,22 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
> up->rs485_start_tx = serial8250_em485_start_tx;
> up->rs485_stop_tx = serial8250_em485_stop_tx;
>
> + /*
> + * This generic driver never enables a dedicated line-status
> + * interrupt on TEMT, so for ports whose RS485 direction is
> + * controlled via a GPIO (rts-gpios) rather than the native RTS
> + * pin, __stop_tx() (8250_port.c) can see THRE without TEMT on the
> + * last byte and bail out without ever retrying -- leaving the
> + * direction GPIO stuck asserted after the last byte sent, on
> + * hardware whose shift register doesn't reliably surface TEMT.
> + * UART_CAP_NOTEMT makes it fall back to a frame-time-based timer
> + * instead of waiting on that interrupt. Scoped to rts-gpios users
> + * only, to avoid changing timing for ports relying on the native
> + * RTS pin, which this has not been observed to affect.
> + */
> + if (of_property_present(np, "rts-gpios"))
> + up->capabilities |= UART_CAP_NOTEMT;
> +
> switch (type) {
[Severity: High]
If the device explicitly configures a FIFO size, does the caller overwrite
this newly added capability?
When of_platform_serial_probe() calls of_platform_serial_setup(), it does
this right after:
drivers/tty/serial/8250/8250_of.c:of_platform_serial_probe() {
...
ret = of_platform_serial_setup(ofdev, port_type, &port8250, info);
if (ret)
goto err_free;
if (port8250.port.fifosize)
port8250.capabilities = UART_CAP_FIFO;
...
}
Will this direct assignment completely erase the UART_CAP_NOTEMT flag?
Conversely, if the device does not specify a fifosize, port8250.capabilities
will be non-zero because it holds the UART_CAP_NOTEMT flag. Does this
cause the port to miss all its default hardware capabilities?
Later during registration, serial8250_set_defaults() checks if capabilities
is zero before assigning defaults:
drivers/tty/serial/8250/8250_port.c:serial8250_set_defaults() {
...
if (!up->capabilities)
up->capabilities = uart_config[port->type].flags;
...
}
Since up->capabilities is non-zero, this assignment is skipped entirely,
stripping the port of default features like UART_CAP_FIFO and UART_CAP_SLEEP.
Could we change the assignment in of_platform_serial_probe() to use |=,
and find a different way to merge UART_CAP_NOTEMT with the default flags?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260907152744.1084359-1-nithibert@gmail.com?part=1
next prev parent reply other threads:[~2026-09-07 15:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 15:27 [PATCH] serial: 8250_of: set UART_CAP_NOTEMT for rts-gpios RS485 direction Nicolas Thibert
2026-09-07 15:37 ` sashiko-bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-09-07 17:30 Nicolas Thibert
2026-09-07 17:36 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260907153732.089061F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=nithibert@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox