From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: NXP Linux Team <linux-imx@nxp.com>,
linux-serial <linux-serial@vger.kernel.org>,
kernel@pengutronix.de,
Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: Re: UART on MPC83xx in irq loop
Date: Mon, 17 Oct 2022 15:27:19 +0300 (EEST) [thread overview]
Message-ID: <97de1514-ecd4-68ae-2e9a-d821cb1c7b22@linux.intel.com> (raw)
In-Reply-To: <20221017094500.3wwd2njnao7rru4n@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]
On Mon, 17 Oct 2022, Uwe Kleine-König wrote:
> Hello,
>
> I have a system based on MPC8313ERDB here that in some situations gets
> stuck in an irq loop. I have a reproducer here that works reliably. A
> workaround is:
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 45b8a59d937c..5ab32b6ba701 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -2009,6 +2009,14 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
>
> status = serial_port_in(port, UART_LSR);
>
> + /*
> + * Sometimes a "Character time-out" (IID3:0 == 0xc) happens on MPC8313,
> + * but LSR doesn't report "Data ready". To clear the former the receive
> + * buffer must be read. It's unclear if the char read is valid or not.
> + */
> + if ((iir & UART_IIR_ID) == UART_IIR_RX_TIMEOUT)
> + status |= UART_LSR_DR;
> +
> /*
> * If port is stopped and there are no error conditions in the
> * FIFO, then don't drain the FIFO, as this may lead to TTY buffer
>
> I havn't debugged that further than written in the comment but I wonder
> if this is a known issue (didn't find it in the errata though) and/or if
> someone with hardware knowledge could confirm this to be a hardware
> fault.
>
> Without feedback from NXP I'd look in more detail into that to for
> example find out the timing and so maybe more hints about the hardware
> and a better SW workaround/fix.
>
> Any input is very welcome.
I find it bit odd you seem to assume w/o any justification that the data
would be valid (that workaround will read one byte and consider it
valid, no?). According to the comments & workarounds to the same problem
(just look for IIR_RX_TIMEOUT and you'll find a few), they all do dummy
reads rather than assume the data is valid.
--
i.
next prev parent reply other threads:[~2022-10-17 12:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 9:45 UART on MPC83xx in irq loop Uwe Kleine-König
2022-10-17 12:27 ` Ilpo Järvinen [this message]
2022-10-17 14:11 ` Uwe Kleine-König
2022-10-17 14:17 ` Ilpo Järvinen
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=97de1514-ecd4-68ae-2e9a-d821cb1c7b22@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=kernel@pengutronix.de \
--cc=linux-imx@nxp.com \
--cc=linux-serial@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
--cc=u.kleine-koenig@pengutronix.de \
/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