Pārlūkot izejas kodu

serial: sh-sci: fix hardware RX trigger level setting

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ulrich Hecht 8 gadi atpakaļ
vecāks
revīzija
90afa5255f
1 mainītis faili ar 9 papildinājumiem un 2 dzēšanām
  1. 9 2
      drivers/tty/serial/sh-sci.c

+ 9 - 2
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);
 		}
 	}
 }