All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linaro.org>
To: stable@vger.kernel.org, gregkh@linuxfoundation.org
Cc: lanqing.liu@unisoc.com, linux-serial@vger.kernel.org,
	arnd@arndb.de, baolin.wang@linaro.org, orsonzhai@gmail.com,
	vincent.guittot@linaro.org, linux-kernel@vger.kernel.org
Subject: [BACKPORT 4.14.y 8/8] serial: sprd: Modify the baud rate calculation formula
Date: Tue,  3 Sep 2019 15:01:25 +0800	[thread overview]
Message-ID: <b72268635867cb643912bd842f4980c5d24cb2df.1567492316.git.baolin.wang@linaro.org> (raw)
In-Reply-To: <cover.1567492316.git.baolin.wang@linaro.org>

From: Lanqing Liu <lanqing.liu@unisoc.com>

When the source clock is not divisible by the expected baud rate and
the remainder is not less than half of the expected baud rate, the old
formular will round up the frequency division coefficient. This will
make the actual baud rate less than the expected value and can not meet
the external transmission requirements.

Thus this patch modifies the baud rate calculation formula to support
the serial controller output the maximum baud rate.

Signed-off-by: Lanqing Liu <lanqing.liu@unisoc.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/tty/serial/sprd_serial.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index e902494..72e96ab8 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -380,7 +380,7 @@ static void sprd_set_termios(struct uart_port *port,
 	/* ask the core to calculate the divisor for us */
 	baud = uart_get_baud_rate(port, termios, old, 0, SPRD_BAUD_IO_LIMIT);
 
-	quot = (unsigned int)((port->uartclk + baud / 2) / baud);
+	quot = port->uartclk / baud;
 
 	/* set data length */
 	switch (termios->c_cflag & CSIZE) {
-- 
1.7.9.5


      parent reply	other threads:[~2019-09-03  7:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03  6:53 [BACKPORT 4.14.y 0/8] Candidates from Spreadtrum 4.14 product kernel Baolin Wang
2019-09-03  6:53 ` Baolin Wang
2019-09-03  6:55 ` [BACKPORT 4.14.y 1/8] drm/i915/fbdev: Actually configure untiled displays Baolin Wang
2019-09-04 13:18   ` Jani Nikula
2019-09-04 13:18     ` Jani Nikula
2019-09-05  1:44     ` Baolin Wang
2019-09-04 17:25   ` Greg KH
2019-09-05  1:47     ` Baolin Wang
2019-09-03  6:56 ` [BACKPORT 4.14.y 2/8] ip6: fix skb leak in ip6frag_expire_frag_queue() Baolin Wang
2019-09-03  6:57 ` [BACKPORT 4.14.y 3/8] locking/lockdep: Add debug_locks check in __lock_downgrade() Baolin Wang
2019-09-03  6:58 ` [BACKPORT 4.14.y 4/8] net: sctp: fix warning "NULL check before some freeing functions is not needed" Baolin Wang
2019-09-03  6:58   ` [BACKPORT 4.14.y 4/8] net: sctp: fix warning "NULL check before some freeing functions is not needed Baolin Wang
2019-09-03 14:52   ` [BACKPORT 4.14.y 4/8] net: sctp: fix warning "NULL check before some freeing functions is not needed" Marcelo Ricardo Leitner
2019-09-03 14:52     ` [BACKPORT 4.14.y 4/8] net: sctp: fix warning "NULL check before some freeing functions is not ne Marcelo Ricardo Leitner
2019-09-03 18:33     ` [BACKPORT 4.14.y 4/8] net: sctp: fix warning "NULL check before some freeing functions is not needed" Greg KH
2019-09-03 18:33       ` [BACKPORT 4.14.y 4/8] net: sctp: fix warning "NULL check before some freeing functions is not ne Greg KH
2019-09-04  2:38       ` [BACKPORT 4.14.y 4/8] net: sctp: fix warning "NULL check before some freeing functions is not needed" Baolin Wang
2019-09-04  2:38         ` [BACKPORT 4.14.y 4/8] net: sctp: fix warning "NULL check before some freeing functions is not ne Baolin Wang
2019-09-03  6:59 ` [BACKPORT 4.14.y 5/8] pinctrl: sprd: Use define directive for sprd_pinconf_params values Baolin Wang
2019-09-03  6:59 ` [BACKPORT 4.14.y 6/8] power: supply: sysfs: ratelimit property read error message Baolin Wang
2019-09-03  7:00 ` [BACKPORT 4.14.y 7/8] ppp: mppe: Revert "ppp: mppe: Add softdep to arc4" Baolin Wang
2019-09-03  7:00   ` Baolin Wang
2019-09-03  7:01 ` Baolin Wang [this message]

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=b72268635867cb643912bd842f4980c5d24cb2df.1567492316.git.baolin.wang@linaro.org \
    --to=baolin.wang@linaro.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=lanqing.liu@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=vincent.guittot@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.