From: jamie@jamieiles.com (Jamie Iles)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCHv2] picoxcell: add support for the system timers
Date: Wed, 8 Dec 2010 17:26:56 +0000 [thread overview]
Message-ID: <20101208172654.GG2716@pulham.picochip.com> (raw)
In-Reply-To: <20101208161411.GM9777@n2100.arm.linux.org.uk>
On Wed, Dec 08, 2010 at 04:14:11PM +0000, Russell King - ARM Linux wrote:
> On Fri, Nov 26, 2010 at 11:11:16AM +0000, Jamie Iles wrote:
> > +static irqreturn_t timer_interrupt(int irq, void *dev_id)
> > +{
> > + struct timer_instance *timer = &timers[TIMER_ID_CLOCKEVENT];
> > +
> > + /* If we are in oneshot mode, we need to stop receiving interrupts. */
> > + if (CLOCK_EVT_MODE_ONESHOT == clockevent_picoxcell.mode) {
> > + unsigned long val = readl(timer->base +
> > + TIMER_CONTROL_REG_OFFSET);
> > + val |= TIMER_INTERRUPT_MASK;
> > + writel(val, timer->base + TIMER_CONTROL_REG_OFFSET);
> > + }
>
> It's normal not to emulate behaviours here which the hardware doesn't
> support - that's the point of the generic clockevents/clocksource
> layers. They're there to handle whatever the hardware can support and
> turn it into something the kernel wants.
Ok, I underestimated clockevents and how NO_HZ works and thought that we'd
keep on receiving too many interrupts but that's not the case! I'll fix up the
next revision to remove this hack.
> > +/*
> > + * Overwrite weak default sched_clock with something more precise.
> > + *
> > + * On picoXcell we have a RTC that clocks at 200MHz so a multiply by 5 gives
> > + * us a nanosecond count.
> > + */
> > +unsigned long long notrace sched_clock(void)
> > +{
> > +#define CYCLES_TO_NSEC_MULT (NSEC_PER_SEC / CLOCK_TICK_RATE)
> > + return cnt32_to_63(readl(IO_ADDRESS(PICOXCELL_RTCLK_BASE) +
> > + RTCLK_CCV_REG_OFFSET)) * CYCLES_TO_NSEC_MULT;
>
> Have you read the comments in include/linux/cnt32_to_63.h, or thought
> about the '63' part of the name ?
Sadly not, this was one I'd taken from the mailing list for mach-tegra as we
were missing a sched_clock() implementation before. Since then I've had a go
at taking Linus' sched_clock() implementation for plat-nomadik and using that
to increase the wrap period which I'll roll into the next revision.
Jamie
next prev parent reply other threads:[~2010-12-08 17:26 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 10:06 ARM: add initial support for Picochip picoXcell SoC Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 01/13] picoxcell: add support for picoXcell Jamie Iles
2010-11-26 11:08 ` [PATCH] " Jamie Iles
2010-12-08 16:09 ` [RFC PATCH 01/13] " Russell King - ARM Linux
2010-12-08 16:52 ` Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 02/13] picoxcell: add support for AXI bus snoopers Jamie Iles
2010-12-08 16:10 ` Russell King - ARM Linux
2010-12-08 16:52 ` Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 03/13] picoxcell: add support for the system timers Jamie Iles
2010-11-26 11:11 ` [RFC PATCHv2] " Jamie Iles
2010-12-08 16:14 ` Russell King - ARM Linux
2010-12-08 17:26 ` Jamie Iles [this message]
2010-11-23 10:06 ` [RFC PATCH 04/13] picoxcell: add a pin muxing infrastructure Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 05/13] picoxcell: add gpio infrastructure Jamie Iles
2010-11-30 18:08 ` [RFC PATCHv2 " Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 06/13] picoxcell: add support for system clks Jamie Iles
2010-12-08 16:18 ` Russell King - ARM Linux
2010-12-08 17:39 ` Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 07/13] picoxcell: add common SoC devices Jamie Iles
2010-11-26 11:13 ` [RFC PATCHv2] " Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 08/13] picoxcell: add cpufreq support Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 09/13] picoxcell: add support for pm Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 10/13] picoxcell: add chained GPIO IRQ handlers Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 11/13] picoxcell: add support for pc3x2 devices Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 12/13] picoxcell: add support for pc3x3 devices Jamie Iles
2010-11-26 11:14 ` [RFC PATCHv2] " Jamie Iles
2010-11-23 10:06 ` [RFC PATCH 13/13] picoxcell: add support for the PC7302 development board Jamie Iles
2010-11-30 18:10 ` [RFC PATCHv2 10/13] picoxcell: add chained GPIO IRQ handlers Jamie Iles
2010-12-06 10:25 ` ARM: add initial support for Picochip picoXcell SoC Jamie Iles
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=20101208172654.GG2716@pulham.picochip.com \
--to=jamie@jamieiles.com \
--cc=linux-arm-kernel@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).