public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: gregory.clement@free-electrons.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 2/4] clk: mvebu: armada-370: Fix timer drift caused by the SSCG deviation
Date: Tue,  2 Sep 2014 10:15:17 +0200	[thread overview]
Message-ID: <1409645719-20003-3-git-send-email-gregory.clement@free-electrons.com> (raw)
In-Reply-To: <1409645719-20003-1-git-send-email-gregory.clement@free-electrons.com>

This commit activates the SSCG deviation correction for the Armada
370. It uses the optional function introduced by the commit "clk:
mvebu: Fix clk frequency value if SSCG is enabled".

Without this fix the deviation measured on a Mirabox was of a few
second each hour, whereas with this fix it was reduced at around
50ppm (around 4s per day).

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 drivers/clk/mvebu/armada-370.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/clk/mvebu/armada-370.c b/drivers/clk/mvebu/armada-370.c
index bef198a83863..756f0f39d6a3 100644
--- a/drivers/clk/mvebu/armada-370.c
+++ b/drivers/clk/mvebu/armada-370.c
@@ -23,6 +23,7 @@
  */
 
 #define SARL				0	/* Low part [0:31] */
+#define	 SARL_A370_SSCG_ENABLE		BIT(10)
 #define	 SARL_A370_PCLK_FREQ_OPT	11
 #define	 SARL_A370_PCLK_FREQ_OPT_MASK	0xF
 #define	 SARL_A370_FAB_FREQ_OPT		15
@@ -133,10 +134,17 @@ static void __init a370_get_clk_ratio(
 	}
 }
 
+static bool a370_is_sscg_enabled(void __iomem *sar)
+{
+	return !(readl(sar) & SARL_A370_SSCG_ENABLE);
+}
+
 static const struct coreclk_soc_desc a370_coreclks = {
 	.get_tclk_freq = a370_get_tclk_freq,
 	.get_cpu_freq = a370_get_cpu_freq,
 	.get_clk_ratio = a370_get_clk_ratio,
+	.is_sscg_enabled = a370_is_sscg_enabled,
+	.fix_sscg_deviation = kirkwood_fix_sscg_deviation,
 	.ratios = a370_coreclk_ratios,
 	.num_ratios = ARRAY_SIZE(a370_coreclk_ratios),
 };
-- 
1.9.1

  parent reply	other threads:[~2014-09-02  8:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02  8:15 [PATCH V2 0/4] clk: mvebu: Improve clock drift Gregory CLEMENT
2014-09-02  8:15 ` [PATCH V2 1/4] clk: mvebu: Fix clk frequency value if SSCG is enabled Gregory CLEMENT
2014-09-02  8:15 ` Gregory CLEMENT [this message]
2014-09-02  8:15 ` [PATCH V2 3/4] ARM: mvebu: add SSCG to Armada 370 Device Tree Gregory CLEMENT
2014-09-02  8:15 ` [PATCH V2 4/4] clk: mvebu: armada-375: Fix the description of the SAR in the comment Gregory CLEMENT
2014-09-03 14:40 ` [PATCH V2 0/4] clk: mvebu: Improve clock drift Leigh Brown
2014-09-03 17:03   ` Mike Turquette
2014-09-03 17:11     ` Jason Cooper
2014-09-09 15:42 ` Jason Cooper

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=1409645719-20003-3-git-send-email-gregory.clement@free-electrons.com \
    --to=gregory.clement@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