From: Fabio Estevam <festevam@gmail.com>
To: sbabic@denx.de
Cc: uboot-imx@nxp.com, johannes.schneider@leica-geosystems.com,
u-boot@lists.denx.de, pali@kernel.org,
Fabio Estevam <festevam@denx.de>,
Tim Harvey <tharvey@gateworks.com>
Subject: [PATCH v2] serial: mxc: Keep the original FIFO empty check
Date: Tue, 25 Oct 2022 19:56:57 -0300 [thread overview]
Message-ID: <20221025225657.904240-1-festevam@gmail.com> (raw)
From: Fabio Estevam <festevam@denx.de>
Tim Harvey reported that since commit c7878a0483c5 ("serial: mxc:
have putc use the TXFIFO"), console messages put inside board_init()
are no longer printed correctly.
This change added a check to handle the UART FIFO full condition and
removed the UART FIFO empty check, which causes the problem.
To avoid console corruption, add back the original UART FIFO empty
check so that when the FIFO is empty, mxc_serial_putc() returns -EAGAIN
to the core serial-uclass.c.
This way the serial core can properly handle the UART empty condition
by not doing character transmission when -EAGAIN is returned.
Fixes: c7878a0483c5 ("serial: mxc: have putc use the TXFIFO")
Reported-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- Add the check for FIFO full and FIFO empty.
drivers/serial/serial_mxc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 4cf79c1ca24f..d3fbe76065ec 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -311,7 +311,7 @@ static int mxc_serial_putc(struct udevice *dev, const char ch)
struct mxc_serial_plat *plat = dev_get_plat(dev);
struct mxc_uart *const uart = plat->reg;
- if (readl(&uart->ts) & UTS_TXFULL)
+ if ((readl(&uart->ts) & UTS_TXFULL) || !(readl(&uart->ts) & UTS_TXEMPTY))
return -EAGAIN;
writel(ch, &uart->txd);
--
2.25.1
next reply other threads:[~2022-10-25 22:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-25 22:56 Fabio Estevam [this message]
2022-10-25 23:23 ` [PATCH v2] serial: mxc: Keep the original FIFO empty check Tim Harvey
2022-10-26 0:17 ` Fabio Estevam
2022-10-26 6:15 ` Michael Nazzareno Trimarchi
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=20221025225657.904240-1-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=festevam@denx.de \
--cc=johannes.schneider@leica-geosystems.com \
--cc=pali@kernel.org \
--cc=sbabic@denx.de \
--cc=tharvey@gateworks.com \
--cc=u-boot@lists.denx.de \
--cc=uboot-imx@nxp.com \
/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