]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
rockchip: px30: use rockchip_stimer_init from spl_common.o for TPL
authorQuentin Schulz <quentin.schulz@cherry.de>
Tue, 28 Oct 2025 16:57:34 +0000 (17:57 +0100)
committerTom Rini <trini@konsulko.com>
Sun, 2 Nov 2025 18:15:23 +0000 (12:15 -0600)
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@cherry.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/mach-rockchip/Makefile
arch/arm/mach-rockchip/px30-board-tpl.c

index ae15a9f8a2daabccee32c96f6b84b314263d9e93..4c424091585eac92872fc3d26d00e8df54e148cc 100644 (file)
@@ -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
 
index f0b3c5f83f47868869ffcd97e9b4ae161f23a6f3..2a3dcdac845d83630b5bd627097d5ebef8f6e5cd 100644 (file)
@@ -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");