devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rick Chen <rickchen36@gmail.com>
To: rickchen36@gmail.com, rick@andestech.com,
	linux-kernel@vger.kernel.org, arnd@arndb.de,
	linus.walleij@linaro.org, daniel.lezcano@linaro.org,
	linux-arch@vger.kernel.org, tglx@linutronix.de,
	jason@lakedaemon.net, marc.zyngier@arm.com, robh+dt@kernel.org,
	netdev@vger.kernel.org, deanbo422@gmail.com,
	devicetree@vger.kernel.org, viro@zeniv.linux.org.uk,
	dhowells@redhat.com, will.deacon@arm.com,
	linux-serial@vger.kernel.org
Cc: Vincent Chen <vincentc@andestech.com>, Greentime Hu <green.hu@gmail.com>
Subject: [PATCH v5 2/3] clocksource/drivers/atcpit100: VDSO support
Date: Tue, 12 Dec 2017 13:47:00 +0800	[thread overview]
Message-ID: <1513057621-19084-3-git-send-email-rickchen36@gmail.com> (raw)
In-Reply-To: <1513057621-19084-1-git-send-email-rickchen36@gmail.com>

VDSO needs real-time cycle count to ensure the time accuracy.
Unlike others, nds32 architecture does not define clock source,
hence VDSO needs atcpit100 offering real-time cycle count
to derive the correct time.

Signed-off-by: Vincent Chen <vincentc@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
---
 drivers/clocksource/timer-atcpit100.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/clocksource/timer-atcpit100.c b/drivers/clocksource/timer-atcpit100.c
index 0077fdb..1be6c0a 100644
--- a/drivers/clocksource/timer-atcpit100.c
+++ b/drivers/clocksource/timer-atcpit100.c
@@ -29,6 +29,9 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include "timer-of.h"
+#ifdef CONFIG_NDS32
+#include <asm/vdso_timer_info.h>
+#endif
 
 /*
  * Definition of register offsets
@@ -211,6 +214,14 @@ static u64 notrace atcpit100_timer_sched_read(void)
 	return ~readl(timer_of_base(&to) + CH1_CNT);
 }
 
+#ifdef CONFIG_NDS32
+static void fill_vdso_need_info(void)
+{
+	timer_info.cycle_count_down = true;
+	timer_info.cycle_count_reg_offset = CH1_CNT;
+}
+#endif
+
 static int __init atcpit100_timer_init(struct device_node *node)
 {
 	int ret;
@@ -249,6 +260,10 @@ static int __init atcpit100_timer_init(struct device_node *node)
 	val = readl(base + INT_EN);
 	writel(val | CH0INT0EN, base + INT_EN);
 
+#ifdef CONFIG_NDS32
+	fill_vdso_need_info();
+#endif
+
 	return ret;
 }
 
-- 
2.7.4

  parent reply	other threads:[~2017-12-12  5:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12  5:46 [PATCH v5 0/3] Add andestech atcpit100 timer Rick Chen
2017-12-12  5:46 ` [PATCH v5 1/3] clocksource/drivers/atcpit100: " Rick Chen
2017-12-12 10:05   ` Daniel Lezcano
2017-12-13  6:06     ` Greentime Hu
2018-01-04 13:50       ` Daniel Lezcano
2018-01-04 14:06         ` Greentime Hu
2018-01-04 19:48           ` Daniel Lezcano
2018-01-05  8:45             ` Greentime Hu
2018-01-05  9:31               ` Daniel Lezcano
2018-01-08 15:26                 ` Arnd Bergmann
2018-01-08 16:08                   ` Daniel Lezcano
2018-01-08 16:30                     ` Arnd Bergmann
2017-12-12  5:47 ` Rick Chen [this message]
2017-12-12  5:47 ` [PATCH v5 3/3] dt-bindings: timer: Add andestech atcpit100 timer binding doc Rick Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513057621-19084-3-git-send-email-rickchen36@gmail.com \
    --to=rickchen36@gmail.com \
    --cc=arnd@arndb.de \
    --cc=daniel.lezcano@linaro.org \
    --cc=deanbo422@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=green.hu@gmail.com \
    --cc=jason@lakedaemon.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=rick@andestech.com \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vincentc@andestech.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).