[U-Boot] [PATCH 3/9] arm: Move CP15 init out of cpu_init_crit()

Albert ARIBAUD albert.u.boot at aribaud.net
Sat Oct 22 09:56:40 CEST 2011


Le 22/10/2011 07:05, Simon Glass a écrit :

>>> Well I actually haven't moved it! It is just that previously it was
>>> impossible to call cp15_init from anywhere later.
>>
>> It is moved, in that it belongs to low level init... of A9.
>
> OK, I see - you mean moved in order if not in source code file.

Yes. In the code, though, it belongs to low-level init.

>>> What you say can be done, it would involve some assembler though and
>>> would need to be another CONFIG option. Was trying to avoid adding new
>>> assembler.
>>
>> Low level init is about assembler and, well, low level. :)
>
> Yes but it's yuck. Part of the clean-up is to remove most of the
> assembler - really very little is needed.

I don't think "yuck" is a valid reasoned argument against assembly 
language :) but I assume what you mainly mean is 'hard to understand and 
replaceable by easy to understand C code'. I agree to the first part, 
and to the second one for the general case, but not for the startup path 
where, precisely, we don't have a working C run-time and most of the 
understanding requires knowledge of hardware, not only general 
programming knowledge. Past that, C is ok -- but then beware: some C++ 
guy could chime in and contend that C is "yuck" by your own standards. :)

>> But I don't see why there should be another CONFIG option. IIUC, you should
>> be able to do with only CONFIG_SKIP_LOWLEVEL_INIT: within the low level init
>> code under it, you would do the equivalent of a switch, with one branch for
>> AVM (and DDR init etc) and one branch for A9 (with cp15 init etc).
>
> Yes I can, but I need to be able to call cp15_init. And I can't do
> that because if CONFIG_SKIP_LOWLEVEL_INIT is defined, that code is
> compiled out! So I need to move that cp15_init code outside the
> CONFIG_SKIP_LOWLEVEL_INIT #ifdef. That is all I am trying to do,
> honest!

I understand, and I think the approach here is wrong, because you *do* 
want low-level init in the A9 case, and thus you should not have 
CONFIG_SKIP_LOWLEVEL_INIT set. But you also need the AVP low-level init 
to be empty, and the AVP and A9 must follow the same startup path. And 
all this it not necessarily required for all armv7 platforms, but some 
of them will want lowlevel init, and some not. Considering all this...

For now, I would opt for a CONFIG_ARCH_GENERIC_LOWLEVEL_INIT option 
which start.S would use to compile out the low level init code 
definition (like CONFIG_SKIP_LOWLEVEL_INIT does) but not the the calls 
to it (UNline CONFIG_SKIP_LOWLEVEL_INIT does). Then you could provide a 
SoC-specific version of lowlevel_init.

In the longer term, I would be more in favor of a weak definition system 
with hierarchical ARCH, ISA, SoC, board priority order (yes, I am kind 
of fond of it) for lowlevel init -- but that will require looking into 
asm weak symbol handling and may require splitting of the assembly code 
function by function.

> Regards,
> Simon

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list