[PATCH] serial: sh-sci: Support custom speed setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Torii Kenichi <torii.ken1@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
[erosca: rebase against v5.5]
Signed-off-by: Eugeniu Rosca <erosca@xxxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux