[U-Boot] [PATCH v2 05/21] pmic: Introduce power_board_init() method at ./lib/board.c file

Stefano Babic sbabic at denx.de
Tue Oct 9 13:34:35 CEST 2012


On 09/10/2012 12:25, Lukasz Majewski wrote:

>> Now you want to add a new one. This means we have cases where the PMIC
>> must be initialized before flash, right ?
> 
> The case is that PMIC (and other devices) needs to be setup after
> malloc init and before MMC (in our case).
> The board_init() is before malloc init and board_late_init() is after
> MMC initialization for which working PMIC is necessary.
> PMIC_v1 works since there is a single, static instance of PMIC device
> (no lists needed).

Ok

> 
> 
> Filling the above gap was my motivation to define special callback
> for power.
> 
> In the ./arch/arm/lib/board.c there is 
> #ifdef CONFIG_ARCH_EARLY_INIT_R
> 	arch_early_init_r();
> #endif

arch_early_init_r has nothing to do with power management

> 
> Which could be used and defined at e.g. ./boards/samsung/trats.c
> However it is only ARM specific (not available at PPC) and the name is
> a bit misleading. (frankly speaking it is a dead code).

Agree

>>
>> We use often the "weak" mechanism to avoid that a board maintainer is
>> constrained to implement an empty function only to make happy the
>> linker. It is better to declare the function as weak and call it with
>> the same schema, such as board_power_init() (several board_* are weak)
> 
> Correct me if I'm wrong, but weren't we recently trying to remove
> functions defined as weak?

I am not aware of it. I see several patches in last days adding weak
function. Several weak function are present in the recent added SPL
framework.

> One of arguments was that weak function will
> allow to build a u-boot.bin, which then crash at null pointer
> dereference when proper CONFIG not selected.  

I think that if there is a general agreement to drop the weak functions,
this must be done coherent for the whole code. However, I have not seen
that weak functions are rejected, and they are currently used in many parts.


>> Do we need a config option only for calling this ? I think that the
>> decision can be taken with CONFIG_PMIC, declaring the function as
>> weak.
> 
> This is one of options -> __weak power_board_init() would be defined
> when no CONFIG_PMIC defined.
> Good idea, since one CONFIG_POWER_* option would be removed. 

Right


Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list