All of lore.kernel.org
 help / color / mirror / Atom feed
From: jamie@jamieiles.com (Jamie Iles)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] ARM: Xilinx: Adding timer support to the platform
Date: Mon, 7 Feb 2011 14:58:58 +0000	[thread overview]
Message-ID: <20110207145858.GC24893@pulham.picochip.com> (raw)
In-Reply-To: <a58cfb3f-31d6-4120-a961-694aed8b7486@VA3EHSMHS006.ehs.local>

On Mon, Feb 07, 2011 at 07:16:01AM -0700, John Linn wrote:
> > -----Original Message-----
> > From: Jamie Iles [mailto:jamie at jamieiles.com]
> > Sent: Saturday, February 05, 2011 6:04 PM
> > To: John Linn
> > Cc: linux-arm-kernel at lists.infradead.org;
> linux-kernel at vger.kernel.org; linux at arm.linux.org.uk;
> > catalin.marinas at arm.com; glikely at secretlab.ca; Kiran Sutariya
> > Subject: Re: [PATCH 3/4] ARM: Xilinx: Adding timer support to the
> platform
> > 
> > Hi John,
> > 
> > A couple more nitpicks.
> > 
> > Jamie
> > 
> > On Sat, Feb 05, 2011 at 09:17:16AM -0700, John Linn wrote:
> > > +static irqreturn_t xttcpss_clock_event_interrupt(int irq, void
> *dev_id)
> > > +{
> > > +	struct clock_event_device *evt = &xttcpss_clockevent;
> > > +	struct xttcpss_timer *timer = dev_id;
> > > +	u32 ctrl_reg;
> > > +
> > > +	/* Acknowledge the interrupt and call event handler */
> > > +	xttcpss_write(timer->base_addr + XTTCPSS_ISR_OFFSET,
> > > +		xttcpss_read(timer->base_addr + XTTCPSS_ISR_OFFSET));
> > > +
> > > +	if (timer->mode == CLOCK_EVT_MODE_ONESHOT) {
> > > +
> > > +		/* Disable the counter as it would keep running. */
> > > +		ctrl_reg = xttcpss_read(timer->base_addr +
> > > +					XTTCPSS_CNT_CNTRL_OFFSET);
> > > +		ctrl_reg |= ~(XTTCPSS_CNT_CNTRL_ENABLE_MASK);
> > 
> > The clock events framework should reprogram the next event so you
> don't
> > actually need to disable the timer here.  Once the event handler has
> > been called the timer will be reenabled with a new period, and as
> we're
> > running with interrupts disabled here we don't need to stop the timer.
> > 
> 
> What about if there's not another event to be started?

Then the clockevents code can set the mode to CLOCK_EVT_MODE_SHUTDOWN 
and this should disable the timer.  For NOHZ, AFAICT the 
clockevents/tick code will make sure that the next tick always falls 
within your max_delta_ns.

Jamie

WARNING: multiple messages have this Message-ID (diff)
From: Jamie Iles <jamie@jamieiles.com>
To: John Linn <John.Linn@xilinx.com>
Cc: Jamie Iles <jamie@jamieiles.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux@arm.linux.org.uk,
	catalin.marinas@arm.com, glikely@secretlab.ca,
	Kiran Sutariya <kiran.sutariya@einfochips.com>
Subject: Re: [PATCH 3/4] ARM: Xilinx: Adding timer support to the platform
Date: Mon, 7 Feb 2011 14:58:58 +0000	[thread overview]
Message-ID: <20110207145858.GC24893@pulham.picochip.com> (raw)
In-Reply-To: <a58cfb3f-31d6-4120-a961-694aed8b7486@VA3EHSMHS006.ehs.local>

On Mon, Feb 07, 2011 at 07:16:01AM -0700, John Linn wrote:
> > -----Original Message-----
> > From: Jamie Iles [mailto:jamie@jamieiles.com]
> > Sent: Saturday, February 05, 2011 6:04 PM
> > To: John Linn
> > Cc: linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; linux@arm.linux.org.uk;
> > catalin.marinas@arm.com; glikely@secretlab.ca; Kiran Sutariya
> > Subject: Re: [PATCH 3/4] ARM: Xilinx: Adding timer support to the
> platform
> > 
> > Hi John,
> > 
> > A couple more nitpicks.
> > 
> > Jamie
> > 
> > On Sat, Feb 05, 2011 at 09:17:16AM -0700, John Linn wrote:
> > > +static irqreturn_t xttcpss_clock_event_interrupt(int irq, void
> *dev_id)
> > > +{
> > > +	struct clock_event_device *evt = &xttcpss_clockevent;
> > > +	struct xttcpss_timer *timer = dev_id;
> > > +	u32 ctrl_reg;
> > > +
> > > +	/* Acknowledge the interrupt and call event handler */
> > > +	xttcpss_write(timer->base_addr + XTTCPSS_ISR_OFFSET,
> > > +		xttcpss_read(timer->base_addr + XTTCPSS_ISR_OFFSET));
> > > +
> > > +	if (timer->mode == CLOCK_EVT_MODE_ONESHOT) {
> > > +
> > > +		/* Disable the counter as it would keep running. */
> > > +		ctrl_reg = xttcpss_read(timer->base_addr +
> > > +					XTTCPSS_CNT_CNTRL_OFFSET);
> > > +		ctrl_reg |= ~(XTTCPSS_CNT_CNTRL_ENABLE_MASK);
> > 
> > The clock events framework should reprogram the next event so you
> don't
> > actually need to disable the timer here.  Once the event handler has
> > been called the timer will be reenabled with a new period, and as
> we're
> > running with interrupts disabled here we don't need to stop the timer.
> > 
> 
> What about if there's not another event to be started?

Then the clockevents code can set the mode to CLOCK_EVT_MODE_SHUTDOWN 
and this should disable the timer.  For NOHZ, AFAICT the 
clockevents/tick code will make sure that the next tick always falls 
within your max_delta_ns.

Jamie

  reply	other threads:[~2011-02-07 14:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1296922637-24662-1-git-send-email-john.linn@xilinx.com>
2011-02-05 16:17 ` [PATCH 1/4] ARM: Xilinx: Adding Xilinx platform infrastructure support John Linn
2011-02-05 16:17   ` John Linn
     [not found] ` <1296922637-24662-2-git-send-email-john.linn@xilinx.com>
2011-02-05 16:17   ` [PATCH 2/4] ARM: Xilinx: Adding Xilinx board support John Linn
2011-02-05 16:17     ` John Linn
2011-02-06  0:45     ` Jamie Iles
2011-02-06  0:45       ` Jamie Iles
2011-02-07 14:05       ` John Linn
2011-02-07 14:05         ` John Linn
     [not found]   ` <1296922637-24662-3-git-send-email-john.linn@xilinx.com>
2011-02-05 16:17     ` [PATCH 3/4] ARM: Xilinx: Adding timer support to the platform John Linn
2011-02-05 16:17       ` John Linn
2011-02-06  1:03       ` Jamie Iles
2011-02-06  1:03         ` Jamie Iles
2011-02-07 14:16         ` John Linn
2011-02-07 14:16           ` John Linn
2011-02-07 14:58           ` Jamie Iles [this message]
2011-02-07 14:58             ` Jamie Iles
2011-02-07 15:01             ` John Linn
2011-02-07 15:01               ` John Linn
     [not found]     ` <1296922637-24662-4-git-send-email-john.linn@xilinx.com>
2011-02-05 16:17       ` [PATCH 4/4] ARM: Xilinx: base header files and assembly macros John Linn
2011-02-05 16:17         ` John Linn
     [not found] <1296922124-23379-1-git-send-email-john.linn@xilinx.com>
     [not found] ` <1296922124-23379-2-git-send-email-john.linn@xilinx.com>
     [not found]   ` <1296922124-23379-3-git-send-email-john.linn@xilinx.com>
2011-02-05 16:08     ` [PATCH 3/4] ARM: Xilinx: Adding timer support to the platform John Linn
2011-02-05 16:36       ` Russell King - ARM Linux
2011-02-05 17:12         ` John Linn
2011-02-08 14:35       ` Russell King - ARM Linux
2011-02-08 15:06         ` John Linn
2011-02-08 15:25           ` Arnd Bergmann
2011-02-08 17:11             ` John Linn
2011-02-08 17:53             ` John Linn
2011-02-08 18:24               ` Arnd Bergmann
2011-02-08 18:31                 ` Grant Likely

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=20110207145858.GC24893@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.