linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: fix hardware RX trigger level setting
@ 2017-02-08 17:31 Ulrich Hecht
  0 siblings, 0 replies; only message in thread
From: Ulrich Hecht @ 2017-02-08 17:31 UTC (permalink / raw)
  To: linux-renesas-soc, geert, gregkh
  Cc: wsa, linux-serial, magnus.damm, sergei.shtylyov, Ulrich Hecht

1. Do not set the RX trigger level for software timeout devices on reset;
there is no timeout by default, and data will rot.
2. Do set the RX trigger level for hardware timeout devices when set
via sysfs attribute.

Fixes SCIFA-type serial consoles.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/tty/serial/sh-sci.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index f95a56c..9a47cc4 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1076,8 +1076,11 @@ static ssize_t rx_trigger_store(struct device *dev,
 
 	if (kstrtol(buf, 0, &r) == -EINVAL)
 		return -EINVAL;
+
 	sci->rx_trigger = scif_set_rtrg(port, r);
-	scif_set_rtrg(port, 1);
+	if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
+		scif_set_rtrg(port, 1);
+
 	return count;
 }
 
@@ -2179,7 +2182,11 @@ static void sci_reset(struct uart_port *port)
 			setup_timer(&s->rx_fifo_timer, rx_fifo_timer_fn,
 				    (unsigned long)s);
 		} else {
-			scif_set_rtrg(port, s->rx_trigger);
+			if (port->type == PORT_SCIFA ||
+			    port->type == PORT_SCIFB)
+				scif_set_rtrg(port, 1);
+			else
+				scif_set_rtrg(port, s->rx_trigger);
 		}
 	}
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-08 17:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-08 17:31 [PATCH] serial: sh-sci: fix hardware RX trigger level setting Ulrich Hecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).