[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 10:54:09 CEST 2012


On 05/10/2012 10:16, Lukasz Majewski wrote:
> It is necessary to introduce a new system wide function- power_board_init()
> 
> It turns out, that power initialization must be done as early as possible.
> In the case of PMIC framework redesign, which aims to support multiple
> instances of PMIC devices the initialization shall be performed just
> after malloc configuration.
> 
> The arch_early_init_r() could be used instead, but it doesn't reflect
> that the "power" subsystem is going to be initialized.
> 
> Signed-off-by: Lukasz Majewski <l.majewski at samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
> ---
> Changes for v2:
> - None

Hi Lucasz,

only to make some order. We have already several entries that calls
board specific functions.

There is at least board_init() and board_late_init(). The last one was
use mostly for the pmic initialization up nowm because it is called
after malloc_init().

Now you want to add a new one. This means we have cases where the PMIC
must be initialized before flash, right ?

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)

> ---
>  arch/arm/lib/board.c |    4 ++++
>  include/common.h     |    3 +++
>  2 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index 109a1ac..431ef5b 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -513,6 +513,10 @@ void board_init_r(gd_t *id, ulong dest_addr)
>  	arch_early_init_r();
>  #endif
>  
> +#ifdef CONFIG_POWER_INIT
> +	power_board_init();

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.

> +#endif
> +
>  #if !defined(CONFIG_SYS_NO_FLASH)
>  	puts("Flash: ");
>  
> diff --git a/include/common.h b/include/common.h
> index a7fb05e..5cc859f 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -487,6 +487,9 @@ int board_late_init (void);
>  int board_postclk_init (void); /* after clocks/timebase, before env/serial */
>  int board_early_init_r (void);
>  void board_poweroff (void);
> +#ifdef CONFIG_POWER_INIT
> +int power_board_init(void);
> +#endif
>  
>  #if defined(CONFIG_SYS_DRAM_TEST)
>  int testdram(void);
> 

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