From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Consolidate bootcount code into drivers/bootcount
Date: Fri, 1 Jun 2012 15:05:17 +0200 [thread overview]
Message-ID: <201206011505.17460.sr@denx.de> (raw)
In-Reply-To: <CABkLObrPpLj6nWJWBNEuhStGeSLBGfnCRmoFUmA9NZvH6ziceQ@mail.gmail.com>
Hi Christian,
On Friday 01 June 2012 14:51:32 Christian Riesch wrote:
> > +void bootcount_store(ulong a)
> > +{
> > + struct davinci_rtc *reg =
> > + (struct davinci_rtc *)CONFIG_SYS_BOOTCOUNT_ADDR;
> > +
> > + /*
> > + * write RTC kick register to enable write
> > + * for RTC Scratch registers. Scratch0 and 1 are
> > + * used for bootcount values.
> > + */
> > + writel(RTC_KICK0R_WE, ®->kick0r);
> > + writel(RTC_KICK1R_WE, ®->kick1r);
> > + out_be32(®->scratch0, a);
> > + out_be32(®->scratch1, BOOTCOUNT_MAGIC);
>
> This code here seems to be copied from the enbw_cmc board. The
> calimain board uses writel instead of out_be32 for the scratch
> registers (because I didn't understand why we should use big endian on
> a little endian machine). So your patch changes the byte order here
> for the calimain board and thus breaks our boot counter support.
I missed this difference. Thanks for spotting.
> What's the reason for using out_be32 here?
I assume historical reasons, as all this bootcounter code is originated from
powerpc specific code. Heiko, is this correct?
> > +}
> > +
> > +ulong bootcount_load(void)
> > +{
> > + struct davinci_rtc *reg =
> > + (struct davinci_rtc *)CONFIG_SYS_BOOTCOUNT_ADDR;
> > +
> > + if (in_be32(®->scratch1) != BOOTCOUNT_MAGIC)
> > + return 0;
> > + else
> > + return in_be32(®->scratch0);
>
> Same as above, the calimain board uses readl instead of in_be32.
>
> I replaced out_be32 by writel and in_be32 by readl and tested it on
> the calimain board, it works fine :-)
I see. Too bad, now we have two Davince boards using nearly the same driver,
one little endian and one big endian. If none of both boards can be changed,
then we need to add an configuration switch to select the endianess.
Heiko? Any comments?
Thanks,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
prev parent reply other threads:[~2012-06-01 13:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-01 9:52 [U-Boot] [PATCH] Consolidate bootcount code into drivers/bootcount Stefan Roese
2012-06-01 12:51 ` Christian Riesch
2012-06-01 13:05 ` Stefan Roese [this message]
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=201206011505.17460.sr@denx.de \
--to=sr@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