[PATCH 1/4] rockchip: px30: use rockchip_stimer_init from spl_common.o for TPL

Quentin Schulz foss+uboot at 0leil.net
Tue Oct 28 17:57:34 CET 2025


From: Quentin Schulz <quentin.schulz at cherry.de>

Instead of redefining what is essentially the same code in
secure_timer_init, let's simply use rockchip_stimer_init from
spl_common.o instead.

This increases the size of the TPL by 16B, due to the added check of
STIMER already being enabled. Experimentally, STIMER is not already
enabled when in TPL.

Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
---
 arch/arm/mach-rockchip/Makefile         |  2 +-
 arch/arm/mach-rockchip/px30-board-tpl.c | 28 +++-------------------------
 2 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index ae15a9f8a2d..4c424091585 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -11,7 +11,7 @@ obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
 obj-spl-$(CONFIG_SPL_ROCKCHIP_COMMON_BOARD) += spl.o spl-boot-order.o spl_common.o
 obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
 obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o spl_common.o
-obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o
+obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o spl_common.o
 
 obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
 
diff --git a/arch/arm/mach-rockchip/px30-board-tpl.c b/arch/arm/mach-rockchip/px30-board-tpl.c
index f0b3c5f83f4..2a3dcdac845 100644
--- a/arch/arm/mach-rockchip/px30-board-tpl.c
+++ b/arch/arm/mach-rockchip/px30-board-tpl.c
@@ -4,32 +4,9 @@
  */
 
 #include <debug_uart.h>
-#include <dm.h>
-#include <init.h>
-#include <ram.h>
-#include <spl.h>
-#include <asm/io.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/arch-rockchip/sdram_px30.h>
-
-#define TIMER_LOAD_COUNT0	0x00
-#define TIMER_LOAD_COUNT1	0x04
-#define TIMER_CUR_VALUE0	0x08
-#define TIMER_CUR_VALUE1	0x0c
-#define TIMER_CONTROL_REG	0x10
-
-#define TIMER_EN	0x1
-#define	TIMER_FMODE	(0 << 1)
-#define	TIMER_RMODE	(1 << 1)
-
-void secure_timer_init(void)
-{
-	writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
-	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_LOAD_COUNT0);
-	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_LOAD_COUNT1);
-	writel(TIMER_EN | TIMER_FMODE,
-	       CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
-}
+#include <asm/arch-rockchip/timer.h>
 
 void board_init_f(ulong dummy)
 {
@@ -50,7 +27,8 @@ void board_init_f(ulong dummy)
 #endif
 #endif
 
-	secure_timer_init();
+	rockchip_stimer_init();
+
 	ret = sdram_init();
 	if (ret)
 		printascii("sdram_init failed\n");

-- 
2.51.0



More information about the U-Boot mailing list