mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [RFC 0/5] add rtc support
Date: Fri, 11 Jul 2014 10:32:57 +0400	[thread overview]
Message-ID: <20140711103257.b2d7c1267d42b9923da03453@gmail.com> (raw)
In-Reply-To: <20140711061026.GM23235@pengutronix.de>

On Fri, 11 Jul 2014 08:10:26 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Fri, Jul 11, 2014 at 10:12:36AM +0400, Antony Pavlov wrote:
> > On Fri, 11 Jul 2014 07:37:38 +0200
> > Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > 
> > > On Thu, Jul 10, 2014 at 12:33:14PM +0400, Antony Pavlov wrote:
> > > > This patchseries imports RTC support from linux-3.15.
> > > > 
> > > > User can use 'hwclock' command to see realtime clock readout.
> > > > 
> > > > Tested with DS1307.
> > > > 
> > > > TODOs:
> > > > 
> > > >  * rtc_set_time() is not realized;
> > > >  * ds1307_set_time() is not tested;
> > > >  * bcd lib is compiled in even if rtc support is disabled (as linux does);
> > > >    we can make it optional;
> > > 
> > > It's probably not worth it. The linker will throw it away anyway if
> > > unused.
> > 
> > Hmm, I have missed this.
> > 
> > In this case can we drop I2C_SMBUS Kconfig stuff
> > 
> > +config I2C_SMBUS
> > +	bool
> > +
> > 
> > +obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o
> > 
> > from 'add driver for PCA95[357]x, ...' series?
> > 
> > Anyway CONFIG_I2C_SMBUS has another meaning in linux.
> > 
> > > 
> > > >  * adjust include/linux/rtc.h and include/rtc.h;
> > > >  * rtc_unregister() is not realized.
> > > 
> > > Maybe an environment variable which holds the seconds since epoch would
> > > be useful. This way scripts could make use of the current RTC time.
> > 
> > So you propose to add an option to hwclock command to store RTC readout into variable,
> > isn't it?
> 
> Yes. This would allow scripts to compare times or to store the current
> time in some boot log.
> 
> > 
> > I have an idea to put epoch offset (number of years into AD to which a zero year value
> > in the Hardware Clock refers) into "global.epoch" variable and add corresponding
> > Kconfig option for default epoch value.
> 
> Does Linux support such a mechanism aswell? How can we make sure Linux
> uses the same epoch offset?

Here is a quote from my hwclock(8) manpage:

       --getepoch
              Print  the  kernel's Hardware Clock epoch value to standard output.  This is the
              number of years into AD to which a zero year value in the Hardware Clock refers.
              For example, if you are using the convention that the year counter in your Hard‐
              ware Clock contains the number of full years since 1952, then the kernel's Hard‐
              ware Clock epoch value must be 1952.

              This epoch value is used whenever hwclock reads or sets the Hardware Clock.

       --setepoch
              Set  the  kernel's  Hardware  Clock  epoch  value  to the value specified by the
              --epoch option.  See the --getepoch option for details.

I suppose that Hardware Clock epoch depends on RTC-chip. I see no automatic machanism to guarantee the same epoch
for linux and barebox.


-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-07-11  6:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10  8:33 Antony Pavlov
2014-07-10  8:33 ` [RFC 1/5] lib: import 'bcd' from linux-3.15 Antony Pavlov
2014-07-10  8:33 ` [RFC 2/5] add rtc support Antony Pavlov
2014-07-10 21:40   ` Sascha Hauer
2014-07-11  5:31     ` Antony Pavlov
2014-07-10  8:33 ` [RFC 3/5] i2c: import SMBus stuff from linux Antony Pavlov
2014-07-10  8:33 ` [RFC 4/5] rtc: add ds1307 support Antony Pavlov
2014-07-10  8:33 ` [RFC 5/5] commands: add hwclock Antony Pavlov
2014-07-10 21:45   ` Sascha Hauer
2014-07-11  5:59     ` Antony Pavlov
2014-07-11  6:07       ` Sascha Hauer
2014-07-11  5:37 ` [RFC 0/5] add rtc support Sascha Hauer
2014-07-11  6:12   ` Antony Pavlov
2014-07-11  6:10     ` Sascha Hauer
2014-07-11  6:32       ` Antony Pavlov [this message]
2014-07-11  6:37         ` Sascha Hauer
2014-07-11 11:27     ` Antony Pavlov

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=20140711103257.b2d7c1267d42b9923da03453@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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