From: ezequiel.garcia@free-electrons.com (Ezequiel Garcia)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] clk: mvebu: Add core-divider clock
Date: Thu, 26 Sep 2013 15:29:37 -0300 [thread overview]
Message-ID: <20130926182936.GA7772@localhost> (raw)
In-Reply-To: <20130926082404.GA18244@lunn.ch>
Hey Andrew,
On Thu, Sep 26, 2013 at 10:24:04AM +0200, Andrew Lunn wrote:
>
> + /*
> + * Wait for clocks to settle down, and then clear all the
> + * ratios request and the reload request.
> + */
> + udelay(1000);
> + reg &= ~(CORE_CLOCK_DIVIDER_RATIO_MASK | CORE_CLOCK_DIVIDER_RATIO_RELOAD);
> + writel(reg, corediv->reg);
> + udelay(1000);
>
>
> Documentation/timers/timers-howto.txt says:
>
> SLEEPING FOR ~USECS OR SMALL MSECS ( 10us - 20ms):
> * Use usleep_range
>
Given the set_rate should be protected by spinlocks (as you pointed out),
I guess we can't afford using usleep_range (the context is now non-atomic).
Now, according to arch/arm/include/asm/delay.h this is the suggestion
for udelay and friends:
* Use only for very small delays ( < 2 msec). Should probably use a
* lookup table, really, as the multiplications take much too long with
* short delays. This is a "reasonable" implementation, though (and
* the first constant multiplications gets optimized away if the delay is
* a constant)
Which means we could just use udelay(1000) without much trouble.
On the other side, since we know the rate the clock is running, we could
use __delay() just as drivers/clk/sunxi/clk-factors.c is doing.
__delay() has a much simpler implementation, which feels correct in
this case of "wait until the clock settles".
Therefore, I'm currently going to try that option.
--
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
next prev parent reply other threads:[~2013-09-26 18:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 21:28 [PATCH 0/5] Add Core Divider clock support for Armada 370/XP Ezequiel Garcia
2013-09-25 21:28 ` [PATCH 1/5] clk: mvebu: Add core-divider clock Ezequiel Garcia
2013-09-25 21:28 ` [PATCH 2/5] ARM: mvebu: Add Core Divider clock device-tree binding Ezequiel Garcia
2013-09-25 21:28 ` [PATCH 3/5] ARM: mvebu: Add a 2 GHz fixed-clock Armada 370/XP Ezequiel Garcia
2013-09-25 21:28 ` [PATCH 4/5] ARM: mvebu: Add the core-divider clock to " Ezequiel Garcia
2013-09-25 21:28 ` [PATCH 5/5] ARM: mvebu: Add NAND " Ezequiel Garcia
2013-09-25 21:37 ` [PATCH 0/5] Add Core Divider clock support for " Ezequiel Garcia
2013-09-26 7:38 ` Gregory CLEMENT
2013-09-26 15:26 ` Ezequiel Garcia
2013-09-26 15:47 ` Thomas Petazzoni
2013-09-26 16:00 ` Ezequiel Garcia
2013-09-26 16:12 ` Thomas Petazzoni
2013-09-26 8:24 ` [PATCH 1/5] clk: mvebu: Add core-divider clock Andrew Lunn
2013-09-26 15:12 ` Ezequiel Garcia
2013-09-26 15:56 ` Andrew Lunn
2013-09-26 16:55 ` Ben Dooks
2013-09-26 18:29 ` Ezequiel Garcia [this message]
2013-09-26 8:36 ` [PATCH 2/5] ARM: mvebu: Add Core Divider clock device-tree binding Andrew Lunn
2013-09-26 15:04 ` 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=20130926182936.GA7772@localhost \
--to=ezequiel.garcia@free-electrons.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).