From: Thomas Gleixner <tglx@linutronix.de>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: John Stultz <john.stultz@linaro.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Emilio Lopez <emilio@elopez.com.ar>,
kevin@allwinnertech.com, sunny@allwinnertech.com,
shuge@allwinnertech.com, linux-sunxi@googlegroups.com
Subject: Re: [PATCHv2 4/8] clocksource: sun4i: Fix the next event code
Date: Fri, 28 Jun 2013 23:27:25 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1306282322480.4013@ionos.tec.linutronix.de> (raw)
In-Reply-To: <20130628210853.GB2756@lukather>
On Fri, 28 Jun 2013, Maxime Ripard wrote:
> On Fri, Jun 28, 2013 at 10:13:08PM +0200, Thomas Gleixner wrote:
> > On Fri, 28 Jun 2013, Maxime Ripard wrote:
> > > @@ -61,9 +62,14 @@ static void sun4i_clkevt_mode(enum clock_event_mode mode,
> > > static int sun4i_clkevt_next_event(unsigned long evt,
> > > struct clock_event_device *unused)
> > > {
> > > - u32 u = readl(timer_base + TIMER_CTL_REG(0));
> > > - writel(evt, timer_base + TIMER_CNTVAL_REG(0));
> > > - writel(u | TIMER_CTL_ENABLE | TIMER_CTL_AUTORELOAD,
> > > + u32 val = readl(timer_base + TIMER_CTL_REG(0));
> > > + writel(val & ~TIMER_CTL_ENABLE, timer_base + TIMER_CTL_REG(0));
> > > + udelay(1);
> >
> > That udelay() is more than suspicious. Is there really no other way to
> > deal with that hardware?
> >
> > If no, you really need to put a proper explanation for that into the code.
>
> The datasheet states that you have to wait for two ticks of the timer
> clock source (in that case, 24MHz, which makes it around 80-85ns) before
> you can actually enable it back.
>
> I didn't came up with a better solution.
80-85ns is definitely way less than 1us.
Why not reading the counter register and wait for 2 or 3 cycles to
elapse instead of wasting a full microsecond evertime ?
Thanks,
tglx
next prev parent reply other threads:[~2013-06-28 21:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-28 19:56 [PATCHv2 0/8] clocksource: sunxi: Timer fixes and cleanup Maxime Ripard
2013-06-28 19:56 ` [PATCHv2 1/8] clocksource: sun4i: Use the BIT macros where possible Maxime Ripard
2013-06-28 19:56 ` [PATCHv2 2/8] clocksource: sun4i: Add clocksource and sched clock drivers Maxime Ripard
2013-06-28 19:56 ` [PATCHv2 3/8] clocksource: sun4i: Don't forget to enable the clock we use Maxime Ripard
2013-06-28 19:56 ` [PATCHv2 4/8] clocksource: sun4i: Fix the next event code Maxime Ripard
2013-06-28 20:13 ` Thomas Gleixner
2013-06-28 20:35 ` Tomasz Figa
2013-06-28 21:20 ` Maxime Ripard
2013-06-28 21:08 ` Maxime Ripard
2013-06-28 21:27 ` Thomas Gleixner [this message]
2013-06-29 6:48 ` Maxime Ripard
2013-07-01 8:15 ` Thomas Gleixner
2013-06-28 19:56 ` [PATCHv2 5/8] clocksource: sun4i: Factor out some timer code Maxime Ripard
2013-06-28 19:56 ` [PATCHv2 6/8] clocksource: sun4i: Remove TIMER_SCAL variable Maxime Ripard
2013-06-28 19:56 ` [PATCHv2 7/8] clocksource: sun4i: Cleanup parent clock setup Maxime Ripard
2013-06-28 19:56 ` [PATCHv2 8/8] clocksource: sun4i: Fix bug when switching from periodic to oneshot modes Maxime Ripard
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=alpine.DEB.2.02.1306282322480.4013@ionos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=emilio@elopez.com.ar \
--cc=john.stultz@linaro.org \
--cc=kevin@allwinnertech.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=maxime.ripard@free-electrons.com \
--cc=shuge@allwinnertech.com \
--cc=sunny@allwinnertech.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
all inboxes | Powered by JetHome®