[U-Boot] [U-Boot, 6/8] rockchip: rk3288: use ARM arch timer instead of rk_timer
Philipp Tomsich
philipp.tomsich at theobroma-systems.com
Thu Aug 30 20:43:18 UTC 2018
On Wed, 18 Apr 2018, Kever Yang wrote:
> We prefer to use ARM arch timer instead of rockchip timer, so that
> we are using the same timer for SPL, U-Boot and Kernel, which will
> make things simple and easy to track to boot time.
>
> Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
Same comments as for the other patches apply.
Thanks,
Philipp.
> ---
>
> arch/arm/mach-rockchip/Makefile | 2 +-
> arch/arm/mach-rockchip/rk3288-board-spl.c | 18 ++++++++++++++++--
> arch/arm/mach-rockchip/rk3288-board-tpl.c | 18 ++++++++++++++++--
> include/configs/rk3288_common.h | 6 +++---
> 4 files changed, 36 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
> index 02aa58a..86efd7b 100644
> --- a/arch/arm/mach-rockchip/Makefile
> +++ b/arch/arm/mach-rockchip/Makefile
> @@ -40,7 +40,7 @@ endif
> obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram_common.o
>
> ifndef CONFIG_ARM64
> -ifeq ($(CONFIG_ROCKCHIP_RK3188)$(CONFIG_ROCKCHIP_RK322X)$(CONFIG_ROCKCHIP_RK3036),)
> +ifeq ($(CONFIG_ROCKCHIP_RK3188)$(CONFIG_ROCKCHIP_RK322X)$(CONFIG_ROCKCHIP_RK3036)$(CONFIG_ROCKCHIP_RK3288),)
> obj-y += rk_timer.o
> endif
> endif
> diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c
> index f3ea624..8f22549 100644
> --- a/arch/arm/mach-rockchip/rk3288-board-spl.c
> +++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
> @@ -23,7 +23,6 @@
> #include <asm/arch/sdram.h>
> #include <asm/arch/sdram_common.h>
> #include <asm/arch/sys_proto.h>
> -#include <asm/arch/timer.h>
> #include <dm/pinctrl.h>
> #include <dm/root.h>
> #include <dm/test.h>
> @@ -143,6 +142,17 @@ static int phycore_init(void)
> }
> #endif
>
> +void rockchip_stimer_init(void)
> +{
> + asm volatile("mcr p15, 0, %0, c14, c0, 0"
> + : : "r"(COUNTER_FREQUENCY));
> +
> + writel(0, CONFIG_ROCKCHIP_STIMER_BASE + 0x10);
> + writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
> + writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
> + writel(1, CONFIG_ROCKCHIP_STIMER_BASE + 0x10);
> +}
> +
> void board_init_f(ulong dummy)
> {
> struct udevice *pinctrl;
> @@ -175,7 +185,11 @@ void board_init_f(ulong dummy)
> hang();
> }
>
> - rockchip_timer_init();
> + /* Init secure timer */
> + rockchip_stimer_init();
> + /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
> + timer_init();
> +
> configure_l2ctlr();
>
> ret = rockchip_get_clk(&dev);
> diff --git a/arch/arm/mach-rockchip/rk3288-board-tpl.c b/arch/arm/mach-rockchip/rk3288-board-tpl.c
> index 150beea..e34142c 100644
> --- a/arch/arm/mach-rockchip/rk3288-board-tpl.c
> +++ b/arch/arm/mach-rockchip/rk3288-board-tpl.c
> @@ -17,10 +17,20 @@
> #include <asm/arch/periph.h>
> #include <asm/arch/pmu_rk3288.h>
> #include <asm/arch/sys_proto.h>
> -#include <asm/arch/timer.h>
>
> DECLARE_GLOBAL_DATA_PTR;
>
> +void rockchip_stimer_init(void)
> +{
> + asm volatile("mcr p15, 0, %0, c14, c0, 0"
> + : : "r"(COUNTER_FREQUENCY));
> +
> + writel(0, CONFIG_ROCKCHIP_STIMER_BASE + 0x10);
> + writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
> + writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
> + writel(1, CONFIG_ROCKCHIP_STIMER_BASE + 0x10);
> +}
> +
> #define GRF_BASE 0xff770000
> void board_init_f(ulong dummy)
> {
> @@ -51,7 +61,11 @@ void board_init_f(ulong dummy)
> hang();
> }
>
> - rockchip_timer_init();
> + /* Init secure timer */
> + rockchip_stimer_init();
> + /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
> + timer_init();
> +
> configure_l2ctlr();
>
> ret = rockchip_get_clk(&dev);
> diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h
> index 78595b8..98cc9be 100644
> --- a/include/configs/rk3288_common.h
> +++ b/include/configs/rk3288_common.h
> @@ -15,9 +15,9 @@
> #define CONFIG_SYS_MALLOC_LEN (32 << 20)
> #define CONFIG_SYS_CBSIZE 1024
>
> -#define CONFIG_SYS_TIMER_RATE (24 * 1000 * 1000)
> -#define CONFIG_SYS_TIMER_BASE 0xff810020 /* TIMER7 */
> -#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 8)
> +#define COUNTER_FREQUENCY 24000000
> +#define CONFIG_SYS_ARCH_TIMER
> +#define CONFIG_SYS_HZ_CLOCK 24000000
>
> #define CONFIG_SYS_NS16550_MEM32
>
>
More information about the U-Boot
mailing list