mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			48 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From 4ec835092d240edefad64727b5829d4d523cc825 Mon Sep 17 00:00:00 2001
 | 
						|
From: Phil Elwell <phil@raspberrypi.org>
 | 
						|
Date: Wed, 11 Oct 2017 13:48:04 +0100
 | 
						|
Subject: [PATCH 132/277] amba-pl011: Report AUTOCTS capability to framework
 | 
						|
 | 
						|
The PL011 has full hardware RTS/CTS support which is enabled by
 | 
						|
the driver when flow control is requested. However, it doesn't
 | 
						|
notify the UART framework of the fact, causing the software CTS
 | 
						|
support to be enabled at the same time.
 | 
						|
 | 
						|
Software CTS triggers the sending of another batch of characters
 | 
						|
when CTS becomes asserted. The pl011 interrupt handler processes
 | 
						|
the CTIS bit before TXIS, which can cause some characters to be
 | 
						|
sent between the time that the TXIS bit first becomes asserted
 | 
						|
and the time it is handled by a call to px011_tx_chars. This
 | 
						|
would be fine were it not for the optimisation in pl011_tx_char
 | 
						|
that assumes the FIFO is half-empty if called from the interrupt
 | 
						|
handler and skips the checking of the FIFO status register before
 | 
						|
sending each character, leading to data loss if the FIFO is more
 | 
						|
than half-full.
 | 
						|
 | 
						|
Prevent the data loss and improve efficiency by indicating the
 | 
						|
AUTOCTS support.
 | 
						|
 | 
						|
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
 | 
						|
---
 | 
						|
 drivers/tty/serial/amba-pl011.c | 2 ++
 | 
						|
 1 file changed, 2 insertions(+)
 | 
						|
 | 
						|
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
 | 
						|
index b224306633f6..3b743cf8a94c 100644
 | 
						|
--- a/drivers/tty/serial/amba-pl011.c
 | 
						|
+++ b/drivers/tty/serial/amba-pl011.c
 | 
						|
@@ -2047,9 +2047,11 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,
 | 
						|
 
 | 
						|
 		old_cr |= UART011_CR_CTSEN;
 | 
						|
 		uap->autorts = true;
 | 
						|
+		port->status |= UPSTAT_AUTOCTS;
 | 
						|
 	} else {
 | 
						|
 		old_cr &= ~(UART011_CR_CTSEN | UART011_CR_RTSEN);
 | 
						|
 		uap->autorts = false;
 | 
						|
+		port->status &= ~UPSTAT_AUTOCTS;
 | 
						|
 	}
 | 
						|
 
 | 
						|
 	if (uap->vendor->oversampling) {
 | 
						|
-- 
 | 
						|
2.16.1
 | 
						|
 |