All of lore.kernel.org
 help / color / mirror / Atom feed
* Need advice on changing MPC5200B UART prescaler
@ 2009-12-17 15:57 Sylvain Lamontagne
  2010-01-18 18:36 ` Grant Likely
  0 siblings, 1 reply; 2+ messages in thread
From: Sylvain Lamontagne @ 2009-12-17 15:57 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]

Hi all,

I would like to be able to set a baud rate of 460800 for modem that we are
testing. With the actual prescaler of 32 and a IPB frequency of 84MHz
I got a 5.1% error (437500) vs a 0.9% error (456522) if I could use the
prescaler of 4. See MPC5200B user manual page 15-46 for the calculation
formula and page 15-12 for the CSR description.

Currently the code for the kernel we are using here, (2.6.29.2) seams not to
take a prescaler of 4 into account.
Line 249 of mpc52xx_uart.c
http://lxr.linux.no/linux+v2.6.29.2/drivers/serial/mpc52xx_uart.c#L249

/* Search for bus-frequency property in this node or a parent */
static unsigned long mpc52xx_getuartclk(void *p)
{
        /*
         * 5200 UARTs have a / 32 prescaler
         * but the generic serial code assumes 16
         * so return ipb freq / 2
         */
        return mpc52xx_find_ipb_freq(p) / 2;
}

How could I make it use the prescaler of 4 without breaking anything that we
currently have working ?
I doubt that simply doing  return mpc52xx_find_ipb_freq(p) / 4 would do the
trick ...

[-- Attachment #2: Type: text/html, Size: 1418 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Need advice on changing MPC5200B UART prescaler
  2009-12-17 15:57 Need advice on changing MPC5200B UART prescaler Sylvain Lamontagne
@ 2010-01-18 18:36 ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2010-01-18 18:36 UTC (permalink / raw)
  To: Sylvain Lamontagne; +Cc: linuxppc-dev

On Thu, Dec 17, 2009 at 8:57 AM, Sylvain Lamontagne
<sylvain.lamontagne@gmail.com> wrote:
> Hi all,
> I would like to be able to set a baud rate of 460800 for modem that we ar=
e
> testing. With the actual prescaler of 32 and a IPB frequency of 84MHz
> I got a 5.1% error (437500) vs a 0.9% error (456522) if I could use the
> prescaler of 4. See MPC5200B user manual page 15-46 for the calculation
> formula and page 15-12 for the CSR description.
> Currently the code for the kernel we are using here, (2.6.29.2) seams not=
 to
> take a prescaler of 4 into account.
> Line 249 of
> mpc52xx_uart.c=A0http://lxr.linux.no/linux+v2.6.29.2/drivers/serial/mpc52=
xx_uart.c#L249
> /* Search for bus-frequency property in this node or a parent */
> static unsigned long mpc52xx_getuartclk(void *p)
> {
> =A0=A0 =A0 =A0 =A0/*
> =A0=A0 =A0 =A0 =A0 * 5200 UARTs have a / 32 prescaler
> =A0=A0 =A0 =A0 =A0 * but the generic serial code assumes 16
> =A0=A0 =A0 =A0 =A0 * so return ipb freq / 2
> =A0=A0 =A0 =A0 =A0 */
> =A0=A0 =A0 =A0 =A0return mpc52xx_find_ipb_freq(p) / 2;
> }
> How could I make it use the prescaler of 4 without breaking anything that=
 we
> currently have working ?
> I doubt that simply doing=A0=A0return mpc52xx_find_ipb_freq(p) / 4 would =
do the
> trick ...

since 32 prescale is scaled to 16 by dividing by 2, then 4 would be
scaled to 16 by multiplying by 4.  Have you tried
mpc52xx_find_ipb_freq(p) * 4?  You'll need to add some method for the
uart driver to either set the prescaler at boot time or to figure out
on its own which prescaler would be best.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-18 18:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-17 15:57 Need advice on changing MPC5200B UART prescaler Sylvain Lamontagne
2010-01-18 18:36 ` Grant Likely

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.