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, "Fabio Estevam" <festevam@denx.de>,
"Tim Harvey" <tharvey@gateworks.com>,
"Pali Rohár" <pali@kernel.org>
Subject: [PATCH] serial: mxc: Wait until TX FIFO is not full
Date: Tue, 25 Oct 2022 18:31:36 -0300 [thread overview]
Message-ID: <20221025213136.873709-1-festevam@gmail.com> (raw)
From: Fabio Estevam <festevam@denx.de>
Tim Harvey reported the console garbage on imx6 since
commit c7878a0483c5 ("serial: mxc: have putc use the TXFIFO").
Do as suggested by Pali Rohár where the the driver should
not return -EAGAIN when the TX FIFO is full.
It should keep waiting until the TX FIFO is no longer full.
This also aligns with the implementation of the imx serial driver
in the kernel:
static void imx_uart_console_putchar(struct uart_port *port, unsigned char ch)
{
struct imx_port *sport = (struct imx_port *)port;
while (imx_uart_readl(sport, imx_uart_uts_reg(sport)) & UTS_TXFULL)
barrier();
imx_uart_writel(sport, ch, URTX0);
}
Fixes: c7878a0483c5 ("serial: mxc: have putc use the TXFIFO")
Reported-by: Tim Harvey <tharvey@gateworks.com>
Suggested-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
drivers/serial/serial_mxc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 4cf79c1ca24f..332219fa87fc 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -311,8 +311,8 @@ 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)
- return -EAGAIN;
+ while (readl(&uart->ts) & UTS_TXFULL)
+ barrier();
writel(ch, &uart->txd);
--
2.25.1
next reply other threads:[~2022-10-25 21:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-25 21:31 Fabio Estevam [this message]
2022-10-26 17:08 ` [PATCH] serial: mxc: Wait until TX FIFO is not full Michael Nazzareno Trimarchi
2022-10-26 17:35 ` Sean Anderson
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=20221025213136.873709-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