public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] 83xx and LCRR setting
Date: Mon, 24 Aug 2009 12:15:39 +0200	[thread overview]
Message-ID: <m2my5p7c1g.fsf@ohwell.denx.de> (raw)
In-Reply-To: <4A8F90FB.7030409@denx.de> (Heiko Schocher's message of "Sat, 22 Aug 2009 08:32:27 +0200")

Hi Heiko,

> Hello Kim,
>
> Kim Phillips wrote:
>> On Thu, 20 Aug 2009 13:03:09 +0200
>> Detlev Zundel <dzu@denx.de> wrote:
>> 
>>> 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
>> 
>> ack.
>
> nack, it should be
>
> #if !defined(LCCR_MASK)
> #define LCCR_MASK 0x00000000
> #endif
>
> because I did:
>
> +#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
>
> but I can do of course a:
>
> +	/* LCRR - Clock Ratio Register (10.3.1.14) */
> +	im->lbus.lcrr = (im->lbus.lcrr & ~LCRR_MASK) | \
> +			(CONFIG_SYS_LCRR & LCRR_MASK);
>
> Which way is prefered?

Personally I'd prefer the latter, as I expect a bitmask to specifiy
which bits I'm allowed to _write_.

> But I am not sure if this is necessary, I prefer here the conditional
> in code, because, if I port a new board to u-boot, I immidiately
> see, there is something special, if I have an 832x ... and this
> construct is not so ugly I think ...

Well, I really do not see any need for a conditional _in code_.
Remember, such conditionals multiply the number of possible "source
input to the compiler" by two, i.e. they double correct testing whereas
different constants usually preserve the c level input to the compiler.

>>> This really depends if and how this applies to the other members of the
>>> 83xx family.
>> 
>> they're all the same, really.
>
> OK, if it is so ;-)

Then why not put this into mpc83xx.h?

>>> And, by the way, we should _really_ be using accessor macros all around
>>> ;)
>> 
>> actually LCRR itself has specific instructions that say if written, it
>> then should be read, and then an isync be issued.
>
> Hmm.. actual code did not this! Where is this documented? And shouldn;t
> we update this in code?

Of course "we" should update this ;)

Cheers
  Detlev

-- 
Greenspun's Tenth Rule of Programming: "Any sufficiently complicated C
or Fortran program contains an ad-hoc, informally-specified bug-ridden
slow implementation of half of Common Lisp."
--
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

  reply	other threads:[~2009-08-24 10:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18 13:23 [U-Boot] 83xx and LCRR setting Heiko Schocher
2009-08-20  0:31 ` Kim Phillips
2009-08-20  5:45   ` Heiko Schocher
2009-08-20 10:05   ` Heiko Schocher
2009-08-20 11:03     ` Detlev Zundel
2009-08-21 20:56       ` Kim Phillips
2009-08-22  6:32         ` Heiko Schocher
2009-08-24 10:15           ` Detlev Zundel [this message]
2009-08-24 16:43             ` Kim Phillips
2009-08-21 20:55     ` Kim Phillips
2009-08-22  6:17       ` Heiko Schocher
2009-08-24 16:32         ` Kim Phillips

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=m2my5p7c1g.fsf@ohwell.denx.de \
    --to=dzu@denx.de \
    --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