From: Chris Brandt <chris.brandt@renesas.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>,
Simon Horman <horms+renesas@verge.net.au>,
Chris Brandt <chris.brandt@renesas.com>
Subject: [PATCH 1/2] clocksource/drivers/ostm: Delay driver registration
Date: Wed, 29 Aug 2018 08:29:53 -0500 [thread overview]
Message-ID: <20180829132954.64862-2-chris.brandt@renesas.com> (raw)
In-Reply-To: <20180829132954.64862-1-chris.brandt@renesas.com>
The newer RZ/A clock control driver no longer registers all its clocks
using DT, therefore the clocks required by this driver are no longer
present at the beginning of boot.
Because of this, TIMER_OF_DECLARE can no longer be used because this
causes the driver to get probed too early before the parent clock exists,
and the probe will fail with "ostm: Failed to get clock".
So, we'll change this driver to register/probe during subsys_initcall which
is after the appropriate clocks have been registered.
Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
---
drivers/clocksource/renesas-ostm.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/renesas-ostm.c b/drivers/clocksource/renesas-ostm.c
index 6cffd7c6001a..fc5e4ac294b8 100644
--- a/drivers/clocksource/renesas-ostm.c
+++ b/drivers/clocksource/renesas-ostm.c
@@ -22,6 +22,7 @@
#include <linux/interrupt.h>
#include <linux/sched_clock.h>
#include <linux/slab.h>
+#include <linux/platform_device.h>
/*
* The OSTM contains independent channels.
@@ -101,8 +102,12 @@ static u64 notrace ostm_read_sched_clock(void)
static void __init ostm_init_sched_clock(struct ostm_device *ostm,
unsigned long rate)
{
+ unsigned long flags;
+
system_clock = ostm->base + OSTM_CNT;
+ local_irq_save(flags);
sched_clock_register(ostm_read_sched_clock, 32, rate);
+ local_irq_restore(flags);
}
static int ostm_clock_event_next(unsigned long delta,
@@ -192,9 +197,10 @@ static int __init ostm_init_clkevt(struct ostm_device *ostm, int irq,
return 0;
}
-static int __init ostm_init(struct device_node *np)
+static int __init ostm_probe(struct platform_device *pdev)
{
struct ostm_device *ostm;
+ struct device_node *np = pdev->dev.of_node;
int ret = -EFAULT;
struct clk *ostm_clk = NULL;
int irq;
@@ -262,4 +268,29 @@ static int __init ostm_init(struct device_node *np)
return 0;
}
-TIMER_OF_DECLARE(ostm, "renesas,ostm", ostm_init);
+static const struct of_device_id ostm_of_table[] = {
+ {
+ .compatible = "renesas,ostm",
+ },
+ { /* sentinel */ }
+};
+
+static int ostm_remove(struct platform_device *pdev)
+{
+ return -EBUSY; /* cannot unregister clockevent and clocksource */
+}
+
+static struct platform_driver ostm_device_driver = {
+ .remove = ostm_remove,
+ .driver = {
+ .name = "ostm",
+ .of_match_table = of_match_ptr(ostm_of_table),
+ },
+};
+
+static int __init ostm_init(void)
+{
+ return platform_driver_probe(&ostm_device_driver, ostm_probe);
+}
+
+subsys_initcall(ostm_init);
--
2.16.1
next prev parent reply other threads:[~2018-08-29 13:29 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-29 13:29 [PATCH 0/2] clocksource: ostm: Add support for RZ/A2 Chris Brandt
2018-08-29 13:29 ` Chris Brandt [this message]
2018-08-29 15:09 ` [PATCH 1/2] clocksource/drivers/ostm: Delay driver registration Daniel Lezcano
2018-08-29 15:44 ` Chris Brandt
2018-08-29 16:26 ` Daniel Lezcano
2018-08-29 18:17 ` Chris Brandt
2018-08-29 19:57 ` Chris Brandt
2018-08-30 7:54 ` Geert Uytterhoeven
2018-08-30 8:08 ` Daniel Lezcano
2018-08-30 8:27 ` Geert Uytterhoeven
2018-08-30 8:37 ` Daniel Lezcano
2018-08-30 8:48 ` Geert Uytterhoeven
2018-08-30 9:16 ` Daniel Lezcano
2018-08-30 9:38 ` Bartosz Golaszewski
2018-09-07 15:16 ` Chris Brandt
2018-09-10 13:48 ` Rob Herring
2018-09-10 17:20 ` Chris Brandt
2018-09-11 16:01 ` Rob Herring
2018-09-11 18:42 ` Chris Brandt
2018-09-13 13:17 ` Daniel Lezcano
2018-09-13 13:20 ` Geert Uytterhoeven
2018-09-13 14:54 ` Chris Brandt
2018-09-14 11:39 ` Geert Uytterhoeven
2018-09-17 18:56 ` Chris Brandt
2018-09-18 7:24 ` Geert Uytterhoeven
2018-09-18 11:55 ` Chris Brandt
2018-09-18 12:58 ` Geert Uytterhoeven
2018-09-18 15:04 ` Chris Brandt
2018-09-18 15:10 ` Geert Uytterhoeven
2018-09-18 15:51 ` Chris Brandt
2018-09-18 16:16 ` Geert Uytterhoeven
2018-09-18 16:31 ` Chris Brandt
2018-08-29 13:29 ` [PATCH 2/2] dt-bindings: timer: ostm: Add R7S9210 support Chris Brandt
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=20180829132954.64862-2-chris.brandt@renesas.com \
--to=chris.brandt@renesas.com \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=horms+renesas@verge.net.au \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
/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).