On 9/6/2022 11:38 AM, SCHNEIDER Johannes wrote:
Hi Peng Fan,

... well i'm actually not sure why the messages get corrupted; it's just what i 
observed on a connected oscilloscope :-s
the code that does uses the transmit functions is making use of the returned 
-EAGAIN and retries - and even strewing in some delays to wait for the buffer 
or checking the status register didn't resolve the issue -- switching the 
serical driver from locking onto the single send-register to actually checking 
the fifo fixed it though.

i can put these "vague reasons" in the commit message... but i dont/didn't 
think theyd help much (?)

That's fine, I just wanna know more details. Maybe add one line "followling linux kernel i.MX8M* uart driver, check UTS_TXFULL, not UTS_EMPTY."

Regards,
Peng.



regards
________________________________
From: Peng Fan <[email protected]>
Sent: Tuesday, September 6, 2022 02:54
To: SCHNEIDER Johannes <[email protected]>; 
[email protected] <[email protected]>
Cc: trini <[email protected]>; GEO-CHHER-bsp-development 
<[email protected]>; [email protected] <[email protected]>; [email protected] 
<[email protected]>; Pali Rohár <[email protected]>
Subject: Re: [PATCH v2 2/2] serial: mxc: have putc use the TXFIFO

This email is not from Hexagon’s Office 365 instance. Please be careful while 
clicking links, opening attachments, or replying to this email.


On 9/5/2022 5:58 PM, Johannes Schneider wrote:
only waiting for TXEMPTY leads to corrupted messages going over the
wire - which is fixed by making use of the FIFO

Could you please explain a bit more, why waiting TXEMPTY could lead
to corrupted message?

Thanks,
Peng.


Signed-off-by: Johannes Schneider <[email protected]>
---

(no changes since v1)

   drivers/serial/serial_mxc.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 5f283cc635..1e0add7281 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -309,7 +309,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);

Reply via email to