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

Kever Yang kever.yang at rock-chips.com
Tue Mar 20 14:03:57 UTC 2018


Hi Philipp,

    Amount all the source code for support Rockchip SoCs which not using
DM, I think
are all in two kind folder:
- arch/arm/mach-rockchip/
- board/vendor/board-name/

    Looks like UCLASS_SOC and UCLASS_BOARD can take care of all these
source code into DM?
Well, it looks like each implement of SoCs in these two folder are not
the same, and you want
to 'format' them in the same implementation, is that what you want to
get from new UCLASS_*?

    I have a local version of using common board init, and we can remove
all the rkxx_board.c/rkxx_board_spl.c/rkxx_board_tpl.c,
and all the soc difference go into arch/arm/mach-rockchip/rkxx/rkxx.c,
and board specific setting
go to board/vendor/board/board.c.
    After this patch set, it's much clean now in my local branch and I'm
try to clean it and send
to list now. There is not much things in soc specific and board specific
setting, while hooks like
rk_board_late_init() still needed, but I'm not sure it worth to add
uclass for both soc and board.
    I think using board_init, board_late_init, arch_cpu_init from common
board_r/f is quite handy
for me now.

    Maybe we can discuss this again after I send my patches.

Thanks,
- Kever
On 02/26/2018 09:02 PM, Dr. Philipp Tomsich wrote:
> 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