Skip to contentSkip to conversation

rockchip: spl: change call condition rockchip_stimer_init()

PATCH Superseded Johan Jonker 2 participants 6 messages Dec 25, 2021 – Dec 29, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 arch/arm/mach-rockchip/spl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/spl.c +5 -2
index 02c40fb3..4b8b0b39 100644
@@ -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();
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 rockchip: tpl: 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.

---
 arch/arm/mach-rockchip/tpl.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/mach-rockchip/tpl.c +5 -0
index 3c007bb4..2c5ce969 100644
@@ -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();
 
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH v1 2/2] rockchip: tpl: change call condition rockchip_stimer_init()

Hi Johan,

Quoted 10 lines · Johan Jonker

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.

---
 arch/arm/mach-rockchip/tpl.c | 5 +++++
 1 file changed, 5 insertions(+)

Can you use if(IS_ENABLED(...)) instead of #if ?

Regards,
Simon

#3 lore raw

Re: [PATCH v1 2/2] rockchip: tpl: change call condition rockchip_stimer_init()

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

Quoted 19 lines · Simon Glass

Hi Johan,

Quoted 10 lines · Johan Jonker

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.

---
 arch/arm/mach-rockchip/tpl.c | 5 +++++
 1 file changed, 5 insertions(+)

Can you use if(IS_ENABLED(...)) instead of #if ?

Regards,
Simon

#4 lore raw

Re: [PATCH v1 2/2] rockchip: tpl: change call condition rockchip_stimer_init()

Hi Johan,

Quoted 28 lines · Johan Jonker

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

Quoted 3 lines

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

Quoted 25 lines

Kind regards,

Johan Jonker

Quoted 19 lines · Simon Glass

Hi Johan,

Quoted 10 lines · Johan Jonker

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.

---
 arch/arm/mach-rockchip/tpl.c | 5 +++++
 1 file changed, 5 insertions(+)

Can you use if(IS_ENABLED(...)) instead of #if ?

Regards,
Simon

#5 lore raw
In reply to Johan Jonker

Hi Johan,

Quoted 10 lines · Johan Jonker

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.

---
 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