From 2dcb5e060318c23de248276c9a9ed375966d0943 Mon Sep 17 00:00:00 2001
From: Valentine Barshak <valentine.barshak@cogentembedded.com>
Date: Mon, 26 Nov 2018 05:55:03 +0300
Subject: [PATCH] serial: sh-sci: Fix minimal rx_timeout value

Commit "serial: sh-sci: use hrtimer for receive timeout"
breaks rx_timeout limit check. It used to be calculated
in jiffies and the minimal value was msecs_to_jiffies(20).
Since rx_timeout is now measured in uS, the minimal value
should be 20000 instead of 20.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 drivers/tty/serial/sh-sci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index eba08cd..7ab614f 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2523,8 +2523,8 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 	s->rx_frame = (10000 * bits) / (baud / 100);
 #ifdef CONFIG_SERIAL_SH_SCI_DMA
 	s->rx_timeout = s->buf_len_rx * 2 * s->rx_frame;
-	if (s->rx_timeout < 20)
-		s->rx_timeout = 20;
+	if (s->rx_timeout < 20000)
+		s->rx_timeout = 20000;
 #endif
 
 	if ((termios->c_cflag & CREAD) != 0)
-- 
2.7.4

