Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90afa525 authored by Ulrich Hecht's avatar Ulrich Hecht Committed by Greg Kroah-Hartman
Browse files

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: default avatarUlrich Hecht <ulrich.hecht+renesas@gmail.com>
Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6a5f0e2f
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -1076,8 +1076,11 @@ static ssize_t rx_trigger_store(struct device *dev,


	if (kstrtol(buf, 0, &r) == -EINVAL)
	if (kstrtol(buf, 0, &r) == -EINVAL)
		return -EINVAL;
		return -EINVAL;

	sci->rx_trigger = scif_set_rtrg(port, r);
	sci->rx_trigger = scif_set_rtrg(port, r);
	if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
		scif_set_rtrg(port, 1);
		scif_set_rtrg(port, 1);

	return count;
	return count;
}
}


@@ -2179,6 +2182,10 @@ static void sci_reset(struct uart_port *port)
			setup_timer(&s->rx_fifo_timer, rx_fifo_timer_fn,
			setup_timer(&s->rx_fifo_timer, rx_fifo_timer_fn,
				    (unsigned long)s);
				    (unsigned long)s);
		} else {
		} else {
			if (port->type == PORT_SCIFA ||
			    port->type == PORT_SCIFB)
				scif_set_rtrg(port, 1);
			else
				scif_set_rtrg(port, s->rx_trigger);
				scif_set_rtrg(port, s->rx_trigger);
		}
		}
	}
	}