Re: [PATCH] USB: serial: cp210x: fix CP2102N-A01 modem control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



El 10/6/21 a las 02:23, Johan Hovold escribió:
On Wed, Jun 09, 2021 at 12:00:36PM -0500, Alex Villacís Lasso wrote:
El 9/6/21 a las 11:15, Johan Hovold escribió:
CP2102N revision A01 (firmware version <= 1.0.4) has a buggy
flow-control implementation that uses the ulXonLimit instead of
ulFlowReplace field of the flow-control settings structure (erratum
CP2102N_E104).

A recent change that set the input software flow-control limits
incidentally broke RTS control for these devices when CRTSCTS is not set
as the new limits would always enable hardware flow control.

Fix this by explicitly disabling flow control for the buggy firmware
versions and only updating the input software flow-control limits when
IXOFF is requested. This makes sure that the terminal settings matches
the default zero ulXonLimit (ulFlowReplace) for these devices.

Reported-by: David Frey <dpfrey@xxxxxxxxx>
Reported-by: Alex Villacís Lasso <a_villacis@xxxxxxxxxxxxx>
Fixes: f61309d9c96a ("USB: serial: cp210x: set IXOFF thresholds")
Cc: stable@xxxxxxxxxxxxxxx      # 5.12
Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
---
   drivers/usb/serial/cp210x.c | 64 ++++++++++++++++++++++++++++++++++---
   1 file changed, 59 insertions(+), 5 deletions(-)

David and Alex,

Would you mind testing this one with your CP2108N-A01? I've verified it
against a CP2108N-A02 (fw 1.0.8) here.
I meant CP2102N here of course. It had been a long day...

Applied patch and tested with ESP32 board under kernel 5.12.9:
jun 09 11:56:00 karlalex-asus kernel: cp210x 1-9:1.0:
cp210x_get_fw_version - 1.0.4
$ miniterm.py /dev/ttyUSB0 115200
<successful connect>

jun 09 11:56:50 karlalex-asus kernel: cp210x ttyUSB0:
cp210x_change_speed - setting baud rate to 9600
jun 09 11:56:50 karlalex-asus kernel: cp210x ttyUSB0:
cp210x_set_flow_control - ctrl = 0x00, flow = 0x00
jun 09 11:56:50 karlalex-asus kernel: cp210x ttyUSB0:
cp210x_tiocmset_port - control = 0x0303
jun 09 11:56:50 karlalex-asus kernel: cp210x ttyUSB0:
cp210x_change_speed - setting baud rate to 115384
jun 09 11:56:50 karlalex-asus kernel: cp210x ttyUSB0:
cp210x_tiocmset_port - control = 0x0101
jun 09 11:56:50 karlalex-asus kernel: cp210x ttyUSB0:
cp210x_tiocmset_port - control = 0x0202

At least in my case, this patch fixes the regression for my workflow.
Thanks for confirming. Can I add a "Tested-by" tag for you as well?

And again, thanks for the detailed report, bisection and thorough
testing throughout.

Johan

Yes, go ahead. You can put the Tested-by on my behalf.




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux