[U-Boot] 83xx and LCRR setting

Detlev Zundel dzu at denx.de
Thu Aug 20 13:03:09 CEST 2009


Hi Heiko,

> I stumbled over this, just because I didn;t set this
> LCRR_DBYP bit, which the CPU sets after a reset, so
> what Do you think about this patch?
>
> 832x, LCRR: change only the valid bits for this register
>
> Signed-off-by: Heiko Schocher <hs at denx.de>
> ---
>  cpu/mpc83xx/cpu_init.c    |    6 ++++++
>  include/asm-ppc/fsl_lbc.h |    4 ++++
>  2 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/cpu/mpc83xx/cpu_init.c b/cpu/mpc83xx/cpu_init.c
> index ea4f2af..b5f64a8 100644
> --- a/cpu/mpc83xx/cpu_init.c
> +++ b/cpu/mpc83xx/cpu_init.c
> @@ -193,8 +193,14 @@ void cpu_init_f (volatile immap_t * im)
>  	 */
>  	im->reset.rmr = (RMR_CSRE & (1<<RMR_CSRE_SHIFT));
>
> +#if defined(CONFIG_MPC832x)
> +	/* LCRR - Clock Ratio Register (10.3.1.14) */
> +	im->lbus.lcrr = (im->lbus.lcrr & LCRR_MASK) | \
> +			(CONFIG_SYS_LCRR & ~LCRR_MASK);
> +#else
>  	/* LCRR - Clock Ratio Register (10.3.1.16) */
>  	im->lbus.lcrr = CONFIG_SYS_LCRR;
> +#endif

Please don't invent yet another conditional here.  Why not do a 
#if defined LCCR_MASK
...
#endif

or maybe even always use the mask, define it in the board config and do
a

#if !defined(LCCR_MASK)
#define LCCR_MASK 0xFFFFFFFF
#endif

This really depends if and how this applies to the other members of the
83xx family.

And, by the way, we should _really_ be using accessor macros all around
;)

Cheers
  Detlev

-- 
Bacchus, n. A convenient deity invented by the ancients as an excuse for
getting drunk.
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the U-Boot mailing list