f491df2b8a5c58fc19fe5af2b3651eff3901b219
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.14 / 950-0123-amba-pl011-Report-AUTOCTS-capability-to-framework.patch
1 From fc4fafeed9a7cc89b4779681f046a8cc0f506dd9 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Wed, 11 Oct 2017 13:48:04 +0100
4 Subject: [PATCH 123/454] amba-pl011: Report AUTOCTS capability to framework
5
6 The PL011 has full hardware RTS/CTS support which is enabled by
7 the driver when flow control is requested. However, it doesn't
8 notify the UART framework of the fact, causing the software CTS
9 support to be enabled at the same time.
10
11 Software CTS triggers the sending of another batch of characters
12 when CTS becomes asserted. The pl011 interrupt handler processes
13 the CTIS bit before TXIS, which can cause some characters to be
14 sent between the time that the TXIS bit first becomes asserted
15 and the time it is handled by a call to px011_tx_chars. This
16 would be fine were it not for the optimisation in pl011_tx_char
17 that assumes the FIFO is half-empty if called from the interrupt
18 handler and skips the checking of the FIFO status register before
19 sending each character, leading to data loss if the FIFO is more
20 than half-full.
21
22 Prevent the data loss and improve efficiency by indicating the
23 AUTOCTS support.
24
25 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
26 ---
27 drivers/tty/serial/amba-pl011.c | 2 ++
28 1 file changed, 2 insertions(+)
29
30 --- a/drivers/tty/serial/amba-pl011.c
31 +++ b/drivers/tty/serial/amba-pl011.c
32 @@ -2063,9 +2063,11 @@ pl011_set_termios(struct uart_port *port
33
34 old_cr |= UART011_CR_CTSEN;
35 uap->autorts = true;
36 + port->status |= UPSTAT_AUTOCTS;
37 } else {
38 old_cr &= ~(UART011_CR_CTSEN | UART011_CR_RTSEN);
39 uap->autorts = false;
40 + port->status &= ~UPSTAT_AUTOCTS;
41 }
42
43 if (uap->vendor->oversampling) {