Skip to contentSkip to conversation

rockchip: rk3188: add rk_board_late_init() hook

PATCH In review Alexander Kochetkov 3 participants 8 messages Feb 26, 2018 – Jul 13, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rockchip: rk3188: add rk_board_late_init() hook

All other rockchip boards have rk_board_late_init() hook, so add it to rk3188 boards also.

---
 arch/arm/mach-rockchip/rk3188-board.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3188-board.c +6 -1
index 916d18f..fc58aeb 100644
@@ -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)
Signature · 1 line
1.7.9.5
#1 lore raw

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

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.

Quoted 38 lines · Alexander Kochetkov

All other rockchip boards have rk_board_late_init() hook, so add it to rk3188 boards also.

---
arch/arm/mach-rockchip/rk3188-board.c | 7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3188-board.c +6 -1
index 916d18f..fc58aeb 100644
@@ -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)
Signature · 1 line
1.7.9.5
#2 lore raw

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

In reply to Dr. Philipp Tomsich

Simon,

ping?

Thanks,
Philipp.

Quoted 65 lines · Dr. Philipp Tomsich

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.

Quoted 38 lines · Alexander Kochetkov

All other rockchip boards have rk_board_late_init() hook, so add it to rk3188 boards also.

---
arch/arm/mach-rockchip/rk3188-board.c | 7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3188-board.c +6 -1
index 916d18f..fc58aeb 100644
@@ -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)
Signature · 1 line
1.7.9.5

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#3 lore raw

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

In reply to Dr. Philipp Tomsich

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

Quoted 59 lines · Dr. Philipp Tomsich

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.

Quoted 38 lines · Alexander Kochetkov

All other rockchip boards have rk_board_late_init() hook, so add it to rk3188 boards also.

---
arch/arm/mach-rockchip/rk3188-board.c | 7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3188-board.c +6 -1
index 916d18f..fc58aeb 100644
@@ -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)
Signature · 1 line
1.7.9.5
#4 lore raw

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

Quoted 4 lines

20 марта 2018 г., в 17:03, Kever Yang <[email protected]> написал(а):

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

Hello, Kever!
Please cc me on your patch series.

Regards,
Alexander.