Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1528634
| From | Alexander Kochetkov <al.kochet@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 6/9] clocksource/drivers/rockchip_timer: implement reading 64bit value from timer |
| Date | 2016-11-23 18:40 +0100 |
| Message-ID | <sGJGy-7OY-41@gated-at.bofh.it> (permalink) |
| References | <sGJwX-7LD-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
---
drivers/clocksource/rockchip_timer.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index f4c26be..61787c5 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -19,6 +19,8 @@
#define TIMER_LOAD_COUNT0 0x00
#define TIMER_LOAD_COUNT1 0x04
+#define TIMER_CURRENT_VALUE0 0x08
+#define TIMER_CURRENT_VALUE1 0x0C
#define TIMER_CONTROL_REG3288 0x10
#define TIMER_CONTROL_REG3399 0x1c
#define TIMER_INT_STATUS 0x18
@@ -72,6 +74,25 @@ static void rk_timer_update_counter(u64 cycles, struct rk_timer *timer)
writel_relaxed(upper, timer->base + TIMER_LOAD_COUNT1);
}
+static u64 rk_timer_counter_read(struct rk_timer *timer)
+{
+ u64 counter;
+ u32 lower;
+ u32 upper, old_upper;
+
+ upper = readl_relaxed(timer->base + TIMER_CURRENT_VALUE1);
+ do {
+ old_upper = upper;
+ lower = readl_relaxed(timer->base + TIMER_CURRENT_VALUE0);
+ upper = readl_relaxed(timer->base + TIMER_CURRENT_VALUE1);
+ } while (upper != old_upper);
+
+ counter = upper;
+ counter <<= 32;
+ counter |= lower;
+ return counter;
+}
+
static void rk_timer_interrupt_clear(struct rk_timer *timer)
{
writel_relaxed(1, timer->base + TIMER_INT_STATUS);
--
1.7.9.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/9] clocksource/drivers/rockchip_timer: split bc_timer into rk_timer and rk_clock_event_device Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-23 18:30 +0100
[PATCH 5/9] clocksource/drivers/rockchip_timer: implement loading 64bit value into timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-23 18:30 +0100
[PATCH 7/9] clocksource/drivers/rockchip_timer: implement clocksource timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-23 18:40 +0100
Re: [PATCH 7/9] clocksource/drivers/rockchip_timer: implement clocksource timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-24 10:40 +0100
Re: [PATCH 7/9] clocksource/drivers/rockchip_timer: implement clocksource timer Heiko Stübner <heiko@sntech.de> - 2016-11-24 13:20 +0100
Re: [PATCH 7/9] clocksource/drivers/rockchip_timer: implement clocksource timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-24 14:10 +0100
Re: [PATCH 7/9] clocksource/drivers/rockchip_timer: implement clocksource timer Heiko Stübner <heiko@sntech.de> - 2016-11-24 14:30 +0100
Re: [PATCH 7/9] clocksource/drivers/rockchip_timer: implement clocksource timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-24 15:20 +0100
Re: [PATCH 7/9] clocksource/drivers/rockchip_timer: implement clocksource timer Heiko Stübner <heiko@sntech.de> - 2016-11-24 15:40 +0100
[PATCH 8/9] dt-bindings: add rockchip,clocksource property to rk-timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-23 18:40 +0100
[PATCH 2/9] clocksource/drivers/rockchip_timer: low level routines take rk_timer as parameter Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-23 18:40 +0100
[PATCH 6/9] clocksource/drivers/rockchip_timer: implement reading 64bit value from timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-23 18:40 +0100
[PATCH 3/9] clocksource/drivers/rockchip_timer: drop unused rk_base() and rk_ctrl() Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-23 18:40 +0100
[PATCH 4/9] clocksource/drivers/rockchip_timer: move TIMER_INT_UNMASK out of rk_timer_enable() Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-23 18:40 +0100
[PATCH 9/9] ARM: dts: rockchip: add timer entries to rk3188.dtsi Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-23 18:40 +0100
Re: [PATCH 1/9] clocksource/drivers/rockchip_timer: split bc_timer into rk_timer and rk_clock_event_device Heiko Stübner <heiko@sntech.de> - 2016-11-24 13:10 +0100
Re: [PATCH 1/9] clocksource/drivers/rockchip_timer: split bc_timer into rk_timer and rk_clock_event_device Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-24 13:20 +0100
csiph-web