From: Grant Likely <grant.likely@secretlab.ca>
To: "Albrecht Dreß" <albrecht.dress@arcor.de>
Cc: Linux PPC Development <linuxppc-dev@ozlabs.org>
Subject: Re: [Patch] mpc5200b: improve baud rate calculation (reach high baud rates, better accuracy)
Date: Tue, 2 Mar 2010 13:22:08 -0700 [thread overview]
Message-ID: <fa686aa41003021222k2cdb5200vbaaf329c6e505048@mail.gmail.com> (raw)
In-Reply-To: <1267467114.2218.0@antares>
Hi Albrecht,
Thanks for this work, comment below...
On Mon, Mar 1, 2010 at 11:11 AM, Albrecht Dre=DF <albrecht.dress@arcor.de> =
wrote:
> On the MPC5200B, select the baud rate prescaler as /4 by default to make =
very
> high baud rates (e.g. 3 MBaud) accessible and to achieve a higher precisi=
on
> for high baud rates in general. For baud rates below ~500 Baud, the code =
will
> automatically fall back to the /32 prescaler. =A0The original MPC5200 doe=
s only
> have a /32 prescaler which is detected only once and stored in a global. =
=A0A
> new chip-dependent method is used to set the divisor.
>
> Tested on a custom 5200B based board, with up to 3 MBaud.
>
> Signed-off-by: Albrecht Dre=DF <albrecht.dress@arcor.de>
>
> ---
>
> --- linux-2.6.33/drivers/serial/mpc52xx_uart.c.orig =A0 =A0 2010-02-24 19=
:52:17.000000000 +0100
> +++ linux-2.6.33/drivers/serial/mpc52xx_uart.c =A02010-02-26 21:12:51.000=
000000 +0100
> =A0/* Search for bus-frequency property in this node or a parent */
> =A0static unsigned long mpc52xx_getuartclk(void *p)
> =A0{
> =A0 =A0 =A0 =A0/*
> - =A0 =A0 =A0 =A0* 5200 UARTs have a / 32 prescaler
> - =A0 =A0 =A0 =A0* but the generic serial code assumes 16
> - =A0 =A0 =A0 =A0* so return ipb freq / 2
> + =A0 =A0 =A0 =A0* The 5200 has only /32 prescalers.
> + =A0 =A0 =A0 =A0* 5200B UARTs have a /4 or a /32 prescaler. =A0For highe=
r accuracy, we
> + =A0 =A0 =A0 =A0* do all calculations using the /4 prescaler for this ch=
ip.
> + =A0 =A0 =A0 =A0* The generic serial code assumes /16 so return ipb freq=
/ 2 (5200)
> + =A0 =A0 =A0 =A0* or ipb freq * 4 (5200B).
> =A0 =A0 =A0 =A0 */
> - =A0 =A0 =A0 return mpc5xxx_get_bus_frequency(p) / 2;
> + =A0 =A0 =A0 if (is_mpc5200b =3D=3D 1)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return mpc5xxx_get_bus_frequency(p) * 4;
> + =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return mpc5xxx_get_bus_frequency(p) / 2;
> =A0}
Remove this function entirely and the associated .getuartclk() hook
from the psc_ops structure. Callers can just call
mpc5xxx_get_bus_frequency() directly. mpc5121 already just passes
back the return value unmodified, and current mpc52xx code uses a /2,
but that would be eliminated if the new set_divisor hook took that
into account. That way all the chip-specific clock setup calculation
is consolidated into a single function. I like patches that make
things simpler.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
next prev parent reply other threads:[~2010-03-02 20:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-01 18:11 [Patch] mpc5200b: improve baud rate calculation (reach high baud rates, better accuracy) Albrecht Dreß
2010-03-02 0:32 ` Wolfram Sang
2010-03-02 20:22 ` Grant Likely [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-03-02 8:09 Albrecht Dreß
2010-03-02 8:28 ` Wolfram Sang
2010-03-02 8:56 ` Albrecht Dreß
2010-03-02 15:27 ` Wolfram Sang
2010-03-02 20:12 ` Grant Likely
2010-03-02 20:06 ` Grant Likely
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=fa686aa41003021222k2cdb5200vbaaf329c6e505048@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=albrecht.dress@arcor.de \
--cc=linuxppc-dev@ozlabs.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 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).