From: ezequiel.garcia@free-electrons.com (Ezequiel Garcia)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC
Date: Wed, 22 Oct 2014 12:22:23 -0300 [thread overview]
Message-ID: <5447CBAF.2000602@free-electrons.com> (raw)
In-Reply-To: <20141022155410.0cc36e4c@free-electrons.com>
On 10/22/2014 10:54 AM, Thomas Petazzoni wrote:
> Dear Ezequiel Garcia,
>
> On Wed, 22 Oct 2014 10:34:43 -0300, Ezequiel Garcia wrote:
>
>> +static void __init armada_375_timer_init(struct device_node *np)
>> +{
>> + struct clk *clk;
>> +
>> + clk = of_clk_get_by_name(np, "fixed");
>> + if (!IS_ERR(clk)) {
>> + clk_prepare_enable(clk);
>> + timer_clk = clk_get_rate(clk);
>> + } else {
>> +
>> + /*
>> + * This fallback is required in order to retain proper
>> + * devicetree backwards compatibility.
>> + */
>> + clk = of_clk_get(np, 0);
>> +
>> + /* Must have at least a clock */
>> + BUG_ON(IS_ERR(clk));
>> + clk_prepare_enable(clk);
>> + timer_clk = clk_get_rate(clk) / TIMER_DIVIDER;
>> + timer25Mhz = false;
>> + }
>
> Maybe we could re-use a bit more existing code, don't know if it makes
> things clearer though:
>
> clk = of_clk_get_by_name(np, "fixed");
> if (!IS_ERR(clk))
> armada_xp_timer_init(np);
> else
> armada_370_timer_init(np);
>
Yeah, I thought about this option, but chosen to implement it explicitly.
The reason is that I wanted to make sure we had a sane backward
compatibility fallback, which is specifically crafted for A375.
By re-using the 370 and XP, we are exposed to someone changing the
armada_xp_timer_init() thinking it will only affect AXP, which might
break things for A375.
--
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-10-22 15:22 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 13:34 [PATCH 0/4] Make Armada 375 use the reference clock when possible Ezequiel Garcia
2014-10-22 13:34 ` [PATCH 1/4] clocksource: armada-370-xp: Add missing clock enable Ezequiel Garcia
2014-10-22 13:50 ` Thomas Petazzoni
2014-10-22 14:37 ` Gregory CLEMENT
2014-10-22 13:34 ` [PATCH 2/4] watchdog: orion: Use the reference clock on Armada 375 SoC Ezequiel Garcia
2014-10-22 13:51 ` Thomas Petazzoni
2014-10-22 14:02 ` Andrew Lunn
2014-10-22 22:41 ` Ezequiel Garcia
2014-10-22 22:54 ` Guenter Roeck
2014-10-22 23:59 ` Andrew Lunn
2014-10-23 0:55 ` Ezequiel Garcia
2014-10-22 13:34 ` [PATCH 3/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC Ezequiel Garcia
2014-10-22 13:54 ` Thomas Petazzoni
2014-10-22 15:22 ` Ezequiel Garcia [this message]
2014-10-22 13:34 ` [PATCH 4/4] ARM: dts: Enable the reference clock for timer and watchdog on Armada 375 SoC Ezequiel Garcia
2014-10-22 13:55 ` Thomas Petazzoni
2014-10-22 15:27 ` Ezequiel Garcia
2014-10-22 13:55 ` [PATCH 0/4] Make Armada 375 use the reference clock when possible Andrew Lunn
2014-10-22 13:56 ` Thomas Petazzoni
2014-10-22 14:08 ` Andrew Lunn
2014-10-22 14:25 ` Thomas Petazzoni
2014-10-22 15:29 ` Ezequiel Garcia
2014-10-23 12:36 ` Ezequiel Garcia
2014-10-23 12:16 ` Ezequiel Garcia
2014-10-23 12:26 ` Thomas Petazzoni
2014-10-23 12:43 ` Ezequiel Garcia
2014-11-03 21:29 ` Thomas Petazzoni
2014-10-22 14:43 ` Gregory CLEMENT
2014-10-22 14:49 ` Thomas Petazzoni
2014-10-22 15:10 ` 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=5447CBAF.2000602@free-electrons.com \
--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).