diff mbox series

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

Message ID 1522142971-20739-27-git-send-email-kever.yang@rock-chips.com
State Changes Requested
Delegated to: Philipp Tomsich
Headers show
Series rockchip: clean up board file for rockchip SoCs | expand

Commit Message

Kever Yang March 27, 2018, 9:29 a.m. UTC
We use ARM arch timer instead.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 include/configs/rv1108_common.h | 5 -----
 1 file changed, 5 deletions(-)

Comments

Andy Yan March 27, 2018, 11:33 a.m. UTC | #1
hi Kever:

     s/rk1108/rv1108


On 2018年03月27日 17:29, Kever Yang wrote:
> We use ARM arch timer instead.
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
>   include/configs/rv1108_common.h | 5 -----
>   1 file changed, 5 deletions(-)
>
> diff --git a/include/configs/rv1108_common.h b/include/configs/rv1108_common.h
> index cd204e9..7a9ec7b 100644
> --- a/include/configs/rv1108_common.h
> +++ b/include/configs/rv1108_common.h
> @@ -13,11 +13,6 @@
>   #define CONFIG_SYS_CBSIZE		1024
>   #define CONFIG_SKIP_LOWLEVEL_INIT
>   
> -#define CONFIG_SYS_TIMER_RATE		(24 * 1000 * 1000)
> -/* TIMER1,initialized by ddr initialize code */
> -#define CONFIG_SYS_TIMER_BASE		0x10350020
> -#define CONFIG_SYS_TIMER_COUNTER	(CONFIG_SYS_TIMER_BASE + 8)
> -
>   #define CONFIG_SYS_SDRAM_BASE		0x60000000
>   #define CONFIG_NR_DRAM_BANKS		1
>   #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_TEXT_BASE + 0x100000)
Philipp Tomsich March 27, 2018, 3:57 p.m. UTC | #2
> On 27 Mar 2018, at 11:29, Kever Yang <kever.yang@rock-chips.com> wrote:
> 
> We use ARM arch timer instead.

Could you please provide a more useful commit message.
Please consider that most people that look through the GIT log are
not familiar with our platform.

Thanks,
Philipp.
Alexander Kochetkov March 27, 2018, 4:07 p.m. UTC | #3
> 27 марта 2018 г., в 12:29, Kever Yang <kever.yang@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.
Alexander Kochetkov March 27, 2018, 4:21 p.m. UTC | #4
The question is: does rk3066 and rk3188 have arch timer? If no, than removing rk_timer
will break u-boot for these chips.

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@gmail.com> написал(а):
> 
>> 
>> 27 марта 2018 г., в 12:29, Kever Yang <kever.yang@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.
Kever Yang March 28, 2018, 2:33 a.m. UTC | #5
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@gmail.com> написал(а):
>>
>>> 27 марта 2018 г., в 12:29, Kever Yang <kever.yang@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.
>
Alexander Kochetkov March 30, 2018, 5:13 p.m. UTC | #6
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@konsulko.com>
Date:   Mon Jan 29 20:12:33 2018 -0500

    Prepare v2018.03-rc1
    
    Signed-off-by: Tom Rini <trini@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@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@gmail.com> написал(а):
>>> 
>>>> 27 марта 2018 г., в 12:29, Kever Yang <kever.yang@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.
>> 
> 
>
Philipp Tomsich April 1, 2018, 8:21 p.m. UTC | #7
> We use ARM arch timer instead.
> 
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
> 
>  include/configs/rv1108_common.h | 5 -----
>  1 file changed, 5 deletions(-)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
diff mbox series

Patch

diff --git a/include/configs/rv1108_common.h b/include/configs/rv1108_common.h
index cd204e9..7a9ec7b 100644
--- a/include/configs/rv1108_common.h
+++ b/include/configs/rv1108_common.h
@@ -13,11 +13,6 @@ 
 #define CONFIG_SYS_CBSIZE		1024
 #define CONFIG_SKIP_LOWLEVEL_INIT
 
-#define CONFIG_SYS_TIMER_RATE		(24 * 1000 * 1000)
-/* TIMER1,initialized by ddr initialize code */
-#define CONFIG_SYS_TIMER_BASE		0x10350020
-#define CONFIG_SYS_TIMER_COUNTER	(CONFIG_SYS_TIMER_BASE + 8)
-
 #define CONFIG_SYS_SDRAM_BASE		0x60000000
 #define CONFIG_NR_DRAM_BANKS		1
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_TEXT_BASE + 0x100000)