From: Mason <slash.tmp@free.fr>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Trivial clocksource driver
Date: Tue, 29 Sep 2015 18:25:57 +0200 [thread overview]
Message-ID: <560ABB95.8000404@free.fr> (raw)
Hello everyone,
I am trying to submit a new ARM port, and Arnd pointed out that the
clocksource code could not live in arch/arm/$PLATFORM, but had to
move to drivers/clocksource (and it had to support DT).
Did I understand correctly? Is this the right place to submit code
as provided below?
Regards.
#include <linux/delay.h> /* register_current_timer_delay */
#include <linux/clocksource.h> /* clocksource_register_hz */
#include <linux/sched_clock.h> /* sched_clock_register */
#include <linux/of_address.h> /* of_iomap */
#include <linux/clk.h> /* of_clk_get, clk_get_rate */
static void __iomem *xtal_in_cnt;
static struct delay_timer delay_timer;
static unsigned long read_xtal_counter(void)
{
return readl_relaxed(xtal_in_cnt);
}
static u64 read_sched_clock(void)
{
return read_xtal_counter();
}
static cycle_t read_clocksource(struct clocksource *cs)
{
return read_xtal_counter();
}
static struct clocksource tango_xtal = {
.name = "tango-xtal",
.rating = 350,
.read = read_clocksource,
.mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
static void __init tango_clksrc_init(struct device_node *np)
{
struct clk *clk = of_clk_get(np, 0);
unsigned int xtal_freq = clk_get_rate(clk);
xtal_in_cnt = of_iomap(np, 0);
delay_timer.freq = xtal_freq;
delay_timer.read_current_timer = read_xtal_counter;
register_current_timer_delay(&delay_timer);
sched_clock_register(read_sched_clock, 32, xtal_freq);
clocksource_register_hz(&tango_xtal, xtal_freq);
}
CLOCKSOURCE_OF_DECLARE(tango, "sigma,xtal_in_cnt", tango_clksrc_init);
next reply other threads:[~2015-09-29 16:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-29 16:25 Mason [this message]
2015-09-29 18:32 ` Trivial clocksource driver Thomas Gleixner
2015-09-29 19:49 ` Mason
2015-09-29 20:18 ` Måns Rullgård
2015-09-29 20:49 ` Thomas Gleixner
2015-09-29 21:12 ` Mason
2015-09-29 21:55 ` Måns Rullgård
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=560ABB95.8000404@free.fr \
--to=slash.tmp@free.fr \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.