[U-Boot] [PATCH 1/3] ARM: lib: Remove CONFIG_ARCH_CPU_INIT dependency

Albert ARIBAUD albert.u.boot at aribaud.net
Thu Mar 1 22:44:09 CET 2012

Le 01/03/2012 21:57, Fabio Estevam a écrit :
> On Thu, Mar 1, 2012 at 5:51 PM, Albert ARIBAUD
> <albert.u.boot at aribaud.net>  wrote:
>> This adds (some) (functionally dead) code to all boards that did not require
>> arch_cpu_init().
> Yes, it adds a "return 0" only. Is this terribly bad?


> Isn't it better than having to select CONFIG_ARCH_CPU_INIT for every
> board to select arch_cpu_init(), which is supposed to be CPU
> dependent?

It adds a "#define CONFIG_ARCH_CPU_INTI" only. Is this terribly bad ?

If what bothers you is that some board all repeat something that should 
be done only once, then it should bother you just as much that many 
boards repeat something that should not be done at all most of the time.

I understand that you see a repetition of CONFIG_ARCH_CPU_INIT that you 
suspect is highly redundant. But then, you should cure the repetition, 
not the existence of CONFIG_ARCH_CPU_INIT.

How about this approach: since the problem is the presence of CPU- (or 
Soc-)level elements in board-level config files, and since there are 
probably many other such items in board config files (CPU type in a SoC 
and HW IP configurations, for instance) then why not introduce some 
cpu-config and soc-config file which would group all those cpu- (resp 
soc-)level items, including any "#define CONFIG_ARCH_CPU_INIT", and 
replace these items in board config files with a single "#include 
"<cpu>-config.h" (or "<soc>-config.h")? This would significantly reduce 
board config file size.

One could even choose either of two courses depending on how many or how 
few boards require CONFIG_ARCH_CPU_INIT: if many boards require it, let 
the cpu- or soc-common config contain the define, and the few boards 
which don't will have to explicitly undefine it; if only a few boards 
need the define, then it won't be done in the cpu- or soc-common config 
but in each board that requires it.

And CPUs, SoCs and boards that don't need ARCH_CPU_INIT at all won't 
grow a single useless byte.


More information about the U-Boot mailing list