public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] ARmv7: Add a soc_init hook to start.S
Date: Wed, 4 Feb 2015 09:48:32 +0100	[thread overview]
Message-ID: <20150204094832.4d848e3d@lilith> (raw)
In-Reply-To: <20150202185657.GH10826@bill-the-cat>

Hello Tom,

On Mon, 2 Feb 2015 13:56:57 -0500, Tom Rini <trini@ti.com> wrote:

> And (and this is being split into
> different email threads, sigh), it would be good, possibly, if we have
> something that means "very early init things, but we can be written in
> C".

"Very early" -- and "early" too, BTW -- is way too vague for me to be
sure we're talking about the same thing, so let's find out what various
earlinesses mean to us. My own view:

"Starting early": the 'start', or 'reset', entry point, can't get
earlier than that. This is where U-Boot resets the target to a known
state (cache disable and invalidate, for instance). For some SoCs, at
this point core registers have to be saved somewhere because they
contain informative values that we want to keep, so we need to be able
to hook this stage. There is no C environment.

"Flipping early": after the entry point but before the DDR is usable.
That's where PLLs/clocks are set up minimaly to get going and have
access to the needed resources including DDR. Still no C environment.

"Effing early": after the DDR was made usable but before relocation.
That's when board_init_f() starts. It's there to get the relocation
right. We have a C environment of sorts, with a stack but without
writable data and without BSS; only GD is writable. That's because
the current *running* address may be in Flash, hence the "_f".
Code called from board_init_f() may set up some more PLLs/clocks,
devices, peripherals, etc. as long as it's needed for relocation
(e.g. querying a display's characteristics in order to compute how
much memory it will reserve from top).

"Erring early": after relocation. That's board_init_r. We have a
full C environment and we're running entirely from RAM ("_r"). 
There, U-Boot does whatever initializations are still needed to
get the payload running.

The actual setting up of environments between stages is supposed
to happen in some architecture code -- for ARM it would all be in
arch/arm/lib/crt0.S.

(if more official names were needed -- and my point sort of *is*
that they /are/ needed, to replace all these "early something"
names we've been using so far -- I'd suggest "reset", "init",
"layout" and "run" respectively.)

So... for me, Tom, your "very early but written in C" maps to my
"effing early" / "layout"; something that has to run first in that
stage should just be first in init_sequence_f[]. OTOH, it /cannot/
be something needed to reset or initialize the target.

Now, /some/ SoCs might be able to set up a C environment of sorts in
place between the "reset" and "init" phases - SRAM, locked cache...
This could be invoked before calling the "init" stage. Generic init
code would not assume any C env, but SoC init code would be able to
use it.

Comments?

> -- 
> Tom

Amicalement,
-- 
Albert.

  parent reply	other threads:[~2015-02-04  8:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 20:03 [U-Boot] [PATCH 1/3] ARmv7: Add a soc_init hook to start.S Hans de Goede
2015-01-21 20:03 ` [U-Boot] [PATCH 2/3] ARMv7: Add a cpu_init_cortex_a7 helper function Hans de Goede
2015-01-21 20:03 ` [U-Boot] [PATCH 3/3] sunxi: Switch to using soc_init hook for setting the ACTLR.SMP bit Hans de Goede
2015-02-08  5:42   ` Ian Campbell
2015-01-21 21:59 ` [U-Boot] [PATCH 1/3] ARmv7: Add a soc_init hook to start.S Bill Pringlemeir
2015-01-22 13:29   ` Hans de Goede
2015-01-22 15:48     ` Bill Pringlemeir
2015-01-22 16:20 ` Tom Rini
2015-01-22 19:10   ` Hans de Goede
2015-01-22 21:03     ` Tom Rini
2015-01-23  8:54       ` Hans de Goede
2015-01-26 15:18         ` Tom Rini
2015-01-26 19:32           ` Hans de Goede
2015-01-27 14:23             ` Tom Rini
2015-01-31 21:25               ` Albert ARIBAUD
2015-01-31 21:49                 ` Tom Rini
2015-01-31 22:14                   ` Simon Glass
2015-02-02 18:56                     ` Tom Rini
2015-02-02 19:26                       ` Simon Glass
2015-02-04  8:48                       ` Albert ARIBAUD [this message]
2015-02-05  3:00                         ` Simon Glass
2015-02-05  8:27                           ` Hans de Goede
2015-02-05 15:14                           ` Albert ARIBAUD
2015-02-05 15:34                             ` Simon Glass
2015-02-05 18:02                               ` Albert ARIBAUD
2015-02-05 19:13                                 ` Simon Glass
2015-02-10 22:07                         ` Tom Rini
2015-02-10 23:27                           ` Simon Glass
2015-01-26  8:09   ` Albert ARIBAUD
2015-01-26 10:50     ` Hans de Goede

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=20150204094832.4d848e3d@lilith \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox