devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
To: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux-MIPS <linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>,
	Daniel Lezcano
	<daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	James Hartley
	<james.hartley-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>,
	James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	Damien Horsley
	<Damien.Horsley-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>,
	Govindraj Raja
	<Govindraj.Raja-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 4/7] clocksource: mips-gic: Update clockevent frequency on clock rate changes
Date: Thu, 21 May 2015 19:30:12 -0300	[thread overview]
Message-ID: <555E5C74.3000800@imgtec.com> (raw)
In-Reply-To: <CAL1qeaEzKh6H8HBCULJWM4yMnSQGexWmV0rrnYMViMpuzKWyLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>



On 05/21/2015 07:32 PM, Andrew Bresticker wrote:
> On Thu, May 21, 2015 at 2:37 PM, Ezequiel Garcia
> <ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org> wrote:
>> This commit introduces the clockevent frequency update, using
>> a clock notifier. It will be used to support CPUFreq on platforms
>> using MIPS GIC based clockevents.
>>
>> Signed-off-by: Ezequiel Garcia <ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
>> ---
>>  drivers/clocksource/mips-gic-timer.c | 31 ++++++++++++++++++++++++++++++-
>>  1 file changed, 30 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c
>> index 22a4daf..71bbd42 100644
>> --- a/drivers/clocksource/mips-gic-timer.c
>> +++ b/drivers/clocksource/mips-gic-timer.c
>> @@ -79,6 +79,13 @@ static void gic_clockevent_cpu_exit(struct clock_event_device *cd)
>>         disable_percpu_irq(gic_timer_irq);
>>  }
>>
>> +static void gic_update_frequency(void *data)
>> +{
>> +       unsigned long rate = (unsigned long)data;
>> +
>> +       clockevents_update_freq(this_cpu_ptr(&gic_clockevent_device), rate);
>> +}
>> +
>>  static int gic_cpu_notifier(struct notifier_block *nb, unsigned long action,
>>                                 void *data)
>>  {
>> @@ -94,10 +101,26 @@ static int gic_cpu_notifier(struct notifier_block *nb, unsigned long action,
>>         return NOTIFY_OK;
>>  }
>>
>> +static int gic_clk_notifier(struct notifier_block *nb, unsigned long action,
>> +                           void *data)
>> +{
>> +       struct clk_notifier_data *cnd = data;
>> +
>> +       if (action == POST_RATE_CHANGE)
>> +               on_each_cpu(gic_update_frequency, (void *)cnd->new_rate, 1);
>> +
>> +       return NOTIFY_OK;
>> +}
>> +
>> +
>>  static struct notifier_block gic_cpu_nb = {
>>         .notifier_call = gic_cpu_notifier,
>>  };
>>
>> +static struct notifier_block gic_clk_nb = {
>> +       .notifier_call = gic_clk_notifier,
>> +};
>> +
>>  static int gic_clockevent_init(void)
>>  {
>>         int ret;
>> @@ -160,6 +183,7 @@ void __init gic_clocksource_init(unsigned int frequency)
>>  static void __init gic_clocksource_of_init(struct device_node *node)
>>  {
>>         struct clk *clk;
>> +       int ret;
>>
>>         if (WARN_ON(!gic_present || !node->parent ||
>>                     !of_device_is_compatible(node->parent, "mti,gic")))
>> @@ -186,7 +210,12 @@ static void __init gic_clocksource_of_init(struct device_node *node)
>>         }
>>
>>         __gic_clocksource_init();
>> -       gic_clockevent_init();
>> +
>> +       ret = gic_clockevent_init();
>> +       if (ret < 0 && !IS_ERR(clk)) {
> 
> I think you mean ret == 0 here?
> 
>> +               if (clk_notifier_register(clk, &gic_clk_nb) < 0)
>> +                       pr_warn("GIC: Unable to register clock notifier\n");
>> +       }

Ouch, certainly.
-- 
Ezequiel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-05-21 22:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 21:37 [PATCH 0/7] Clocksource changes for Pistachio CPUFreq Ezequiel Garcia
2015-05-21 21:37 ` [PATCH 2/7] clocksource: mips-gic: Add missing error returns checks Ezequiel Garcia
     [not found]   ` <1432244260-14908-3-git-send-email-ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-05-21 22:18     ` Andrew Bresticker
     [not found] ` <1432244260-14908-1-git-send-email-ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-05-21 21:37   ` [PATCH 1/7] clocksource: mips-gic: Enable the clock before using it Ezequiel Garcia
     [not found]     ` <1432244260-14908-2-git-send-email-ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-05-21 22:17       ` Andrew Bresticker
2015-05-21 21:37   ` [PATCH 3/7] clocksource: mips-gic: Split clocksource and clockevent initialization Ezequiel Garcia
2015-05-21 22:24     ` Andrew Bresticker
     [not found]       ` <CAL1qeaFkzpH+nGqRPOuY-L62jP8NgZWP0WxKTYKXZDpe1sSojg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-21 22:25         ` Ezequiel Garcia
     [not found]           ` <555E5B5C.9050807-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-05-22 16:53             ` Andrew Bresticker
2015-05-21 21:37   ` [PATCH 4/7] clocksource: mips-gic: Update clockevent frequency on clock rate changes Ezequiel Garcia
     [not found]     ` <1432244260-14908-5-git-send-email-ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-05-21 22:32       ` Andrew Bresticker
     [not found]         ` <CAL1qeaEzKh6H8HBCULJWM4yMnSQGexWmV0rrnYMViMpuzKWyLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-21 22:30           ` Ezequiel Garcia [this message]
2015-05-21 21:41   ` [PATCH 6/7] clocksource: Add Pistachio clocksource-only driver Ezequiel Garcia
2015-05-21 22:00     ` Thomas Gleixner
2015-05-21 22:02       ` Ezequiel Garcia
     [not found]         ` <555E55F4.2060500-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-05-21 22:09           ` Thomas Gleixner
2015-05-22 16:48     ` Andrew Bresticker
     [not found]       ` <CAL1qeaEL7D6=WpyigbHWv8DEhp0XhC4acCYRkQ6Fm0Wr4HW11A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-26 14:16         ` Ezequiel Garcia
2015-05-21 21:41 ` [PATCH 5/7] clocksource: Add Pistachio SoC general purpose timer binding document Ezequiel Garcia
2015-05-21 23:41   ` Andrew Bresticker
2015-05-21 21:43 ` [PATCH 7/7] mips: pistachio: Allow to enable the external timer based clocksource Ezequiel Garcia
     [not found]   ` <1432244618-15548-1-git-send-email-ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-05-22 16:50     ` Andrew Bresticker
2015-05-22 16:58       ` James Hartley
2015-05-22 18:08         ` Ezequiel Garcia

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=555E5C74.3000800@imgtec.com \
    --to=ezequiel.garcia-1axoqhu6uovqt0dzr+alfa@public.gmane.org \
    --cc=Damien.Horsley-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
    --cc=Govindraj.Raja-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
    --cc=abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=james.hartley-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
    --cc=james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.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).