mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Igor Plyatov <plyatov@gmail.com>
To: linux-kernel@vger.kernel.org,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	rtc-linux@googlegroups.com
Subject: 500 ms delay in time saved into RTC
Date: Mon, 19 Feb 2018 09:40:59 +0300	[thread overview]
Message-ID: <30ae185f-28c9-54f1-2884-4ee7801b130e@gmail.com> (raw)

Hi!

I have board based on AT91SAM9G20 (ARM926EJ-S CPU), Linux-4.9.36 kernel 
and RTC chip DS1340 (rtc-ds1307.c driver).

RTC chip connected by means of I2C-bus, without HW IRQ line connected.

Kernel configured to not use embedded functions for time getting at 
startup and saving at shutdown:
CONFIG_RTC_CLASS=y
# CONFIG_RTC_HCTOSYS is not set
# CONFIG_RTC_SYSTOHC is not set
CONFIG_RTC_INTF_DEV_UIE_EMUL=y
CONFIG_RTC_DRV_DS1307=y
CONFIG_RTC_DRV_DS1307_CENTURY=y

The hwclock utility is from util-linux-2.29.1.

The OS does not have external time synchronization sources like NTP, PTP 
or else.

Generally I need to achieve error within +-20 ms when RTC's time copied 
into OS or back from OS into RTC.

I have made measurements during startup and shutdown of OS and have 
found 500 ms delay introduced into RTC's time, when "hwclock --utc 
--systohc" executed.

Logical analyzer show to me I2C-bus transactions and PPS signal 
generated by Linux. And I see 500 ms delay is between of rising edge of 
PPS signal (start of OS second) and moment when time saved into RTC.

Please explain, why this happens? Is this due to absence of IRQ line for 
RTC or due to a bug in the hwclock, or kernel bug or I have missed 
something else?

Best wishes.
--
Igor Plyatov

             reply	other threads:[~2018-02-19  6:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19  6:40 Igor Plyatov [this message]
2018-02-19  7:11 ` Rasmus Villemoes
2018-02-19  9:16   ` Igor Plyatov
2018-02-19 10:07     ` Alexandre Belloni
2018-02-19 10:37       ` Rasmus Villemoes
2018-02-19 11:03   ` Karel Zak
2018-02-19 11:31     ` Igor Plyatov
2018-02-25  0:34     ` Alexandre Belloni

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=30ae185f-28c9-54f1-2884-4ee7801b130e@gmail.com \
    --to=plyatov@gmail.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.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®