From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/9] clocksource/drivers/lpc32xx: Support timer-based ARM delay
Date: Thu, 25 Feb 2016 14:37:13 +0100 [thread overview]
Message-ID: <1456407438-6131-5-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <1456407438-6131-1-git-send-email-daniel.lezcano@linaro.org>
From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
This commit implements the ARM timer-based delay timer for the
LPC32xx, LPC18xx, LPC43xx family of SoCs.
Also, add a dependency to restrict compiling this driver for
the ARM architecture.
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Joachim Eastwood <manabian@gmail.com>
Tested-by: Joachim Eastwood <manabian@gmail.com>
---
drivers/clocksource/Kconfig | 1 +
drivers/clocksource/time-lpc32xx.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 56777f0..c9c4db6 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -153,6 +153,7 @@ config CLKSRC_EFM32
config CLKSRC_LPC32XX
bool "Clocksource for LPC32XX" if COMPILE_TEST
depends on GENERIC_CLOCKEVENTS && HAS_IOMEM
+ depends on ARM
select CLKSRC_MMIO
select CLKSRC_OF
help
diff --git a/drivers/clocksource/time-lpc32xx.c b/drivers/clocksource/time-lpc32xx.c
index 5694edd..daae61e 100644
--- a/drivers/clocksource/time-lpc32xx.c
+++ b/drivers/clocksource/time-lpc32xx.c
@@ -18,6 +18,7 @@
#include <linux/clk.h>
#include <linux/clockchips.h>
#include <linux/clocksource.h>
+#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/kernel.h>
@@ -54,6 +55,15 @@ static u64 notrace lpc32xx_read_sched_clock(void)
return readl(clocksource_timer_counter);
}
+static unsigned long lpc32xx_delay_timer_read(void)
+{
+ return readl(clocksource_timer_counter);
+}
+
+static struct delay_timer lpc32xx_delay_timer = {
+ .read_current_timer = lpc32xx_delay_timer_read,
+};
+
static int lpc32xx_clkevt_next_event(unsigned long delta,
struct clock_event_device *evtdev)
{
@@ -192,6 +202,8 @@ static int __init lpc32xx_clocksource_init(struct device_node *np)
}
clocksource_timer_counter = base + LPC32XX_TIMER_TC;
+ lpc32xx_delay_timer.freq = rate;
+ register_current_timer_delay(&lpc32xx_delay_timer);
sched_clock_register(lpc32xx_read_sched_clock, 32, rate);
return 0;
--
1.9.1
next prev parent reply other threads:[~2016-02-25 13:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <56CF00F6.9010301@linaro.org>
[not found] ` <1456407438-6131-1-git-send-email-daniel.lezcano@linaro.org>
2016-02-25 13:37 ` [PATCH 2/9] clocksource/drivers/rockchip: Add err handle for rk_timer_init Daniel Lezcano
2016-02-25 13:37 ` [PATCH 3/9] clocksource/drivers/lpc32xx: Don't use the prescaler counter for clockevents Daniel Lezcano
2016-02-25 13:37 ` [PATCH 4/9] clocksource/drivers/lpc32xx: Support periodic mode Daniel Lezcano
2016-02-25 13:37 ` Daniel Lezcano [this message]
2016-02-25 13:37 ` [PATCH 6/9] clocksource/drivers/arm_global_timer: Register delay timer Daniel Lezcano
2016-02-25 13:37 ` [PATCH 8/9] clockevents/drivers/arm_global_timer: Implement ->set_state_oneshot_stopped() Daniel Lezcano
2016-02-26 9:43 ` Jisheng Zhang
2016-02-25 13:37 ` [PATCH 9/9] clockevents/drivers/exynos_mct: " Daniel Lezcano
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=1456407438-6131-5-git-send-email-daniel.lezcano@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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).