From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] AT91: Defer Dataflash access to env_relocate_spec
Date: Fri, 12 Aug 2011 11:38:39 +0200 [thread overview]
Message-ID: <4E44F49F.3060102@aribaud.net> (raw)
In-Reply-To: <4E38FA8D.9080203@atmel.com>
On 03/08/2011 09:36, Hong Xu wrote:
> Hi Reinhard,
>
> On 08/03/2011 03:20 PM, Reinhard Meyer wrote:
>> Dear Hong Xu,
>> > When env_init is called, the SPI is not actually initialized in U-Boot.
>> > So that we can not read Dataflash for its content.
>> > We simply mark it OK for now, and defer the real work to
>> > `env_relocate_spec'. (Idealy from env_nand.c)
>> >
>> > Signed-off-by: Hong Xu<hong.xu@atmel.com>
>> > ---
>> > common/env_dataflash.c | 83
>> ++++++++++++++++++++++++++----------------------
>> > 1 files changed, 45 insertions(+), 38 deletions(-)
>>
>> I cannot really decide if that is a good approach. Where would be
>> the issue if SPI/dataflash were initialized at this point (before
>> relocation)?
>
> Currently the SPI is initialized in board_init which is called in
> board_init_r, but env_init is called in board_init_f. So actually the
> original code needs the SPI to be initialized before env_init, not
> before relocation.
>
> An alternative way is to put SPI initialization code in
> board_early_init_f. But I'm not sure if it's the correct way.
I guess this is a general issue: if some driver is needed to get access
to environment, then it must be initialized before relocation. But not
all boards need initialization this early, and conversively, for each
board-specific case where environment reading requires driver X, this
adds a *general* constraint of initializing X before relocation -- and
we'll end up initializing just about anything before reloc on boards
that do not actually need initializations this early.
Now this may not be feasible, but I think the idea is more "initialize
what is needed for relocation, then relocate, then initialize the rest.
Does anyone else here see this problem as I see it, or am I just being
over-nit-picking?
If it *is* a problem, then the only way I see to solve this is, for each
driver that *might* be initialized before reloc, to provide a
configuration option to select between initializing before or after
relocation (possibly with variations in the driver initialization code
based on this config option).
Or am I also over-engineering here?
Amicalement,
--
Albert.
next prev parent reply other threads:[~2011-08-12 9:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-03 7:01 [U-Boot] [PATCH] AT91: Defer Dataflash access to env_relocate_spec Hong Xu
2011-08-03 7:20 ` Reinhard Meyer
2011-08-03 7:36 ` Hong Xu
2011-08-12 9:38 ` Albert ARIBAUD [this message]
2011-08-24 21:55 ` Wolfgang Denk
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=4E44F49F.3060102@aribaud.net \
--to=albert.u.boot@aribaud.net \
--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 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.