public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [Patch 02/17] U-Boot-V2:Common:Clock Handle case	ofclockrollover for get_time_ns
Date: Tue, 3 Jun 2008 17:14:08 +0200	[thread overview]
Message-ID: <20080603151408.GC897@pengutronix.de> (raw)
In-Reply-To: <8E8BB316C604E94AA019A54D0A5A82A201BB52FE@dlee13.ent.ti.com>

On Tue, Jun 03, 2008 at 09:39:51AM -0500, Menon, Nishanth wrote:
> Sascha,
> > -----Original Message-----
> > From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
> > Sent: Tuesday, June 03, 2008 9:15 AM
> > To: Menon, Nishanth
> > Cc: u-boot-users at lists.sourceforge.net; Laurent Desnogues; dirk.behme at googlemail.com;
> > philip.balister at gmail.com; Gopinath, Thara; Kamat, Nishant; Syed Mohammed, Khasim
> > Subject: Re: [Patch 02/17] U-Boot-V2:Common:Clock Handle case ofclockrollover for get_time_ns
> > 
> > > Assumptions made:
> > > A) The bits masked out by cs->mask will remain constant. This may not be true.
> > 
> > Eh? That's why they are masked out.
> For the sake of discussion:
> unsigned int now = 0x120;
> unsigned int last = 0x128;
> unsigned int mask = 0xFFF0;
> unsigned int delta1 = now - last;
> unsigned int delta2 = (now & mask) - (last & mask);
> printf ("delta1=0x%08X maskdelta1=0x%08X delta2=0x%08X\n",delta1, delta1 & mask, delta2);
> 
> Output will be:
> delta1=0xFFFFFFF8 maskdelta1=0x0000FFF0 delta2=0x00000000
> 
> What we will get now is maskdelta1, while delta2 is the right value.

It's not that I thought of the code by myself, I just looked into the
kernel and it's exactly like this in the kernel code. So you either just
found a kernel bug or we both understand something wrong.

> 
> > 
> > > B) Roll over assume the min is 0 and max is cs->mask. This need not be the case.
> > > It would be good to be explicit.
> > 
> > Do you know any counter that does not start counting from zero? If you
> I do not. I am just being a paranoid idiot ;)..
> 
> > have, noone prevents you from substracting the value in your clocksource
> > read function.
> Max however is assumed to be cs->mask then. We could have timers which can be configured for ticking till a configured max. probably my paranoia kicking in again?

If that's the only possibility to program this timer then go out and
kill the chip designer ;)

Sascha


> 
> Regards,
> Nishanth Menon
> 

-- 
Pengutronix e.K. - Linux Solutions for Science and Industry
-----------------------------------------------------------
Kontakt-Informationen finden Sie im Header dieser Mail oder
auf der Webseite -> http://www.pengutronix.de/impressum/ <-

  reply	other threads:[~2008-06-03 15:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-21 16:25 [U-Boot-Users] [Patch 02/17] U-Boot-V2:Common:Clock Handle case of clock rollover for get_time_ns Menon, Nishanth
2008-06-03  8:07 ` Sascha Hauer
2008-06-03 12:47   ` [U-Boot-Users] [Patch 02/17] U-Boot-V2:Common:Clock Handle case of clockrollover " Menon, Nishanth
2008-06-03 14:14     ` Sascha Hauer
2008-06-03 14:39       ` [U-Boot-Users] [Patch 02/17] U-Boot-V2:Common:Clock Handle case ofclockrollover " Menon, Nishanth
2008-06-03 15:14         ` Sascha Hauer [this message]
2008-06-03 16:27           ` [U-Boot-Users] [Patch 02/17 Try 2] U-Boot-V2:Common:Clock Handle caseofclockrollover " Menon, Nishanth

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=20080603151408.GC897@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=u-boot@lists.denx.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