From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dirk Behme Date: Mon, 4 Mar 2013 15:20:39 +0100 Subject: [U-Boot] [PATCH] ARM: global_data: make tbl long long In-Reply-To: <20130304111013.01401200246@gemini.denx.de> References: <1362387637-32334-1-git-send-email-dirk.behme@de.bosch.com> <20130304111013.01401200246@gemini.denx.de> Message-ID: <5134ADB7.2000106@de.bosch.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Wolfgang, On 04.03.2013 12:10, Wolfgang Denk wrote: > Dear Dirk Behme, > > In message <1362387637-32334-1-git-send-email-dirk.behme@de.bosch.com> you wrote: >> From: Dirk Behme >> >> Several ARM timer implementations use gd->arch.tbl to record the >> absolute tick count of 32-bit counters, including timer overflows. >> For example arch/arm/imx-common/timer.c does: >> >> ulong lastinc; >> ulong now = counter value; >> if (no overflow) { >> ... >> } else { /* counter overflow */ >> gd->arch.tbl += (0xFFFFFFFF - lastinc) + now; >> } >> lastinc = now; >> >> As we use a 32-bit counter and the two ulong (32-bit) variables 'lastinc' >> and 'now' here, gd->arch.tbl should be long long (64-bit) to not overflow >> at the same time, too. > > I think this is wrong. > > "tbl" means "time base, lower 32 bits" and is complemented by "tbu" > (time base, upper 32 bits) to form a 64 bit time base counter. > > If you need the full 64 bit precision, then please either maintain the > carry manually, or use a proper union or similar. Many thanks for this explanation! This patch is obsolete now, replaced by http://patchwork.ozlabs.org/patch/224740/ Thanks Dirk