]> git.baikalelectronics.ru Git - kernel.git/commit
USB: serial: ch341: fix character loss at high transfer rates
authorWilly Tarreau <w@1wt.eu>
Sat, 24 Jul 2021 15:27:39 +0000 (17:27 +0200)
committerJohan Hovold <johan@kernel.org>
Thu, 29 Jul 2021 11:52:10 +0000 (13:52 +0200)
commit22ae2ebee35e412c6753d0945acab4d355c17e12
tree30fa432375912e9128028c2a5c1f29e28937e13e
parent474b9af4e9fc6be058d6522dbd75b30f5cbbb04c
USB: serial: ch341: fix character loss at high transfer rates

The chip supports high transfer rates, but with the small default buffers
(64 bytes read), some entire blocks are regularly lost. This typically
happens at 1.5 Mbps (which is the default speed on Rockchip devices) when
used as a console to access U-Boot where the output of the "help" command
misses many lines and where "printenv" mangles the environment.

The FTDI driver doesn't suffer at all from this. One difference is that
it uses 512 bytes rx buffers and 256 bytes tx buffers. Adopting these
values completely resolved the issue, even the output of "dmesg" is
reliable. I preferred to leave the Tx value unchanged as it is not
involved in this issue, while a change could increase the risk of
triggering the same issue with other devices having too small buffers.

I verified that it backports well (and works) at least to 5.4. It's of
low importance enough to be dropped where it doesn't trivially apply
anymore.

Cc: stable@vger.kernel.org
Signed-off-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20210724152739.18726-1-w@1wt.eu
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/ch341.c