mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Borleis <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Subject: Re: [PATCH 4/5] PPC/PCM030: fix reference clock
Date: Mon, 27 Jul 2015 09:55:32 +0200	[thread overview]
Message-ID: <201507270955.33333.jbe@pengutronix.de> (raw)
In-Reply-To: <20150727054240.GV18700@pengutronix.de>

Hi Sascha,

On Monday 27 July 2015 07:42:40 Sascha Hauer wrote:
> On Fri, Jul 24, 2015 at 03:42:05PM +0200, Juergen Borleis wrote:
> > The PCM030 CPU module comes with a 33.333 MHz instead of a 33.333333 MHz
> > crystal reference. If such a special reference is in use, the USB PLL
> > needs a tweak to create a correct frequency. Without this tweak the USB
> > does not work correctly.
> >
> > Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
> > ---
> >  arch/ppc/boards/pcm030/config.h | 2 +-
> >  arch/ppc/boards/pcm030/pcm030.c | 9 +++++++++
> >  2 files changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/ppc/boards/pcm030/config.h
> > b/arch/ppc/boards/pcm030/config.h index 1521811..3fe1f28 100644
> > --- a/arch/ppc/boards/pcm030/config.h
> > +++ b/arch/ppc/boards/pcm030/config.h
> > @@ -25,7 +25,7 @@
> >
> >  #include <mach/mpc5xxx.h>
> >
> > -#define CFG_MPC5XXX_CLKIN	33333333 /* ... running at 33.333333MHz */
> > +#define CFG_MPC5XXX_CLKIN	33333000 /* ... running at 33.333MHz */
> >
> >  #define CFG_HID0_INIT		HID0_ICE | HID0_ICFI
> >  #define CFG_HID0_FINAL		HID0_ICE
> > diff --git a/arch/ppc/boards/pcm030/pcm030.c
> > b/arch/ppc/boards/pcm030/pcm030.c index a7fa21d..376891a 100644
> > --- a/arch/ppc/boards/pcm030/pcm030.c
> > +++ b/arch/ppc/boards/pcm030/pcm030.c
> > @@ -32,6 +32,7 @@
> >  #include <memory.h>
> >  #include <linux/sizes.h>
> >  #include <linux/stat.h>
> > +#include <asm/io.h>
> >  #include <fs.h>
> >
> >  static struct fec_platform_data fec_info = {
> > @@ -43,6 +44,14 @@ static int devices_init (void)
> >  	struct stat s;
> >  	int ret;
> >
> > +#if CFG_MPC5XXX_CLKIN == 33333000
> > +	/*
> > +	 * Make USB work due to the special base crystal frequency:
> > +	 * 33,3330MHz * 16 = 533,328MHz main clock, but should be 528 MHz Clock
> > +	 */
> > +	out_be32((void *)MPC5XXX_CDM_48_FDC, 0x00015555);
> > +#endif
>
> What's the point of having this #if? It's always true.

From my notes back from 2008 this tweak is only required if the reference 
frequency is 33,333 MHz. And AFAIK there are 33,333333 MHz variants of the 
PCM030 out in the wild (or 33,0 MHz?).

But checking other platform's code the value written seems more or less random. 
The only important thing seems to be: this register must be setup. Its reset 
value is 0x00000000 and the kernel does not touch this register.

I will remove the #if/#endif in v2.

jbe

-- 
Pengutronix e.K.                              | Juergen Borleis             |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-07-27  7:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 13:42 [PATCH] PowerPC/MPC5200 Juergen Borleis
2015-07-24 13:42 ` [PATCH 1/5] PPC/MPC52xx: add some useful GPIO definitions Juergen Borleis
2015-07-24 13:42 ` [PATCH 2/5] Devicetree/PPC: fix devicetree's fixup Juergen Borleis
2015-07-24 13:42 ` [PATCH 3/5] PPC/PCM030: remove nowhere used definitions Juergen Borleis
2015-07-24 13:42 ` [PATCH 4/5] PPC/PCM030: fix reference clock Juergen Borleis
2015-07-27  5:42   ` Sascha Hauer
2015-07-27  7:55     ` Juergen Borleis [this message]
2015-07-24 13:42 ` [PATCH 5/5] PPC/PCM030: enable USB/OHCI pin support Juergen Borleis

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=201507270955.33333.jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=barebox@lists.infradead.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