diff mbox series

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

Message ID 20211225121131.17892-2-jbx6244@gmail.com
State Superseded
Delegated to: Kever Yang
Headers show
Series [v1,1/2] rockchip: spl: change call condition rockchip_stimer_init() | expand

Commit Message

Johan Jonker Dec. 25, 2021, 12:11 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>
---
 arch/arm/mach-rockchip/tpl.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Simon Glass Dec. 28, 2021, 8:34 a.m. UTC | #1
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
Johan Jonker Dec. 28, 2021, 9:18 a.m. UTC | #2
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
>
Simon Glass Dec. 29, 2021, 1:36 p.m. UTC | #3
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
> >
diff mbox series

Patch

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();