linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: Support custom speed setting
@ 2020-01-29 16:19 Eugeniu Rosca
  2020-01-30 12:32 ` Geert Uytterhoeven
  0 siblings, 1 reply; 12+ messages in thread
From: Eugeniu Rosca @ 2020-01-29 16:19 UTC (permalink / raw)
  To: Geert Uytterhoeven, linux-serial, linux-renesas-soc
  Cc: Wolfram Sang, Yoshihiro Shimoda, Ulrich Hecht, George G . Davis,
	Andrew Gabbasov, Jiada Wang, Yuichi Kusakabe, Yasushi Asano,
	linux-kernel, Greg Kroah-Hartman, Jiri Slaby, Fukui Yohhei,
	Torii Kenichi, Eugeniu Rosca

From: Torii Kenichi <torii.ken1@jp.fujitsu.com>

This patch is necessary to use BT module and XM module with DENSO TEN
development board.

This patch supports ASYNC_SPD_CUST flag by ioctl(TIOCSSERIAL), enables
custom speed setting with setserial(1).

The custom speed is calculated from uartclk and custom_divisor.
If custom_divisor is zero, custom speed setting is invalid.

Signed-off-by: Torii Kenichi <torii.ken1@jp.fujitsu.com>
[erosca: rebase against v5.5]
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
---
 drivers/tty/serial/sh-sci.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 87ca6294de0e..dd468909b2c4 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2405,6 +2405,10 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 	if (!baud)
 		goto done;
 
+	if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST &&
+	    port->custom_divisor)
+		baud = port->uartclk / port->custom_divisor;
+
 	/*
 	 * There can be multiple sources for the sampling clock.  Find the one
 	 * that gives us the smallest deviation from the desired baud rate.
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-07-15 21:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-29 16:19 [PATCH] serial: sh-sci: Support custom speed setting Eugeniu Rosca
2020-01-30 12:32 ` Geert Uytterhoeven
2020-02-10 20:57   ` Greg Kroah-Hartman
2020-02-10 21:44     ` Eugeniu Rosca
2020-02-11  8:15     ` Geert Uytterhoeven
2020-02-11 12:30       ` Greg Kroah-Hartman
2020-03-12  5:10     ` torii.ken1
2020-03-12  8:55       ` gregkh
2020-03-12  9:03       ` Geert Uytterhoeven
2020-03-12  9:44         ` ashiduka
2020-03-30  7:43           ` ashiduka
2021-07-15 21:16             ` andy

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).