From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Mark Langsdorf <mark.langsdorf@calxeda.com>,
Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Rob Herring <rob.herring@calxeda.com>
Subject: Re: [PATCH 1/4 v11] arm: use device tree to get smp_twd clock
Date: Fri, 25 Jan 2013 22:03:05 +0100 [thread overview]
Message-ID: <3041510.xugDHtFsGr@vostro.rjw.lan> (raw)
In-Reply-To: <1359143205-20279-2-git-send-email-mark.langsdorf@calxeda.com>
On Friday, January 25, 2013 01:46:42 PM Mark Langsdorf wrote:
> From: Rob Herring <rob.herring@calxeda.com>
>
> Move clk setup to twd_local_timer_common_register and rely on
> twd_timer_rate being 0 to force calibration if there is no clock.
> Remove common_setup_called as it is no longer needed.
>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
Russell, is this fine with you?
Rafael
> ---
> Changes from v10
> Reworked to simplify the logic as suggested by Russell King.
> Changes from v9
> Updated to work with 3.8 kernel.
> Changes from v4, v5, v6, v7, v8
> None.
> Changes from v3
> No longer setting *clk to NULL in twd_get_clock().
> Changes from v2
> Turned the check for the node pointer into an if-then-else statement.
> Removed the second, redundant clk_get_rate.
> Changes from v1
> None.
>
> arch/arm/kernel/smp_twd.c | 53 +++++++++++++++++------------------------------
> 1 file changed, 19 insertions(+), 34 deletions(-)
>
> diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
> index 49f335d..ae0c7bb 100644
> --- a/arch/arm/kernel/smp_twd.c
> +++ b/arch/arm/kernel/smp_twd.c
> @@ -31,7 +31,6 @@ static void __iomem *twd_base;
>
> static struct clk *twd_clk;
> static unsigned long twd_timer_rate;
> -static bool common_setup_called;
> static DEFINE_PER_CPU(bool, percpu_setup_called);
>
> static struct clock_event_device __percpu **twd_evt;
> @@ -239,25 +238,28 @@ static irqreturn_t twd_handler(int irq, void *dev_id)
> return IRQ_NONE;
> }
>
> -static struct clk *twd_get_clock(void)
> +static void twd_get_clock(struct device_node *np)
> {
> - struct clk *clk;
> int err;
>
> - clk = clk_get_sys("smp_twd", NULL);
> - if (IS_ERR(clk)) {
> - pr_err("smp_twd: clock not found: %d\n", (int)PTR_ERR(clk));
> - return clk;
> + if (np)
> + twd_clk = of_clk_get(np, 0);
> + else
> + twd_clk = clk_get_sys("smp_twd", NULL);
> +
> + if (IS_ERR(twd_clk)) {
> + pr_err("smp_twd: clock not found %d\n", (int) PTR_ERR(twd_clk));
> + return;
> }
>
> - err = clk_prepare_enable(clk);
> + err = clk_prepare_enable(twd_clk);
> if (err) {
> pr_err("smp_twd: clock failed to prepare+enable: %d\n", err);
> - clk_put(clk);
> - return ERR_PTR(err);
> + clk_put(twd_clk);
> + return;
> }
>
> - return clk;
> + twd_timer_rate = clk_get_rate(twd_clk);
> }
>
> /*
> @@ -280,26 +282,7 @@ static int __cpuinit twd_timer_setup(struct clock_event_device *clk)
> }
> per_cpu(percpu_setup_called, cpu) = true;
>
> - /*
> - * This stuff only need to be done once for the entire TWD cluster
> - * during the runtime of the system.
> - */
> - if (!common_setup_called) {
> - twd_clk = twd_get_clock();
> -
> - /*
> - * We use IS_ERR_OR_NULL() here, because if the clock stubs
> - * are active we will get a valid clk reference which is
> - * however NULL and will return the rate 0. In that case we
> - * need to calibrate the rate instead.
> - */
> - if (!IS_ERR_OR_NULL(twd_clk))
> - twd_timer_rate = clk_get_rate(twd_clk);
> - else
> - twd_calibrate_rate();
> -
> - common_setup_called = true;
> - }
> + twd_calibrate_rate();
>
> /*
> * The following is done once per CPU the first time .setup() is
> @@ -330,7 +313,7 @@ static struct local_timer_ops twd_lt_ops __cpuinitdata = {
> .stop = twd_timer_stop,
> };
>
> -static int __init twd_local_timer_common_register(void)
> +static int __init twd_local_timer_common_register(struct device_node *np)
> {
> int err;
>
> @@ -350,6 +333,8 @@ static int __init twd_local_timer_common_register(void)
> if (err)
> goto out_irq;
>
> + twd_get_clock(np);
> +
> return 0;
>
> out_irq:
> @@ -373,7 +358,7 @@ int __init twd_local_timer_register(struct twd_local_timer *tlt)
> if (!twd_base)
> return -ENOMEM;
>
> - return twd_local_timer_common_register();
> + return twd_local_timer_common_register(NULL);
> }
>
> #ifdef CONFIG_OF
> @@ -405,7 +390,7 @@ void __init twd_local_timer_of_register(void)
> goto out;
> }
>
> - err = twd_local_timer_common_register();
> + err = twd_local_timer_common_register(np);
>
> out:
> WARN(err, "twd_local_timer_of_register failed (%d)\n", err);
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
next prev parent reply other threads:[~2013-01-25 20:57 UTC|newest]
Thread overview: 142+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-30 21:04 [PATCH 0/6] cpufreq: add support for Calxeda ECX-1000 (highbank) Mark Langsdorf
2012-10-30 21:04 ` [PATCH 1/6] arm: use devicetree to get smp_twd clock Mark Langsdorf
2012-10-30 21:04 ` [PATCH 2/6] clk, highbank: remove non-bypass reset mode Mark Langsdorf
2012-10-30 21:04 ` [PATCH 3/6] cpufreq: tolerate inexact values when collecting stats Mark Langsdorf
2012-10-30 21:04 ` [PATCH 4/6] arm highbank: add support for pl320 IPC Mark Langsdorf
2012-10-30 21:04 ` [PATCH 5/6] power: export opp cpufreq functions Mark Langsdorf
2012-10-31 1:17 ` Nishanth Menon
2012-10-30 21:04 ` [PATCH 6/6] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2012-10-31 0:21 ` [PATCH 0/6] cpufreq: add support for Calxeda ECX-1000 (highbank) Rafael J. Wysocki
2012-11-02 18:51 ` [PATCH 0/6 v2] " Mark Langsdorf
2012-11-02 18:51 ` [PATCH 1/6 v2] arm: use devicetree to get smp_twd clock Mark Langsdorf
2012-11-04 10:08 ` Russell King - ARM Linux
2012-11-05 22:28 ` Mark Langsdorf
2012-11-05 22:31 ` Russell King - ARM Linux
2012-11-05 22:49 ` Mark Langsdorf
2012-11-02 18:51 ` [PATCH 2/6 v2] clk, highbank: remove non-bypass reset mode Mark Langsdorf
2012-11-02 18:51 ` [PATCH 3/6 v2] cpufreq: tolerate inexact values when collecting stats Mark Langsdorf
2012-11-02 18:51 ` [PATCH 4/6 v2] arm highbank: add support for pl320 IPC Mark Langsdorf
2012-11-02 18:51 ` [PATCH 5/6 v2] power: export opp cpufreq functions Mark Langsdorf
2012-11-02 18:51 ` [PATCH 6/6 v2] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2012-11-02 21:45 ` [PATCH 0/6 v2] cpufreq: add support for Calxeda ECX-1000 (highbank) Rafael J. Wysocki
2012-11-06 20:18 ` [PATCH 0/6 v3] " Mark Langsdorf
2012-11-06 20:18 ` [PATCH 1/6 v3] arm: use devicetree to get smp_twd clock Mark Langsdorf
2012-11-06 20:18 ` [PATCH 2/6 v3] clk, highbank: remove non-bypass reset mode Mark Langsdorf
2012-11-06 20:18 ` [PATCH 3/6 v3] cpufreq: tolerate inexact values when collecting stats Mark Langsdorf
2012-11-06 20:18 ` [PATCH 4/6 v3] arm highbank: add support for pl320 IPC Mark Langsdorf
2012-11-06 20:18 ` [PATCH 5/6 v3] power: export opp cpufreq functions Mark Langsdorf
2012-11-06 20:18 ` [PATCH 6/6 v3] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2012-11-07 18:11 ` [PATCH 0/6 v3] cpufreq: add support for Calxeda ECX-1000 (highbank) Mark Langsdorf
2012-11-07 18:32 ` [PATCH 0/6 v4] " Mark Langsdorf
2012-11-07 18:32 ` [PATCH 1/6 v4] arm: use devicetree to get smp_twd clock Mark Langsdorf
2012-11-07 18:32 ` [PATCH 2/6 v4] clk, highbank: Prevent glitches in non-bypass reset mode Mark Langsdorf
2012-11-12 21:24 ` Mike Turquette
2012-11-12 21:35 ` Mark Langsdorf
2012-11-07 18:32 ` [PATCH 3/6 v4] cpufreq: tolerate inexact values when collecting stats Mark Langsdorf
2012-11-11 16:38 ` Borislav Petkov
2012-11-12 16:35 ` Mark Langsdorf
2012-11-13 16:24 ` Borislav Petkov
2012-11-13 16:33 ` Mark Langsdorf
2012-11-13 19:13 ` Mark Langsdorf
2012-11-17 14:50 ` Borislav Petkov
2012-11-24 10:05 ` Rafael J. Wysocki
2012-11-26 13:57 ` Mark Langsdorf
2012-11-26 15:25 ` Rafael J. Wysocki
2012-11-07 18:32 ` [PATCH 4/6 v4] arm highbank: add support for pl320 IPC Mark Langsdorf
2012-11-14 14:03 ` Rob Herring
2012-11-07 18:32 ` [PATCH 5/6 v4] power: export opp cpufreq functions Mark Langsdorf
2012-11-07 18:32 ` [PATCH 6/6 v4] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2012-11-07 18:51 ` Rob Herring
2012-11-24 10:07 ` [PATCH 0/6 v4] cpufreq: add support for Calxeda ECX-1000 (highbank) Rafael J. Wysocki
2012-11-27 15:04 ` [PATCH 0/6 v5] " Mark Langsdorf
2012-11-27 15:04 ` [PATCH 1/6 v5] arm: use devicetree to get smp_twd clock Mark Langsdorf
2012-11-27 15:04 ` [PATCH 2/6 v5] clk, highbank: Prevent glitches in non-bypass reset mode Mark Langsdorf
2012-11-27 18:15 ` Mike Turquette
2012-11-27 15:04 ` [PATCH 3/6 v5] cpufreq: tolerate inexact values when collecting stats Mark Langsdorf
2012-11-27 15:04 ` [PATCH 4/6 v5] arm highbank: add support for pl320 IPC Mark Langsdorf
2012-11-27 16:12 ` Thomas Petazzoni
2012-11-27 19:53 ` Mark Langsdorf
[not found] ` <1354602789308-564771.post@n7.nabble.com>
2013-01-29 2:26 ` liuhuan123
2013-02-06 5:43 ` liuhuan123
2013-02-21 5:11 ` liuhuan123
2013-03-21 4:01 ` liuhuan123
2013-03-12 5:29 ` liuhuan123
2012-11-27 15:04 ` [PATCH 5/6 v5] power: export opp cpufreq functions Mark Langsdorf
2012-11-27 15:04 ` [PATCH 6/6 v5] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2012-11-27 19:04 ` [PATCH 0/6 v5] cpufreq: add support for Calxeda ECX-1000 (highbank) Rafael J. Wysocki
2012-11-27 20:04 ` [PATCH 0/6 v6] " Mark Langsdorf
2012-11-27 20:04 ` [PATCH 1/6 v6] arm: use devicetree to get smp_twd clock Mark Langsdorf
2012-11-27 20:04 ` [PATCH 2/6 v6] clk, highbank: Prevent glitches in non-bypass reset mode Mark Langsdorf
2012-11-27 20:04 ` [PATCH 3/6 v6] cpufreq: tolerate inexact values when collecting stats Mark Langsdorf
2012-11-27 20:04 ` [PATCH 4/6 v6] arm highbank: add support for pl320 IPC Mark Langsdorf
2012-11-27 20:04 ` [PATCH 5/6 v6] power: export opp cpufreq functions Mark Langsdorf
2012-11-27 20:04 ` [PATCH 6/6 v6] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2012-11-28 2:32 ` Shawn Guo
2012-11-28 13:16 ` Mark Langsdorf
2012-11-28 14:58 ` Shawn Guo
2012-11-28 15:17 ` Shawn Guo
2012-11-28 15:01 ` Mark Langsdorf
2012-11-28 16:01 ` Mike Turquette
2012-11-28 16:18 ` Mark Langsdorf
2012-11-28 21:05 ` Mike Turquette
2012-11-29 0:24 ` Mark Langsdorf
2012-11-29 1:51 ` Shawn Guo
2012-11-29 4:34 ` Mike Turquette
2012-12-04 14:33 ` [PATCH 0/6 v7] cpufreq: add support for Calxeda ECX-1000 (highbank) Mark Langsdorf
2012-12-04 14:33 ` [PATCH 1/6 v7] arm: use devicetree to get smp_twd clock Mark Langsdorf
2012-12-04 14:33 ` [PATCH 2/6 v7] clk, highbank: Prevent glitches in non-bypass reset mode Mark Langsdorf
2012-12-04 14:33 ` [PATCH 3/6 v7] cpufreq: tolerate inexact values when collecting stats Mark Langsdorf
2012-12-04 14:34 ` [PATCH 4/6 v7] arm highbank: add support for pl320 IPC Mark Langsdorf
2012-12-04 14:34 ` [PATCH 5/6 v7] power: export opp cpufreq functions Mark Langsdorf
2012-12-04 14:34 ` [PATCH 6/6 v7] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2012-12-04 16:21 ` Shawn Guo
2012-12-05 16:48 ` [PATCH 0/6 v8] cpufreq: add support for Calxeda ECX-1000 (highbank) Mark Langsdorf
2012-12-05 16:48 ` [PATCH 1/6 v8] arm: use devicetree to get smp_twd clock Mark Langsdorf
2012-12-05 16:48 ` [PATCH 2/6 v8] clk, highbank: Prevent glitches in non-bypass reset mode Mark Langsdorf
2012-12-05 18:02 ` Mike Turquette
2012-12-05 16:48 ` [PATCH 3/6 v8] cpufreq: tolerate inexact values when collecting stats Mark Langsdorf
2012-12-05 16:48 ` [PATCH 4/6 v8] arm highbank: add support for pl320 IPC Mark Langsdorf
2012-12-05 16:48 ` [PATCH 5/6 v8] power: export opp cpufreq functions Mark Langsdorf
2012-12-05 16:48 ` [PATCH 6/6 v8] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2012-12-05 18:49 ` Mike Turquette
2012-12-05 22:09 ` Mark Langsdorf
2012-12-06 9:37 ` Shawn Guo
2012-12-27 13:12 ` [PATCH 0/6 v8] cpufreq: add support for Calxeda ECX-1000 (highbank) Rafael J. Wysocki
2012-12-27 13:28 ` Mark Langsdorf
2012-12-27 14:43 ` Rafael J. Wysocki
2012-12-06 22:42 ` [PATCH 0/6 v9] " Mark Langsdorf
2012-12-06 22:42 ` [PATCH 1/6 v9] arm: use devicetree to get smp_twd clock Mark Langsdorf
2012-12-07 14:55 ` Thiago Farina
2012-12-27 5:11 ` Prashant Gaikwad
2012-12-06 22:42 ` [PATCH 2/6 v9] clk, highbank: Prevent glitches in non-bypass reset mode Mark Langsdorf
2012-12-06 22:42 ` [PATCH 3/6 v9] cpufreq: tolerate inexact values when collecting stats Mark Langsdorf
2012-12-06 22:42 ` [PATCH 4/6 v9] arm highbank: add support for pl320 IPC Mark Langsdorf
2012-12-06 22:42 ` [PATCH 5/6 v9] power: export opp cpufreq functions Mark Langsdorf
2012-12-06 22:42 ` [PATCH 6/6 v9] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2012-12-07 7:04 ` Mike Turquette
2013-01-04 16:35 ` [PATCH 0/4 v10] cpufreq: add support for Calxeda ECX-1000 (highbank) Mark Langsdorf
2013-01-04 16:35 ` [PATCH 1/4 v10] arm: use devicetree to get smp_twd clock Mark Langsdorf
2013-01-10 23:34 ` Russell King - ARM Linux
2013-01-11 14:40 ` Rob Herring
2013-01-04 16:35 ` [PATCH 2/4 v10] clk, highbank: Prevent glitches in non-bypass reset mode Mark Langsdorf
2013-01-04 16:35 ` [PATCH 3/4 v10] arm highbank: add support for pl320 IPC Mark Langsdorf
2013-01-04 16:35 ` [PATCH 4/4 v10] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2013-01-25 19:46 ` [PATCH 0/4 v11] cpufreq: add support for Calxeda ECX-1000 (highbank) Mark Langsdorf
2013-01-25 19:46 ` [PATCH 1/4 v11] arm: use device tree to get smp_twd clock Mark Langsdorf
2013-01-25 21:03 ` Rafael J. Wysocki [this message]
2013-01-25 21:40 ` Russell King - ARM Linux
2013-01-25 22:15 ` Rafael J. Wysocki
2013-01-25 19:46 ` [PATCH 2/4 v11] clk, highbank: Prevent glitches in non-bypass reset mode Mark Langsdorf
2013-01-25 19:46 ` [PATCH 3/4 v11] arm highbank: add support for pl320 IPC Mark Langsdorf
2013-01-28 12:49 ` Rafael J. Wysocki
2013-01-28 13:44 ` Mark Langsdorf
2013-01-28 20:48 ` Rafael J. Wysocki
2013-01-25 19:46 ` [PATCH 4/4] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
2013-01-26 14:39 ` Shawn Guo
2013-01-26 22:24 ` Rafael J. Wysocki
2013-01-28 8:37 ` Shawn Guo
2013-01-28 16:13 ` [PATCH 0/4 v12] cpufreq: add support for Calxeda ECX-1000 (highbank) Mark Langsdorf
2013-01-28 16:13 ` [PATCH 1/4 v12] arm: use device tree to get smp_twd clock Mark Langsdorf
2013-01-28 16:13 ` [PATCH 2/4 v12] clk, highbank: Prevent glitches in non-bypass reset mode Mark Langsdorf
2013-01-28 16:13 ` [PATCH 3/4 v12] arm highbank: add support for pl320 IPC Mark Langsdorf
2013-01-28 16:13 ` [PATCH 4/4 v12] cpufreq, highbank: add support for highbank cpufreq Mark Langsdorf
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=3041510.xugDHtFsGr@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=cpufreq@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.langsdorf@calxeda.com \
--cc=rob.herring@calxeda.com \
/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
Powered by JetHome