diff mbox series

[v3,4/6] rockchip: tpl: change call condition rockchip_stimer_init()

Message ID 20211230164825.6489-4-jbx6244@gmail.com
State Superseded
Delegated to: Kever Yang
Headers show
Series [v3,1/6] rockchip: move ROCKCHIP_STIMER_BASE to Kconfig | expand

Commit Message

Johan Jonker Dec. 30, 2021, 4:48 p.m. UTC
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>
---

Changed V3:
  use CONFIG_ROCKCHIP_STIMER

Changed V2:
  use IS_ENABLED
  add include kconfig.h
  move define location so that rockchip_stimer_init() is always
  visible to the compiler
---
 arch/arm/mach-rockchip/tpl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Simon Glass Jan. 12, 2022, 8:03 p.m. UTC | #1
On Thu, 30 Dec 2021 at 09:48, 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>
> ---
>
> Changed V3:
>   use CONFIG_ROCKCHIP_STIMER
>
> Changed V2:
>   use IS_ENABLED
>   add include kconfig.h
>   move define location so that rockchip_stimer_init() is always
>   visible to the compiler
> ---
>  arch/arm/mach-rockchip/tpl.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c
index 3c007bb4..2b561264 100644
--- a/arch/arm/mach-rockchip/tpl.c
+++ b/arch/arm/mach-rockchip/tpl.c
@@ -15,6 +15,7 @@ 
 #include <asm/io.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <linux/bitops.h>
+#include <linux/kconfig.h>
 
 #if CONFIG_IS_ENABLED(BANNER_PRINT)
 #include <timestamp.h>
@@ -29,6 +30,7 @@ 
 
 __weak void rockchip_stimer_init(void)
 {
+#if defined(CONFIG_ROCKCHIP_STIMER_BASE)
 	/* If Timer already enabled, don't re-init it */
 	u32 reg = readl(CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
 
@@ -45,6 +47,7 @@  __weak void rockchip_stimer_init(void)
 	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
 	writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
 	       TIMER_CONTROL_REG);
+#endif
 }
 
 void board_init_f(ulong dummy)
@@ -74,7 +77,9 @@  void board_init_f(ulong dummy)
 	}
 
 	/* Init secure timer */
-	rockchip_stimer_init();
+	if (IS_ENABLED(CONFIG_ROCKCHIP_STIMER))
+		rockchip_stimer_init();
+
 	/* Init ARM arch timer in arch/arm/cpu/ */
 	timer_init();