[PATCH 07/13] HID: ft260: uart: enable flow control
Michael Zaidman <[email protected]>
| Newsgroups | gmane.linux.kernel.input,gmane.linux.kernel.gpio,gmane.linux.drivers.i2c,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
The FT260 is a full-speed USB device. Interrupt transfers poll at 1 ms with a 64-byte max packet size, so the theoretical UART payload ceiling is about 60 kB/s (~600 kbaud in 8N1). The chip advertises baud rates above 1M and small transfers can work there, but large transfers are not reliable above 460800 baud without flow control. Stop forcing FT260_UART_CFG_FLOW_CTRL_NONE after termios setup. Honor CRTSCTS (RTS/CTS) and IXON/IXOFF (XON/XOFF) when configuring the UART. Tested at 1500000 baud both directions against an FT2232H with XON/XOFF and with RTS/CTS (~2.9 MB transfers, no data corruption). Signed-off-by: Michael Zaidman <[email protected]> --- drivers/hid/hid-ft260.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 1ed3701eaaf7..1da42b8756d8 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1868,8 +1868,12 @@ static int ft260_uart_change_speed(struct ft260_device *port, if (termios->c_cflag & CRTSCTS) req.flow_ctrl = FT260_UART_CFG_FLOW_CTRL_RTS_CTS; + else if (termios->c_iflag & (IXON | IXOFF)) + req.flow_ctrl = FT260_UART_CFG_FLOW_CTRL_XON_XOFF; else - req.flow_ctrl = FT260_UART_CFG_FLOW_CTRL_OFF; + req.flow_ctrl = FT260_UART_CFG_FLOW_CTRL_NONE; + + req.breaking = FT260_UART_CFG_BREAKING_NO; ft260_dbg("configured termios: flow control: %d, baudrate: %d, ", req.flow_ctrl, baud); @@ -1877,9 +1881,6 @@ static int ft260_uart_change_speed(struct ft260_device *port, req.data_bit, req.parity, req.stop_bit, req.breaking); - req.flow_ctrl = FT260_UART_CFG_FLOW_CTRL_NONE; - req.breaking = FT260_UART_CFG_BREAKING_NO; - mutex_lock(&port->lock); ret = ft260_hid_feature_report_set(hdev, (u8 *)&req, sizeof(req)); -- 2.43.0