ftdiuart: Decrease latency timer to improve responsiveness

POSIX PTY slaves usually expect a read() to compelete instantly and
return any data that had been buffered as long as there is at least one
byte pending. Unfortunately, the FTDI chip has a different idea of
reading: it only completes a USB Bulk IN when it can either serve the
whole request at once or after a "latency timer" of by default 16ms has
passed. This doesn't really play nice with bidirectional protocols like
remote GDB which send a lot of little chunks back and forth while always
waiting for an acknowledgement.

This patch decreases the latency timer for UARTs to the minimum of 1ms,
which is well within the range of other limiting delays in the whole
Servo serial stack. Note that this will increase the Servo USB traffic
when idle by a factor of 16, which shouldn't be an issue (and if it ever
turns out to be one we should find smarter ways to ratelimit it).

TEST=Saw efficiency of my custom ping-pong test code grow by a factor of
~15, and putchar-based printfs over remote GDB feel a bit faster as well.

Change-Id: Ife85b7ca60a04e8f5fece87792ecf15884aac86a
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/195312
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
1 file changed