mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Gortmaker <p_gortmaker@yahoo.com>
To: linux-kernel@vger.kernel.org
Subject: Re: 146818 RTC set-time curious...
Date: Tue, 25 Feb 2003 18:41:47 -0500	[thread overview]
Message-ID: <3E5BFF3B.3A84B78A@yahoo.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0302222311560.7720-100000@poirot.grange>

Guennadi Liakhovetski wrote:
> 
> Not a bug report, nothing critical (hopefully), just a question - in rtc.c
> driver on time-set ioctl() the following is done:
>         save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
>         CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
> which writes 0x7X to rtc regs=ister 0xA... Why? I read a few documents and
> all agree on, what's expressed in one of them as "bits 4-6 should be 0x2,
> other values don't do anything useful on PCs, really..." VERY curious...

This code predates the rtc driver (and linux-1.0 in general) since it first
appeared in kernel/time.c: set_rtc_mmss().  [now arch/*/kernel/time.c]

I've seen that "..don't do anything useful..." before and it is incorrect.
The RESET and RESET2 values (functionally equivalent, IIRC) stop the
internal xtal input divider and once cleared back to normal operating state 
(6-4 are 010) the next rtc update will take place precisely 0.5 seconds later.

This is a documented feature of the original mc146818 to allow for precise 
setting of the clock, but I wouldn't be surprised if some el-cheapo chipset 
implementations don't honour it.  Might be amusing to write a little test 
program and run it on a few different machines to see what happens...  

Paul.



      reply	other threads:[~2003-02-26  7:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-22 22:17 Guennadi Liakhovetski
2003-02-25 23:41 ` Paul Gortmaker [this message]

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=3E5BFF3B.3A84B78A@yahoo.com \
    --to=p_gortmaker@yahoo.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®