[U-Boot] Moving the rk_board_late_init() hook to a device-model based implementation.

Dr. Philipp Tomsich philipp.tomsich at theobroma-systems.com
Mon Feb 26 13:02:02 UTC 2018


Simon & Kever,

We have the rk_board_late_init() hook for the Rockchip boards and I’d like to convert
these to some sort of device-model based implementation.

Here’s what I’d propose as a minimal implementation:
1.	Introduce a new UCLASS_BOARD
2.	Trigger on the top-level ‘compatible’ string (e.g. "tsd,rk3399-q7” for our RK3399-Q7 board) from the DTS.
3.	Provide ops for at least the following hooks:
		.board_late_init 	[used on Rockchip for setup_boot_mode() … or for calling rk_board_late_init]
		.board_init_f		[e.g. our DDR and SRAM security region setup]
		.board_fit_config_name_match

For a more full-fledged implementation, I would like to have a UCLASS_SOC in addition to the UCLASS_BOARD and iterate over the same list of compatible strings to find a UCLASS_SOC … then perform a two step-init: i.e. first the SOC, then the BOARD.
This would be used to have common init-code, such as what we have for the RK3399 in arch_cpu_init() — i.e. "Emmc clock generator: disable the clock multipilier”.

Thanks in advance for taking the time to review and comment,
—Philipp.


> On 26 Feb 2018, at 13:37, Alexander Kochetkov <al.kochet at gmail.com> wrote:
> 
> All other rockchip boards have rk_board_late_init() hook,
> so add it to rk3188 boards also.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet at gmail.com>
> ---
> arch/arm/mach-rockchip/rk3188-board.c |    7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-rockchip/rk3188-board.c b/arch/arm/mach-rockchip/rk3188-board.c
> index 916d18f..fc58aeb 100644
> --- a/arch/arm/mach-rockchip/rk3188-board.c
> +++ b/arch/arm/mach-rockchip/rk3188-board.c
> @@ -20,6 +20,11 @@
> 
> DECLARE_GLOBAL_DATA_PTR;
> 
> +__weak int rk_board_late_init(void)
> +{
> +	return 0;
> +}
> +
> int board_late_init(void)
> {
> 	struct rk3188_grf *grf;
> @@ -35,7 +40,7 @@ int board_late_init(void)
> 			NOC_REMAP_MASK << NOC_REMAP_SHIFT);
> 	}
> 
> -	return 0;
> +	return rk_board_late_init();
> }
> 
> int board_init(void)
> -- 
> 1.7.9.5
> 



More information about the U-Boot mailing list