From: Eugeniu Rosca <erosca@de.adit-jv.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>,
<linux-serial@vger.kernel.org>,
<linux-renesas-soc@vger.kernel.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
Ulrich Hecht <uli+renesas@fpond.eu>,
"George G . Davis" <george_davis@mentor.com>,
Andrew Gabbasov <andrew_gabbasov@mentor.com>,
Jiada Wang <jiada_wang@mentor.com>,
Yuichi Kusakabe <yuichi.kusakabe@denso-ten.com>,
Yasushi Asano <yasano@jp.adit-jv.com>,
<linux-kernel@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>,
Fukui Yohhei <yohhei.fukui@denso-ten.com>,
Torii Kenichi <torii.ken1@jp.fujitsu.com>,
Eugeniu Rosca <erosca@de.adit-jv.com>
Subject: [PATCH] serial: sh-sci: Support custom speed setting
Date: Wed, 29 Jan 2020 17:19:55 +0100 [thread overview]
Message-ID: <20200129161955.30562-1-erosca@de.adit-jv.com> (raw)
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
next reply other threads:[~2020-01-29 16:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-29 16:19 Eugeniu Rosca [this message]
2020-01-30 12:32 ` [PATCH] serial: sh-sci: Support custom speed setting 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200129161955.30562-1-erosca@de.adit-jv.com \
--to=erosca@de.adit-jv.com \
--cc=andrew_gabbasov@mentor.com \
--cc=geert+renesas@glider.be \
--cc=george_davis@mentor.com \
--cc=gregkh@linuxfoundation.org \
--cc=jiada_wang@mentor.com \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=torii.ken1@jp.fujitsu.com \
--cc=uli+renesas@fpond.eu \
--cc=wsa+renesas@sang-engineering.com \
--cc=yasano@jp.adit-jv.com \
--cc=yohhei.fukui@denso-ten.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
--cc=yuichi.kusakabe@denso-ten.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).