public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: ml-arm@syscall.eu (Raphaël Rigo)
To: linux-arm-kernel@lists.infradead.org
Subject: [BUG] Armada 370 system clock drift (SSC related)
Date: Sun, 15 Jun 2014 20:59:48 +0200	[thread overview]
Message-ID: <539DED24.6010802@syscall.eu> (raw)

Hello,
I have a Netgear ReadyNAS 102 which exhibits a strong drift of its system clock.
The drift is pretty stable, as this old log shows :

Dec 15 07:23:41  9.760884 sec
Dec 15 08:23:58  9.737968 sec
Dec 15 09:24:14  9.750450 sec
Dec 15 10:24:31  9.762054 sec
...
Dec 16 19:33:37  9.750936 sec
Dec 16 20:33:54  9.757914 sec

I took a look at Netgear GPL code in their kernel (3.0.93, based on Marvell 4.0
LSP) and noticed the following in arch/arm/mach-armada370/time.c:

#include "boardEnv/mvBoardEnvSpec.h"
void __init axp_time_init(unsigned int fabric_clk)
{
        u32 u;

        printk("axp_time_init\n");

        ticks_per_jiffy = (fabric_clk + HZ/2) / HZ;
        if (get_board_type() & (NETGEAR_BD_TYPE_RN102 | NETGEAR_BD_TYPE_RN104))
        {
                if (0 == (MV_REG_READ(MPP_SAMPLE_AT_RESET) & BIT10))
                {
                        // DDR SSC is enabled.


                        fabric_clk = 598393125;
                } else {
                        // DDR SSC is disabled. fabric_clk is no need to change.


                        ;
                }
        }

I noticed that the above value is such that

  3600*(1 - (598393125/600000000)) = 9.64125

i.e. the hardcoded correction matches the drift observed above.


Which is consistent with the information in the recently released Marvell
documentation. In ARMADA370-FunctionalSpec-datasheet.pdf page 1140 there's the
explanation of the SSCG (spread spectrum clock generator) Configuration Register
which can be read to adjust the clock rate.

It would be nice if this bug could be fixed. If nobody steps up, I may try
patching it but since I have zero knowledge of creating kernel patches, it would
take me a long time compared to someone familiar with the code base.

Regards,
Rapha?l Rigo

             reply	other threads:[~2014-06-15 18:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-15 18:59 Raphaël Rigo [this message]
2014-06-16  0:20 ` [BUG] Armada 370 system clock drift (SSC related) 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=539DED24.6010802@syscall.eu \
    --to=ml-arm@syscall.eu \
    --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