[U-Boot] [PATCH 26/36] rockchip: rk1108: remove rockchip timer for sys timer

Alexander Kochetkov al.kochet at gmail.com
Fri Mar 30 17:13:55 UTC 2018


Hello, Kevel!

I can confirm, that rk3188 doesn’t have arch timer. I made test, see below.

By the way, could you tell what git head to use to apply your patch series?
I want to test other changes as well.

I failed to apply to this one head:

commit eef11acebaa48e241e9187c717dc92d3e175c119
Author: Tom Rini <trini at konsulko.com>
Date:   Mon Jan 29 20:12:33 2018 -0500

    Prepare v2018.03-rc1
    
    Signed-off-by: Tom Rini <trini at konsulko.com>

I took get_ticks() code from arch_timer.c into board file and tried to
execute it:

diff --git a/arch/arm/mach-rockchip/rk3188-board.c b/arch/arm/mach-rockchip/rk3188-board.c
index fc58aeb..b5d0984 100644
--- a/arch/arm/mach-rockchip/rk3188-board.c
+++ b/arch/arm/mach-rockchip/rk3188-board.c
@@ -25,9 +25,28 @@ __weak int rk_board_late_init(void)
 	return 0;
 }
 
+#define CONFIG_SYS_HZ_CLOCK    24000000
+
+ulong arch_tbl = 0;
+ulong arch_tbu = 0;
+ulong arch_timer_rate_hz = CONFIG_SYS_HZ_CLOCK / CONFIG_SYS_HZ;
+
+unsigned long long arch_get_ticks(void)
+{
+	ulong nowl, nowu;
+
+	asm volatile("mrrc p15, 0, %0, %1, c14" : "=r" (nowl), "=r" (nowu));
+
+	arch_tbl = nowl;
+	arch_tbu = nowu;
+
+	return (((unsigned long long)arch_tbu) << 32) | arch_tbl;
+}
+
 int board_late_init(void)
 {
 	struct rk3188_grf *grf;
+	ulong val0, val1;
 
 	setup_boot_mode();
 	grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
@@ -40,6 +59,12 @@ int board_late_init(void)
 			NOC_REMAP_MASK << NOC_REMAP_SHIFT);
 	}
 
+	val0 = arch_get_ticks();
+	udelay(100);
+	val1 = arch_get_ticks();
+
+	pr_err("val0 %lu; val1 %lu\n", val0, val1);
+
 	return rk_board_late_init();
 }

And I get undefined instruction error on rk3188 board:

undefined instruction
pc : [<9ff760d6>]	   lr : [<9ff76129>]
reloc pc : [<600010d6>]	   lr : [<60001129>]
sp : 9df669d8  ip : 9df66918	 fp : 00000017
r10: 6003d648  r9 : 9df6cee8	 r8 : 10080228
r7 : 9ffb0654  r6 : 9ffb05e4	 r5 : 9ffb0658  r4 : 3ff75000
r3 : 10001000  r2 : 80000000	 r1 : 20008000  r0 : 20008000
Flags: nzcv  IRQs off  FIQs off  Mode SVC_32

Regards,
Alexander.

> 28 марта 2018 г., в 5:33, Kever Yang <kever.yang at rock-chips.com> написал(а):
> 
> Hi Alexander,
> 
> 
> On 03/28/2018 12:21 AM, Alexander Kochetkov wrote:
>> The question is: does rk3066 and rk3188 have arch timer? If no, than removing rk_timer
>> will break u-boot for these chips.
> 
> Thanks for your comment, I will double check about if this two chips
> have arch
> timer, I think it should be, but I don't have boards now.
> 
> Thanks,
> - Kever
>> 
>> And my comment was about global timer, not arch timer. And I failed to enable arch
>> timer for rk3188 in the kernel.
>> 
>> Alexander.
>> 
>>> 27 марта 2018 г., в 19:07, Alexander Kochetkov <al.kochet at gmail.com> написал(а):
>>> 
>>>> 27 марта 2018 г., в 12:29, Kever Yang <kever.yang at rock-chips.com> написал(а):
>>>> 
>>>> We use ARM arch timer instead.
>>> Hi, Kever!
>>> 
>>> Just let you know, that arch timer rate on rk3066 and rk3188 depends on CPU frequency.
>>> I’ve made patch[1] for fixing that in kernel.
>>> If u-boot do arm clock changes after timer initialization, timer can provide inaccurate delays.
>>> 
>>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/clocksource/rockchip_timer.c?id=5e0a39d0f727b35c8b7ef56ba0724c8ceb006297
>>> 
>>> Alexander.
>> 
> 
> 



More information about the U-Boot mailing list