[PATCH v1 1/2] rockchip: spl: change call condition rockchip_stimer_init()

The Rockchip SoCs rk3066/rk3188 have no CONFIG_ROCKCHIP_STIMER_BASE defined. Currently only rk3188 has an exception. Make this more generic and call the function rockchip_stimer_init() only when CONFIG_ROCKCHIP_STIMER_BASE is available.
Signed-off-by: Johan Jonker jbx6244@gmail.com --- arch/arm/mach-rockchip/spl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c index 02c40fb3..4b8b0b39 100644 --- a/arch/arm/mach-rockchip/spl.c +++ b/arch/arm/mach-rockchip/spl.c @@ -70,7 +70,7 @@ u32 spl_mmc_boot_mode(const u32 boot_device) return MMCSD_MODE_RAW; }
-#if !defined(CONFIG_ROCKCHIP_RK3188) +#if defined(CONFIG_ROCKCHIP_STIMER_BASE) #define TIMER_LOAD_COUNT_L 0x00 #define TIMER_LOAD_COUNT_H 0x04 #define TIMER_CONTROL_REG 0x10 @@ -132,9 +132,12 @@ void board_init_f(ulong dummy) hang(); } arch_cpu_init(); -#if !defined(CONFIG_ROCKCHIP_RK3188) + +#if defined(CONFIG_ROCKCHIP_STIMER_BASE) + /* Init secure timer */ rockchip_stimer_init(); #endif + #ifdef CONFIG_SYS_ARCH_TIMER /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */ timer_init();

The Rockchip SoCs rk3066/rk3188 have no CONFIG_ROCKCHIP_STIMER_BASE defined. Currently only rk3188 has an exception. Make this more generic and call the function rockchip_stimer_init() only when CONFIG_ROCKCHIP_STIMER_BASE is available.
Signed-off-by: Johan Jonker jbx6244@gmail.com --- arch/arm/mach-rockchip/tpl.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c index 3c007bb4..2c5ce969 100644 --- a/arch/arm/mach-rockchip/tpl.c +++ b/arch/arm/mach-rockchip/tpl.c @@ -20,6 +20,7 @@ #include <timestamp.h> #endif
+#if defined(CONFIG_ROCKCHIP_STIMER_BASE) #define TIMER_LOAD_COUNT_L 0x00 #define TIMER_LOAD_COUNT_H 0x04 #define TIMER_CONTROL_REG 0x10 @@ -46,6 +47,7 @@ __weak void rockchip_stimer_init(void) writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG); } +#endif
void board_init_f(ulong dummy) { @@ -73,8 +75,11 @@ void board_init_f(ulong dummy) hang(); }
+#if defined(CONFIG_ROCKCHIP_STIMER_BASE) /* Init secure timer */ rockchip_stimer_init(); +#endif + /* Init ARM arch timer in arch/arm/cpu/ */ timer_init();

Hi Johan,
On Sat, 25 Dec 2021 at 05:11, Johan Jonker jbx6244@gmail.com wrote:
The Rockchip SoCs rk3066/rk3188 have no CONFIG_ROCKCHIP_STIMER_BASE defined. Currently only rk3188 has an exception. Make this more generic and call the function rockchip_stimer_init() only when CONFIG_ROCKCHIP_STIMER_BASE is available.
Signed-off-by: Johan Jonker jbx6244@gmail.com
arch/arm/mach-rockchip/tpl.c | 5 +++++ 1 file changed, 5 insertions(+)
Can you use if(IS_ENABLED(...)) instead of #if ?
Regards, Simon

Hi Simon,
ROCKCHIP_STIMER_BASE are defined in include/configs/ px*/rk*_common.h and not in Kconfig.
The use of:
if(IS_ENABLED(CONFIG_ROCKCHIP_STIMER_BASE)) { //#if defined(CONFIG_ROCKCHIP_STIMER_BASE) /* Init secure timer */ rockchip_stimer_init(); //#endif }
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make mk808_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make all
Leeds to this warning:
arch/arm/mach-rockchip/spl.c: In function ‘board_init_f’: arch/arm/mach-rockchip/spl.c:139:2: warning: implicit declaration of function ‘rockchip_stimer_init’; did you mean ‘timer_init’? [-Wimplicit-function-declaration] rockchip_stimer_init(); ^~~~~~~~~~~~~~~~~~~~ timer_init
Somehow IS_ENABLED() doesn't seem to work here. Could you try it your self. Please advise for other possibilities.
Kind regards,
Johan Jonker
On 12/28/21 9:34 AM, Simon Glass wrote:
Hi Johan,
On Sat, 25 Dec 2021 at 05:11, Johan Jonker jbx6244@gmail.com wrote:
The Rockchip SoCs rk3066/rk3188 have no CONFIG_ROCKCHIP_STIMER_BASE defined. Currently only rk3188 has an exception. Make this more generic and call the function rockchip_stimer_init() only when CONFIG_ROCKCHIP_STIMER_BASE is available.
Signed-off-by: Johan Jonker jbx6244@gmail.com
arch/arm/mach-rockchip/tpl.c | 5 +++++ 1 file changed, 5 insertions(+)
Can you use if(IS_ENABLED(...)) instead of #if ?
Regards, Simon

Hi Johan,
On Tue, 28 Dec 2021 at 02:19, Johan Jonker jbx6244@gmail.com wrote:
Hi Simon,
ROCKCHIP_STIMER_BASE are defined in include/configs/ px*/rk*_common.h and not in Kconfig.
The use of:
if(IS_ENABLED(CONFIG_ROCKCHIP_STIMER_BASE)) { //#if defined(CONFIG_ROCKCHIP_STIMER_BASE) /* Init secure timer */ rockchip_stimer_init(); //#endif }
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make mk808_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make all
Leeds to this warning:
arch/arm/mach-rockchip/spl.c: In function ‘board_init_f’: arch/arm/mach-rockchip/spl.c:139:2: warning: implicit declaration of function ‘rockchip_stimer_init’; did you mean ‘timer_init’? [-Wimplicit-function-declaration] rockchip_stimer_init(); ^~~~~~~~~~~~~~~~~~~~ timer_init
Somehow IS_ENABLED() doesn't seem to work here. Could you try it your self. Please advise for other possibilities.
OK, well you can add a Kconfig and then use moveconfig.py to migrate automatically. Re the warning, just make sure the header file is included.
Regards, Simon
Kind regards,
Johan Jonker
On 12/28/21 9:34 AM, Simon Glass wrote:
Hi Johan,
On Sat, 25 Dec 2021 at 05:11, Johan Jonker jbx6244@gmail.com wrote:
The Rockchip SoCs rk3066/rk3188 have no CONFIG_ROCKCHIP_STIMER_BASE defined. Currently only rk3188 has an exception. Make this more generic and call the function rockchip_stimer_init() only when CONFIG_ROCKCHIP_STIMER_BASE is available.
Signed-off-by: Johan Jonker jbx6244@gmail.com
arch/arm/mach-rockchip/tpl.c | 5 +++++ 1 file changed, 5 insertions(+)
Can you use if(IS_ENABLED(...)) instead of #if ?
Regards, Simon

Hi Johan,
On Sat, 25 Dec 2021 at 05:11, Johan Jonker jbx6244@gmail.com wrote:
The Rockchip SoCs rk3066/rk3188 have no CONFIG_ROCKCHIP_STIMER_BASE defined. Currently only rk3188 has an exception. Make this more generic and call the function rockchip_stimer_init() only when CONFIG_ROCKCHIP_STIMER_BASE is available.
Signed-off-by: Johan Jonker jbx6244@gmail.com
arch/arm/mach-rockchip/spl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Can you use if(IS_ENABLED(...)) instead of #if ?
Regards, Simon
participants (2)
-
Johan Jonker
-
Simon Glass