[PATCH] serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle

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

 



The driver must provide throttle and unthrottle in uart_ops when it
sets UPSTAT_AUTORTS. Add them using existing stop_rx &
enable_interrupts functions.

Compile tested (w/o linking).

Reported-by: Nuno Gonçalves <nunojpg@xxxxxxxxx>
Fixes: 2a76fa283098 (serial: pl011: Adopt generic flag to store auto
		     RTS status)
Cc: Lukas Wunner <lukas@xxxxxxxxx>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>

---

Maybe this one is the correct solution (I'm not able to test on the real 
hw though)?

It seems that max310x suffers from the same issue but it doesn't have 
an easy to use stop_rx available so it requires a bit more effort to 
figure out how to actually do the throttle state.

 drivers/tty/serial/amba-pl011.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 4d11a3e547f9..3f15205a47c5 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1339,6 +1339,15 @@ static void pl011_stop_rx(struct uart_port *port)
 	pl011_dma_rx_stop(uap);
 }
 
+static void pl011_throttle_rx(struct uart_port *port)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&port->lock, flags);
+	pl011_stop_rx(port);
+	spin_unlock_irqrestore(&port->lock, flags);
+}
+
 static void pl011_enable_ms(struct uart_port *port)
 {
 	struct uart_amba_port *uap =
@@ -1787,6 +1796,16 @@ static void pl011_enable_interrupts(struct uart_amba_port *uap)
 	spin_unlock_irq(&uap->port.lock);
 }
 
+static void pl011_unthrottle_rx(struct uart_port *port)
+{
+	struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
+	unsigned long flags;
+
+	spin_lock_irqsave(&port->lock, flags);
+	pl011_enable_interrupts(uap);
+	spin_unlock_irqrestore(&port->lock, flags);
+}
+
 static int pl011_startup(struct uart_port *port)
 {
 	struct uart_amba_port *uap =
@@ -2243,6 +2262,8 @@ static const struct uart_ops sbsa_uart_pops = {
 	.stop_tx	= pl011_stop_tx,
 	.start_tx	= pl011_start_tx,
 	.stop_rx	= pl011_stop_rx,
+	.throttle	= pl011_throttle_rx,
+	.unthrottle	= pl011_unthrottle_rx,
 	.startup	= sbsa_uart_startup,
 	.shutdown	= sbsa_uart_shutdown,
 	.set_termios	= sbsa_uart_set_termios,

-- 
tg: (19317433057d..) pl011/add-throttle (depends on: tty-linus)

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux