From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH v3 2/3] clocksource: Add NPS400 timers driver
Date: Mon, 8 Feb 2016 15:21:54 +0100 [thread overview]
Message-ID: <56B8A482.8040302@linaro.org> (raw)
In-Reply-To: <1454775406-25277-3-git-send-email-noamc@ezchip.com>
On 02/06/2016 05:16 PM, Noam Camus wrote:
> From: Noam Camus <noamc at ezchip.com>
>
> Add internal tick generator which is shared by all cores.
> Each cluster of cores view it through dedicated address.
> This is used for SMP system where all CPUs synced by same
> clock source.
>
> Signed-off-by: Noam Camus <noamc at ezchip.com>
> Cc: Daniel Lezcano <daniel.lezcano at linaro.org>
> Cc: Rob Herring <robh+dt at kernel.org>
> Cc: Thomas Gleixner <tglx at linutronix.de>
> Cc: John Stultz <john.stultz at linaro.org>
> Acked-by: Vineet Gupta <vgupta at synopsys.com>
> ---
[ ... ]
> +static cycle_t nps_clksrc_read(struct clocksource *clksrc)
> +{
> + int cluster = raw_smp_processor_id() >> NPS_CLUSTER_OFFSET;
> +
> + return (cycle_t)ioread32be(nps_msu_reg_low_addr[cluster]);
> +}
> +
> +static struct clocksource nps_counter = {
> + .name = "EZnps-tick",
> + .rating = 301,
> + .read = nps_clksrc_read,
> + .mask = CLOCKSOURCE_MASK(32),
> + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> +};
> +
> +static void __init nps_setup_clocksource(struct device_node *node,
> + struct clk *clk)
> +{
> + struct clocksource *clksrc = &nps_counter;
> + int ret, cluster;
> +
> + for (cluster = 0; cluster < NPS_CLUSTER_NUM; cluster++)
> + nps_msu_reg_low_addr[cluster] =
> + nps_host_reg((cluster << NPS_CLUSTER_OFFSET),
> + NPS_MSU_BLKID, NPS_MSU_TICK_LOW);
> +
> + ret = clk_prepare_enable(clk);
> + if (ret)
> + pr_err("Couldn't enable parent clock\n");
> +
> + nps_timer_rate = clk_get_rate(clk);
If there is an error, you continue the execution of the code. I guess
you expect the system to hang in any case with the error in the console,
right ?
> + ret = clocksource_register_hz(clksrc, nps_timer_rate);
You can simplify the driver even more by using clocksource_mmio_init.
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2016-02-08 14:21 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 13:14 [PATCH v2 0/3] Adding NPS400 drivers Noam Camus
2016-02-02 13:14 ` [PATCH v2 1/3] soc: Support for EZchip SoC Noam Camus
2016-02-02 13:14 ` [PATCH v2 2/3] clocksource: Add NPS400 timers driver Noam Camus
2016-02-02 14:36 ` kbuild test robot
2016-02-02 13:14 ` [PATCH v2 3/3] irqchip: add nps Internal and external irqchips Noam Camus
2016-02-02 13:35 ` Thomas Gleixner
2016-02-02 20:40 ` kbuild test robot
2016-02-06 16:16 ` [PATCH v3 0/3] Adding NPS400 drivers Noam Camus
2016-02-11 3:02 ` [PATCH v4 " Noam Camus
2016-02-11 18:40 ` [PATCH v5 " Noam Camus
2016-02-17 7:05 ` Noam Camus
2016-02-11 18:40 ` [PATCH v5 1/3] soc: Support for EZchip SoC Noam Camus
2016-02-11 18:40 ` [PATCH v5 2/3] clocksource: Add NPS400 timers driver Noam Camus
2016-02-11 20:29 ` Daniel Lezcano
2016-02-11 18:40 ` [PATCH v5 3/3] irqchip: add nps Internal and external irqchips Noam Camus
2016-02-19 14:03 ` Jason Cooper
2016-02-19 14:42 ` Noam Camus
2016-02-11 3:02 ` [PATCH v4 1/3] soc: Support for EZchip SoC Noam Camus
2016-02-11 3:02 ` [PATCH v4 2/3] clocksource: Add NPS400 timers driver Noam Camus
2016-02-11 8:18 ` Daniel Lezcano
2016-02-11 3:02 ` [PATCH v4 3/3] irqchip: add nps Internal and external irqchips Noam Camus
2016-02-06 16:16 ` [PATCH v3 1/3] soc: Support for EZchip SoC Noam Camus
2016-02-06 16:16 ` [PATCH v3 2/3] clocksource: Add NPS400 timers driver Noam Camus
2016-02-08 14:21 ` Daniel Lezcano [this message]
2016-02-09 12:36 ` Noam Camus
2016-02-09 13:38 ` Daniel Lezcano
2016-02-09 21:47 ` Noam Camus
2016-02-09 22:55 ` Daniel Lezcano
2016-02-10 8:01 ` Noam Camus
2016-02-06 16:16 ` [PATCH v3 3/3] irqchip: add nps Internal and external irqchips Noam Camus
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=56B8A482.8040302@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=linux-snps-arc@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).