aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ti_usb_3410_5052.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2021-04-12 11:38:15 +0200
committerJohan Hovold <johan@kernel.org>2021-04-13 18:19:34 +0200
commitbd49224a2ecf19bf5ce9128d8175fa69eeb952b5 (patch)
treed7e7a1209fd518fb42737b5704dcb7818de6af7b /drivers/usb/serial/ti_usb_3410_5052.c
parentc505b8b2ef274ce60a79f18a33bf23efd17a04de (diff)
downloadlinux-bd49224a2ecf19bf5ce9128d8175fa69eeb952b5.tar.gz
USB: serial: ti_usb_3410_5052: drop drain delay for 3410
Unlike the TUSB5052, the TUSB3410 has an LSR TEMT bit to tell if both the transmitter data and shift registers are empty. Make sure to check also the shift register on TUSB3410 when waiting for the transmit buffer to drain during close and drop the time-based one-char delay which is otherwise needed (e.g. 90 ms at 110 bps). Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/ti_usb_3410_5052.c')
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 8ed64115987f7..d9bffb2de8bfb 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -121,6 +121,7 @@
#define TI_LSR_ERROR 0x0F
#define TI_LSR_RX_FULL 0x10
#define TI_LSR_TX_EMPTY 0x20
+#define TI_LSR_TX_EMPTY_BOTH 0x40
/* Line control */
#define TI_LCR_BREAK 0x40
@@ -614,7 +615,8 @@ static int ti_port_probe(struct usb_serial_port *port)
* The TUSB5052 LSR does not tell when the transmitter shift register
* has emptied so add a one-character drain delay.
*/
- port->port.drain_delay = 1;
+ if (!tport->tp_tdev->td_is_3410)
+ port->port.drain_delay = 1;
return 0;
}
@@ -851,11 +853,20 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
static bool ti_tx_empty(struct usb_serial_port *port)
{
struct ti_port *tport = usb_get_serial_port_data(port);
+ u8 lsr, mask;
int ret;
- u8 lsr;
+
+ /*
+ * TUSB5052 does not have the TEMT bit to tell if the shift register
+ * is empty.
+ */
+ if (tport->tp_tdev->td_is_3410)
+ mask = TI_LSR_TX_EMPTY_BOTH;
+ else
+ mask = TI_LSR_TX_EMPTY;
ret = ti_get_lsr(tport, &lsr);
- if (!ret && !(lsr & TI_LSR_TX_EMPTY))
+ if (!ret && !(lsr & mask))
return false;
return true;