
Sascha,
-----Original Message----- From: Sascha Hauer [mailto:s.hauer@pengutronix.de] Sent: Tuesday, June 03, 2008 10:14 AM To: Menon, Nishanth Cc: u-boot-users@lists.sourceforge.net; Laurent Desnogues; dirk.behme@googlemail.com; philip.balister@gmail.com; Gopinath, Thara; Kamat, Nishant; Syed Mohammed, Khasim Subject: Re: [Patch 02/17] U-Boot-V2:Common:Clock Handle caseofclockrollover for get_time_ns
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.
Here is a revisit of this patch. The change will ensure cycle_now and last will be masked.
Signed-off-by: Nishanth Menonx0nishan@ti.com
--- common/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Index: u-boot.v2/common/clock.c =================================================================== --- u-boot.v2.orig/common/clock.c 2007-10-10 21:50:14.000000000 -0500 +++ u-boot.v2/common/clock.c 2008-06-03 11:16:05.000000000 -0500 @@ -41,7 +41,7 @@ uint64_t ns_offset;
/* read clocksource: */ - cycle_now = cs->read(); + cycle_now = cs->read() & cs->mask;
/* calculate the delta since the last call: */ cycle_delta = (cycle_now - cs->cycle_last) & cs->mask;