From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Wozniak Date: Mon, 28 Mar 2005 14:25:38 -0500 Subject: [U-Boot-Users] OCOTEA get_timer() bug Message-ID: <42485A32.6090501@mc.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de I found this bug a while ago and have finally gotten around to looking at it because I needed its service. In previous posts to this email list, Wolfgang had mentioned that the "time unit" returned by get_timer() is 1 msec. Close examination of interrupt_init_cpu() at cpu/ppc4xx/interrupts.c suggests a timer interval setup of 10 msec! A quick experiment via u-boot application, shows this to be true: printf("...tic\n"); tic = get_timer(0); udelay(2000000); /* 2sec delay so that I can "see" it */ toc = get_timer(0); printf("...toc\n %d %d\n", tic, toc); run it: ...tic ...toc 1278 1478 therefore: 200 = delta 2sec/200 = 10msec time unit from get_timer() I've tested the following and propose it as a fix, replace this: val = gd->bd->bi_intfreq/100; /* 10 msec */ with: val = gd->bd->bi_intfreq/1000; /* 1 msec */ I've also tested some of the network related functions to insure that no timeout conditions have appeared. I want to post this patch but would prefer a code review from those that are more familiar with get_timer() use within the OCOTEA codebase. Sorry for the long post, Andrew