public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] serial: mxc: Speed-up character transmission
@ 2023-01-09 14:59 Loic Poulain
  2023-01-10  6:46 ` Lothar Waßmann
  0 siblings, 1 reply; 3+ messages in thread
From: Loic Poulain @ 2023-01-09 14:59 UTC (permalink / raw)
  To: sbabic, festevam; +Cc: u-boot, uboot-imx, Loic Poulain

Instead of waiting for empty FIFO condition before writing a
character, wait for non-full FIFO condition.

This helps in saving several tens of milliseconds during boot
(depending verbosity).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/serial/serial_mxc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 82c0d84628..f8c49865be 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -223,11 +223,11 @@ static void mxc_serial_putc(const char c)
 	if (c == '\n')
 		serial_putc('\r');
 
-	writel(c, &mxc_base->txd);
-
 	/* wait for transmitter to be ready */
-	while (!(readl(&mxc_base->ts) & UTS_TXEMPTY))
+	while (readl(&mxc_base->ts) & UTS_TXFULL)
 		schedule();
+
+	writel(c, &mxc_base->txd);
 }
 
 /* Test whether a character is in the RX buffer */
@@ -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_TXEMPTY))
+	if (readl(&uart->ts) & UTS_TXFULL)
 		return -EAGAIN;
 
 	writel(ch, &uart->txd);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-10 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-09 14:59 [PATCH] serial: mxc: Speed-up character transmission Loic Poulain
2023-01-10  6:46 ` Lothar Waßmann
2023-01-10 12:21   ` Loic Poulain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox