[PATCH v5 2/2] serial: mxc: have putc use the TXFIFO

Fabio Estevam festevam at denx.de
Tue Oct 25 22:37:01 CEST 2022


Hi Pali,

On 25/10/2022 17:23, Pali Rohár wrote:

> Hello! I do not have any MXC hardware but I see there one issue.
> mxc_serial_putc() function probably should not return -EAGAIN when
> device is busy. But instead it should wait until it is ready.
> 
> Could you try to change code to following?
> 
>     while (readl(&uart->ts) & UTS_TXFULL)
>         ;
> 
>     writel(ch, &uart->txd);

Your analysis looks correct.

The kernel does like this:

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);
}

Thanks


More information about the U-Boot mailing list