From: Jerry Van Baren <gerald.vanbaren@ge.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Round the serial port clock divisor value returned by calc_divisor()
Date: Tue, 15 Jul 2008 11:53:35 -0400 [thread overview]
Message-ID: <487CC7FF.2000700@ge.com> (raw)
In-Reply-To: <1216135382-21987-1-git-send-email-hugo.villeneuve@lyrtech.com>
Hugo Villeneuve wrote:
> Round the serial port clock divisor value returned by
> calc_divisor()
>
> Signed-off-by: Hugo Villeneuve <hugo.villeneuve@lyrtech.com>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
(Hopefully this stops Wolfgang's pain!)
>
> ---
>
> drivers/serial/serial.c | 12 +++---------
> 1 files changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
> index 4ccaee2..8bbfcf9 100644
> --- a/drivers/serial/serial.c
> +++ b/drivers/serial/serial.c
> @@ -124,8 +124,6 @@ static NS16550_t serial_ports[4] = {
>
> static int calc_divisor (NS16550_t port)
> {
> - uint32_t clk_divisor;
> -
> #ifdef CONFIG_OMAP1510
> /* If can't cleanly clock 115200 set div to 1 */
> if ((CFG_NS16550_CLK == 12000000) && (gd->baudrate == 115200)) {
> @@ -149,15 +147,11 @@ static int calc_divisor (NS16550_t port)
>
> /* Compute divisor value. Normally, we should simply return:
> * CFG_NS16550_CLK) / MODE_X_DIV / gd->baudrate
> - * but we need to round that value by adding 0.5 (2/4).
> + * but we need to round that value by adding 0.5.
> * Rounding is especially important at high baud rates.
> */
> - clk_divisor = (((4 * CFG_NS16550_CLK) /
> - (MODE_X_DIV * gd->baudrate)) + 2) / 4;
> -
> - debug("NS16550 clock divisor = %d\n", clk_divisor);
> -
> - return clk_divisor;
> + return (CFG_NS16550_CLK + (gd->baudrate * (MODE_X_DIV / 2))) /
> + (MODE_X_DIV * gd->baudrate);
> }
>
> #if !defined(CONFIG_SERIAL_MULTI)
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
next prev parent reply other threads:[~2008-07-15 15:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-08 17:32 [U-Boot-Users] [PATCH] Round the serial port clock divisor value returned by calc_divisor() Hugo Villeneuve
2008-07-08 17:50 ` Jerry Van Baren
2008-07-08 18:21 ` Hugo Villeneuve
2008-07-08 18:35 ` Jerry Van Baren
2008-07-08 18:54 ` Hugo Villeneuve
2008-07-15 15:23 ` Hugo Villeneuve
2008-07-15 15:53 ` Jerry Van Baren [this message]
2008-07-15 19:54 ` Wolfgang Denk
2008-07-15 19:53 ` Wolfgang Denk
-- strict thread matches above, loose matches on Subject: below --
2008-07-11 1:25 Jerry Van Baren
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=487CC7FF.2000700@ge.com \
--to=gerald.vanbaren@ge.com \
--cc=u-boot@lists.denx.de \
/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