USB: serial: ch341: reinitialize chip on reconfiguration
authorAidan Thornton <makosoft@gmail.com>
Sat, 22 Oct 2016 21:02:24 +0000 (22:02 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 16 Mar 2017 02:18:40 +0000 (02:18 +0000)
commitc3883b5fe94cefa2585c9b484707e7d2415f5f7e
tree385465df847c75452b906ba04504c73b31cc3548
parentb4b2c4fb59722f2e88bedc71c1a63a6f650e69d0
USB: serial: ch341: reinitialize chip on reconfiguration

commit 4e46c410e050bcac36deadbd8e20449d078204e8 upstream.

Changing the LCR register after initialization does not seem to be reliable
on all chips (particularly not on CH341A). Restructure initialization and
configuration to always reinit the chip on configuration changes instead and
pass the LCR register value directly to the initialization command.

(Note that baud rates above 500kbaud are incorrect, but they're incorrect in
the same way both before and after this patch at least on the CH340G. Fixing
this isn't a priority as higher baud rates don't seem that reliable anyway.)

Cleaned-up version of a patch by Grigori Goronzy

Signed-off-by: Aidan Thornton <makosoft@gmail.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Signed-off-by: Johan Hovold <johan@kernel.org>
[bwh: Backported to 3.2: tty_struct::termios is a pointer, not a struct]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/serial/ch341.c