From: "Heiko Stübner" <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
To: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
Cc: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
John Stultz <john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Grant Likely
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init
Date: Tue, 4 Jun 2013 17:06:29 +0200 [thread overview]
Message-ID: <201306041706.30112.heiko@sntech.de> (raw)
In-Reply-To: <20130604142120.GD5308@maple>
Am Dienstag, 4. Juni 2013, 16:21:20 schrieb Jamie Iles:
> Hi Heiko,
>
> On Tue, Jun 04, 2013 at 11:38:42AM +0200, Heiko Stübner wrote:
> > dw_apb_timer_init used to search the devicetree for matching timer
> > devices, making calls to it from board files necessary.
> >
> > Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE.
> > With this change the function gets called once for each timer node
> > and tracks these number of calls to attach clockevent and clocksource
> > devices to the nodes.
> >
> > Also remove the calls to dw_apb_timer_init from all previous users, as
> > clocksource_of_init is the default for init_time now.
> >
> > Tested on the upcoming rk3066 code.
> >
> > Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
> > Acked-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> > Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> > ---
>
> ...
>
> > -void __init dw_apb_timer_init(void)
> > +static int num_called;
> > +static void __init dw_apb_timer_init(struct device_node *timer)
> >
> > {
> >
> > - struct device_node *event_timer, *source_timer;
> > -
> > - event_timer = of_find_matching_node(NULL, osctimer_ids);
> > - if (!event_timer)
> > - panic("No timer for clockevent");
> > - add_clockevent(event_timer);
> > -
> > - source_timer = of_find_matching_node(event_timer, osctimer_ids);
> > - if (!source_timer)
> > - panic("No timer for clocksource");
> > - add_clocksource(source_timer);
> > -
> > - of_node_put(source_timer);
> > + switch (num_called) {
> > + case 0:
> > + pr_debug("%s: found clockevent timer\n", __func__);
> > + add_clockevent(timer);
> > + of_node_put(timer);
> > + break;
> > + case 1:
> > + pr_debug("%s: found clocksource timer\n", __func__);
> > + add_clocksource(timer);
> > + of_node_put(timer);
> > + init_sched_clock();
> > + break;
> > + default:
> > + break;
> > + }
> >
> > - init_sched_clock();
> > + num_called++;
> >
> > }
> >
> > +CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer",
> > dw_apb_timer_init); +CLOCKSOURCE_OF_DECLARE(apb_timer,
> > "snps,dw-apb-timer-osc", dw_apb_timer_init);
>
> I think maybe we also want CLOCKSOURCE_OF_DECLARE() instances for the
> contents of sptimer_ids for completeness, otherwise looks good.
Hmm ... difficult.
As you can see, currently we call init_sched_clock when the second timer is
found, which then tries to find the sptimer or uses the clocksource as
sched_clock.
So to use CLOCKSOURCE_OF_DECLARE for the sptimer the init_sched_clock call
would need to move to its init function. So on system without sptimer (like
mine) this third call would never happen, and the system would be missing a
sched_clock.
Or I just don't see the solution currently. In any case this could probably be
handled by someone with the relevant hardware to test ;-) .
> Acked-by: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
thanks
next prev parent reply other threads:[~2013-06-04 15:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-04 9:36 [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support Heiko Stübner
[not found] ` <201306041136.09566.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-06-04 9:37 ` [PATCH v2 1/4] clocksource: dw_apb_timer_of: enable the use the clocksource as sched clock Heiko Stübner
[not found] ` <201306041137.03319.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-06-04 10:52 ` Heiko Stübner
2013-06-04 14:13 ` Jamie Iles
2013-06-04 9:37 ` [PATCH v2 2/4] clocksource: dw_apb_timer_of: add clock-handling Heiko Stübner
2013-06-04 14:15 ` Jamie Iles
2013-06-04 9:38 ` [PATCH v2 3/4] clocksource: dw_apb_timer_of: select DW_APB_TIMER Heiko Stübner
[not found] ` <201306041138.11447.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-06-04 14:15 ` Jamie Iles
2013-06-04 9:38 ` [PATCH v2 4/4] clocksource: dw_apb_timer_of: use clocksource_of_init Heiko Stübner
[not found] ` <201306041138.42639.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-06-04 14:21 ` Jamie Iles
2013-06-04 15:06 ` Heiko Stübner [this message]
2013-06-12 8:55 ` [PATCH v2 0/4] dw_apb_timer: osc as sched_clock, clocks and clocksource_of support Heiko Stübner
2013-06-12 9:46 ` Linus Walleij
2013-06-12 17:51 ` Olof Johansson
2013-06-12 17:53 ` Olof Johansson
2013-06-04 15:28 ` Dinh Nguyen
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=201306041706.30112.heiko@sntech.de \
--to=heiko-4mtyjxux2i+zqb+pc5nmwq@public.gmane.org \
--cc=baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org \
--cc=john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@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).