[PATCH v5 2/2] serial: mxc: have putc use the TXFIFO
Pali Rohár
pali at kernel.org
Wed Oct 26 19:45:20 CEST 2022
On Tuesday 25 October 2022 19:19:01 Fabio Estevam wrote:
> Hi Tim,
>
> On 25/10/2022 18:37, Tim Harvey wrote:
>
> > Fabio and Pali,
> >
> > Seems reasonable but this does not resolve the problem. Whatever I
> > print in board_init gets cutoff by the print from dm_announce.
>
> Should we check for both TXFULL and TXEMPTY conditions?
>
> --- 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);
Hello! I really do not understand what is the intention of this change.
Previously there was check only for !TXEMPTY. Then patch changed
!TXEMPTY to TXFULL. And now you are changing TXFULL to TXFULL&&!TXEMPTY.
It looks really suspicious.
I'm not sure what TXEMPTY and what TXFULL means for MXC hardware, but
normally TXEMPTY means that transmit queue is empty and HW already
transmitted all data - POSIX tctrain() function. TXFULL normally means
that transmit queue is full and HW cannot take data from CPU at the
moment. So normally TXEMPTY implies !TXFULL. And TXFULL then implies
!TXMEPTY.
So could you check what your HW means for TXEMPTY and TXFULL.
And second thing, when you need to check two bits from one HW register,
you can do it just via one readl() operation by checking masked value.
More information about the U-Boot
mailing list