From: Claudiu Beznea <claudiu.beznea@microchip.com>
To: daniel.lezcano@linaro.org, robh+dt@kernel.org,
mark.rutland@arm.com, linux@armlinux.org.uk, nsekhar@ti.com,
bgolaszewski@baylibre.com, monstr@monstr.eu, john@phrozen.org,
ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org,
lftan@altera.com, tglx@linutronix.de, vgupta@synopsys.com,
marc.zyngier@arm.com, patrice.chotard@st.com,
mcoquelin.stm32@gmail.com, alexandre.torgue@st.com,
eric@anholt.net, wahrenst@gmx.net, f.fainelli@gmail.com,
rjui@broadcom.com, sbranden@broadcom.com,
bcm-kernel-feedback-list@broadcom.com, linus.walleij@linaro.org,
shc_work@mail.ru, kgene@kernel.org, krzk@kernel.org,
ysato@users.sourceforge.jp, liviu.dudau@arm.com,
sudeep.holla@arm.com, lorenzo.pieralisi@arm.com,
shawnguo@kernel.org
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org,
nios2-dev@lists.rocketboards.org,
linux-snps-arc@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-rpi-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
uclinux-h8-devel@lists.sourceforge.jp,
linux-amlogic@lists.infradead.org, openbmc@lists.ozlabs.org,
linux-oxnas@groups.io, linux-arm-msm@vger.kernel.org,
linux-unisoc@lists.infradead.org,
linux-riscv@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org,
linux-mediatek@lists.infradead.org,
Claudiu Beznea <claudiu.beznea@microchip.com>
Subject: [PATCH 7/7] clocksource/drivers/integrator-ap: parse the chosen node
Date: Tue, 10 Sep 2019 16:47:16 +0300 [thread overview]
Message-ID: <1568123236-767-8-git-send-email-claudiu.beznea@microchip.com> (raw)
In-Reply-To: <1568123236-767-1-git-send-email-claudiu.beznea@microchip.com>
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
The driver currently uses aliases to know whether the timer is the
clocksource or the clockevent. Add the /chosen/linux,clocksource and
/chosen/linux,clockevent parsing while keeping backward compatibility.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/clocksource/Kconfig | 1 +
drivers/clocksource/timer-integrator-ap.c | 21 ++++++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index a642c23b2fba..e1742c0abb03 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -240,6 +240,7 @@ config KEYSTONE_TIMER
config INTEGRATOR_AP_TIMER
bool "Integrator-ap timer driver" if COMPILE_TEST
select CLKSRC_MMIO
+ select TIMER_OF
help
Enables support for the Integrator-ap timer.
diff --git a/drivers/clocksource/timer-integrator-ap.c b/drivers/clocksource/timer-integrator-ap.c
index 8d6f814ace36..78af89e73125 100644
--- a/drivers/clocksource/timer-integrator-ap.c
+++ b/drivers/clocksource/timer-integrator-ap.c
@@ -14,6 +14,7 @@
#include <linux/interrupt.h>
#include <linux/sched_clock.h>
+#include "timer-of.h"
#include "timer-sp.h"
static void __iomem * sched_clk_base;
@@ -160,6 +161,12 @@ static int integrator_clockevent_init(unsigned long inrate,
return 0;
}
+static struct timer_of to[] = {
+ { .flags = TIMER_OF_TYPE_CS, },
+ { .flags = TIMER_OF_TYPE_CE, },
+ { /* sentinel */ }
+};
+
static int __init integrator_ap_timer_init_of(struct device_node *node)
{
const char *path;
@@ -169,6 +176,7 @@ static int __init integrator_ap_timer_init_of(struct device_node *node)
struct clk *clk;
unsigned long rate;
struct device_node *alias_node;
+ struct timer_of *to = node->data;
base = of_io_request_and_map(node, 0, "integrator-timer");
if (IS_ERR(base))
@@ -183,6 +191,17 @@ static int __init integrator_ap_timer_init_of(struct device_node *node)
rate = clk_get_rate(clk);
writel(0, base + TIMER_CTRL);
+ if (timer_of_is_clocksource(to))
+ /* The primary timer lacks IRQ, use as clocksource */
+ return integrator_clocksource_init(rate, base);
+
+ if (timer_of_is_clockevent(to)) {
+ /* The secondary timer will drive the clock event */
+ irq = irq_of_parse_and_map(node, 0);
+ return integrator_clockevent_init(rate, base, irq);
+ }
+
+ /* DT ABI compatibility below */
err = of_property_read_string(of_aliases,
"arm,timer-primary", &path);
if (err) {
@@ -227,4 +246,4 @@ static int __init integrator_ap_timer_init_of(struct device_node *node)
}
TIMER_OF_DECLARE(integrator_ap_timer, "arm,integrator-timer",
- integrator_ap_timer_init_of, NULL);
+ integrator_ap_timer_init_of, to);
--
2.7.4
next prev parent reply other threads:[~2019-09-10 13:47 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-10 13:47 [PATCH 0/7] add support for clocksource/clockevent DT selection Claudiu Beznea
2019-09-10 13:47 ` [PATCH 1/7] clocksource/drivers/c-sky: request timer_of_init only for probing CPU Claudiu Beznea
2019-09-10 13:47 ` [PATCH 2/7] clocksource: change timer registration macros Claudiu Beznea
2019-09-10 14:49 ` Marc Zyngier
2019-09-10 14:57 ` Claudiu.Beznea
2019-09-10 13:47 ` [PATCH 3/7] clocksource/timer_of: use BIT() macro Claudiu Beznea
2019-09-10 13:47 ` [PATCH 4/7] dt-bindings: chosen: Add clocksource and clockevent selection Claudiu Beznea
2019-09-10 14:32 ` Sudeep Holla
2019-09-10 14:51 ` Claudiu.Beznea
2019-09-10 15:08 ` Sudeep Holla
2019-09-10 15:10 ` Alexandre Belloni
2019-09-11 0:03 ` Linus Walleij
2019-09-11 7:18 ` Claudiu.Beznea
2019-09-12 14:18 ` Linus Walleij
2019-09-30 14:32 ` Rob Herring
2019-10-02 13:32 ` Claudiu.Beznea
2019-09-11 7:34 ` Neil Armstrong
2019-09-11 9:14 ` Alexandre Belloni
2019-09-10 13:47 ` [PATCH 5/7] clocksource/drivers/timer-of: add support support for timer's functionalities Claudiu Beznea
2019-09-10 13:47 ` [PATCH 6/7] drivers/clocksource/timer-of: keep declaration on one line Claudiu Beznea
2019-09-10 13:47 ` Claudiu Beznea [this message]
2019-09-10 23:48 ` [PATCH 7/7] clocksource/drivers/integrator-ap: parse the chosen node Linus Walleij
2019-09-11 7:14 ` Claudiu.Beznea
2019-09-10 16:05 ` [PATCH 0/7] add support for clocksource/clockevent DT selection John Stultz
2019-09-11 6:52 ` Claudiu.Beznea
2019-09-11 16:06 ` John Stultz
2019-09-25 17:19 ` Daniel Lezcano
2019-09-26 8:42 ` Claudiu.Beznea
2019-10-02 13:35 ` Claudiu.Beznea
2019-10-03 10:43 ` Claudiu.Beznea
2019-10-13 18:16 ` Daniel Lezcano
2019-10-15 9:23 ` Claudiu.Beznea
2019-10-18 20:24 ` Daniel Lezcano
2019-10-21 8:58 ` Claudiu.Beznea
2019-10-21 14:17 ` 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=1568123236-767-8-git-send-email-claudiu.beznea@microchip.com \
--to=claudiu.beznea@microchip.com \
--cc=alexandre.torgue@st.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bgolaszewski@baylibre.com \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=eric@anholt.net \
--cc=f.fainelli@gmail.com \
--cc=jhogan@kernel.org \
--cc=john@phrozen.org \
--cc=kgene@kernel.org \
--cc=krzk@kernel.org \
--cc=lftan@altera.com \
--cc=linus.walleij@linaro.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-oxnas@groups.io \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-unisoc@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=liviu.dudau@arm.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=monstr@monstr.eu \
--cc=nios2-dev@lists.rocketboards.org \
--cc=nsekhar@ti.com \
--cc=openbmc@lists.ozlabs.org \
--cc=patrice.chotard@st.com \
--cc=paul.burton@mips.com \
--cc=ralf@linux-mips.org \
--cc=rjui@broadcom.com \
--cc=robh+dt@kernel.org \
--cc=sbranden@broadcom.com \
--cc=shawnguo@kernel.org \
--cc=shc_work@mail.ru \
--cc=sudeep.holla@arm.com \
--cc=tglx@linutronix.de \
--cc=uclinux-h8-devel@lists.sourceforge.jp \
--cc=vgupta@synopsys.com \
--cc=wahrenst@gmx.net \
--cc=ysato@users.sourceforge.jp \
/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).