Draft: tty:serial:imx: fix uart latency for rs485 on mx6ull
This is a "guf" version of a fix for https://secogroup.atlassian.net/browse/YT-136 Nallino: RS485 turn around time problem
MR for "kuk" kernel: linux-imx-kuk!522 (closed)
Our current understanding is as follows:
- from time to time, UART transmission fails to complete in time (delay is up to 3ms). And when other side starts to reply to our transmission during this delay, this message is not received because signals are still pulled up/down;
- rx interrupt is not generated after all bytes from internal buffers are transmitted as switching into receive mode takes a lot of time because of latency on mx6ull and because of driver logic, which makes driver vulnerable to the latency;
- we believe that this is because of preemption of stop_tx() routine by other processes in kernel;
- we checked 5.x and 6.x kernels and behavior and UART driver design is the same;
- but we found that the driver for 4.x kernel is of different design focused on IRQ and not on DMA. We also noticed that TX routine is streamlined, which should minimize the number of switching of context during execution.
As a result, we just simplified the TX routine by analogy with 4.x kernel.
After applying this workaround, we launched rs485echo for 15 minutes on Nallino and no failures have been reported.
Edited by Mikhail Vanyulin