From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Kochetkov Date: Fri, 30 Mar 2018 20:13:55 +0300 Subject: [U-Boot] [PATCH 26/36] rockchip: rk1108: remove rockchip timer for sys timer In-Reply-To: <53a26edb-7aa2-4ef6-3963-e4ad681c5f05@rock-chips.com> References: <1522142971-20739-1-git-send-email-kever.yang@rock-chips.com> <1522142971-20739-27-git-send-email-kever.yang@rock-chips.com> <201E5F21-DD29-4D44-A4F8-458C623A28B5@gmail.com> <53a26edb-7aa2-4ef6-3963-e4ad681c5f05@rock-chips.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de 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 Date: Mon Jan 29 20:12:33 2018 -0500 Prepare v2018.03-rc1 Signed-off-by: Tom Rini 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 написал(а): > > 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 написал(а): >>> >>>> 27 марта 2018 г., в 12:29, Kever Yang написал(а): >>>> >>>> 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. >> > >