public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] initcall revisited - A new idea to discuss
Date: Sun, 08 Jan 2012 22:59:45 +1100	[thread overview]
Message-ID: <4F098531.8070403@gmail.com> (raw)
In-Reply-To: <CAPnjgZ0nWUw-1-EESVcikbbQjK=HH8Afh6QWC8a4PsmvdKCYYA@mail.gmail.com>

Hi Simon,

On 08/01/12 09:39, Simon Glass wrote:
> Hi Gururaja,
> 
> On Thu, Jan 5, 2012 at 11:25 PM, Hebbar, Gururaja
> <gururaja.hebbar@ti.com> wrote:
>> On Fri, Jan 06, 2012 at 12:05:40, Wolfgang Denk wrote:
>>> Dear "Hebbar, Gururaja",
>>>
>>
>> [snip]
>>
>>>>> _after_ the list has been created - If this breaks dependencies that's
>>>>> your problem ;). It is up to you as the 'skipper' to make sure that you
>>>>> add init functions to allow things to still work
>>>>
>>>> Won't this lead to lots of code duplication across all boards, archs.
>>>> So, tomorrow someone else will send a patch removing duplicate and merging
>>>> it to a common place.
>>>
>>> I don't see why that would happen?  I see no intention nor any need
>>> for duplicated code.
>>>
>>>> So, every board, even under same arch, needs to define its own *complete-set*
>>>> of INIT_CALL api's. I am dreaming about a lot of MB getting added to u-boot
>>>> src.
>>>
>>> What makes you think so?
>>
>> As mentioned before, the INIT_CALL code is to be added to each board file
>> for each arch, soc.
>> I was speaking of actual C Code. Every board needs serial, console, i2c and
>> many other common code. Wont they increase u-boot source size (in actual c
>> code size).
>> Every Board Maintainer will have almost same "x-lines-added" in the U-Boot
>> release statics/summary page.
>>
>> Kindly correct me if I am wrong.
> 
> I hope I understand you correctly. The idea is that the init list is
> specified for the architecture (or hopefully soon for the whole of
> U-Boot). Boards only need to mess with it if they want to add / remove
> something. Hopefully most boards won't do much at all with the init
> sequence.

Using the proposal, there is no 'architecture init sequence' like there is
now. Instead, everything that needs to be initialised before the main loop
simply states that fact be adding an instance of the INIT_FUNC macro which
specifies:
 - The name of the function to be called
 - The type of init being performed (console, sdram, fpga etc)
 - What type(s) of inits need to be performed before the named function can
   be called
 - What type(s) of inits the named function needs to be called before

A board can freely insert additional init steps by adding INIT_CALLs

A board can override a 'standard' init step by adding SKIP_INIT and the
replacement INIT_CALL

>>
>>>
>>>> Just a thought. Why don't split it to ARCH_INIT, BOARD_INIT,.
>>>
>>> Because it's not such an easy split. You can define such groups, like
>>> arch, SoC, board family, board.  But you cannot initialize the system
>>> in such grous - instead, initialization will jump around heavily
>>> between these groups, in a sequence that needs to be well defined, and
>>> that is often diofferent from board to board.
>>
>> Correct. Then Board maintainer will mention ARCH_INIT, SKIP_ARCH_INIT,
>> BOARD_INIT ...
>> By this way, Board maintainer can make use of common init calls between
>> ARCHs, SOCs and BOARDs.
> 
> See above, which hopefully contains what you need.
> 
> At the moment we have things like arch_cpu_init() and the like to do
> common init for an arch, soc. I think you are saying that the arch
> code should be able to add things to the init list without every board
> for that arch doing it explicitly. If so, then that's exactly what

Well, the arch code already can thanks to the init sequence being encoded
into arch/foo/lib/board.c

The problem is what if the CPU needs additional init, or the SoC, or a
single board that no other CPU/SoC/board under that arch needs? At the
moment, the solution is a combination of over-rideable weak functions and
#ifdefs


> Graeme's idea should achieve. The arch code will have several
> INITCALL() steps to achieve this. It actually lends itself quite well

Not only the arch code, but any code that needs to initialise something
prior to entering the main loop - This can include the arch, SoC, CPU,
board, chipset, drivers, etc...

So long term, we should see the mess that is the Ethernet and serial driver
init code cleaned up because each driver can simply add an INIT_FUNC

> to this requirement. Any file can put an INITCALL() in the sequence
> and the collection tool / linker tidy things up at the end. The boards
> should only have to worry about what they want to add/change for their
> own narrow purposes.

Exactly :)

Regards,

Graeme

  reply	other threads:[~2012-01-08 11:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-02 11:53 [U-Boot] initcall revisited - A new idea to discuss Graeme Russ
2012-01-02 14:49 ` Wolfgang Denk
2012-01-03 10:37   ` Graeme Russ
2012-01-03 14:44     ` Wolfgang Denk
2012-01-03 21:53       ` Graeme Russ
2012-01-05 22:18       ` Graeme Russ
2012-01-06  4:30         ` Simon Glass
2012-01-06  4:59           ` Graeme Russ
2012-01-06  5:41             ` Hebbar, Gururaja
2012-01-06  6:35               ` Wolfgang Denk
     [not found]                 ` <1BAFE6F6C881BF42822005164F1491C305D08F@DBDE01.ent.ti.com>
2012-01-07 22:39                   ` Simon Glass
2012-01-08 11:59                     ` Graeme Russ [this message]
2012-01-06  6:30             ` Wolfgang Denk
2012-01-03 16:04     ` Simon Glass
2012-01-03 22:36       ` Wolfgang Denk
2012-01-03 22:43         ` Simon Glass

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=4F098531.8070403@gmail.com \
    --to=graeme.russ@gmail.com \
    --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