[PATCH v3 2/2] serial: mxc: Speed-up character transmission

Pali Rohár pali at kernel.org
Wed Jan 11 00:55:53 CET 2023


On Tuesday 10 January 2023 20:24:07 Loic Poulain wrote:
> 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 at linaro.org>
> Tested-by: Lothar Waßmann <LW at KARO-electronics.de>
> ---
>  v2: fixing transfert abort & char corruption commit
>  v3: Reordering commits for good bisectability
> 
>  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 3c89781f2c..9899155c00 100644
> --- a/drivers/serial/serial_mxc.c
> +++ b/drivers/serial/serial_mxc.c
> @@ -238,11 +238,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 */
> @@ -333,7 +333,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
> 

Hello!

In this driver there are two mxc_serial_putc() and two mxc_serial_getc()
function. One for DM and one for non-DM version. It would be really nice
to fix also second set of functions.


More information about the U-Boot mailing list