Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-26 Thread J. William Campbell
On 10/25/2010 11:01 PM, Reinhard Meyer wrote: Dear Wolfgang Denk, Dear Reinhard Meyer, In message4cc66a67.4000...@emk-elektronik.de you wrote: It fails in case the timer wraps around. Assume 32 bit counters, start time = 0xFFF0, delay = 0x20. It will compute end = 0x10, the while

Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-26 Thread Wolfgang Denk
Dear Reinhard Meyer, In message 4cc66eca.9000...@emk-elektronik.de you wrote: Agreed here. People are invited to dig through u-boot and find all those places. You know the ones you added best :-) int main(void) { unsigned int time = 0xFFF0; unsigned int delay = 0x20;

Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-26 Thread Reinhard Meyer
Dear Wolfgang Denk, Dear Reinhard Meyer, In message 4cc66eca.9000...@emk-elektronik.de you wrote: Agreed here. People are invited to dig through u-boot and find all those places. You know the ones you added best :-) int main(void) { unsigned int time = 0xFFF0;

Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-26 Thread Nishanth Menon
Ghorai, Sukumar had written, on 10/26/2010 12:34 AM, the following: [...] [Ghorai] Thanks.. This is the best approach. Otherwise udelay() will increase the boot time. Please define increase the boot time with the context to the patch where you think the increase of boot time will be? In my

Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-25 Thread Reinhard Meyer
Dear Nishanth Menon, Having a loop with a counter is no timing guarentee for timing accuracy or compiler optimizations. For e.g. the same loop counter which runs when the MPU is running at 600MHz will timeout in around half the time when running at 1GHz. or the example where GCC 4.5 compiles

Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-25 Thread Nishanth Menon
Reinhard Meyer had written, on 10/25/2010 08:14 PM, the following: Dear Nishanth Menon, Having a loop with a counter is no timing guarentee for timing accuracy or compiler optimizations. For e.g. the same loop counter which runs when the MPU is running at 600MHz will timeout in around half

Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-25 Thread Ghorai, Sukumar
-Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Wolfgang Denk Sent: Tuesday, October 26, 2010 10:06 AM To: Menon, Nishanth Cc: u-boot Subject: Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix Dear Nishanth Menon

Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-25 Thread Wolfgang Denk
Dear Reinhard Meyer, In message 4cc62b6c.30...@emk-elektronik.de you wrote: In such cases I prefer to use: uint64_t etime; ... etime = get_ticks() + get_tbclk(); /* 1 second */ do { whatever; udelay (xx); } while (condition

Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-25 Thread Wolfgang Denk
Dear Nishanth Menon, In message 4cc62c81.8000...@ti.com you wrote: You can still call udelay inside the loop if you don't want to poll the condition too tightly... hmmm.. almost like the jiffies in kernel ;).. timing wise, I see that Yes, except for the bugs... ;-) Best regards,

Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-25 Thread Ghorai, Sukumar
-Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Wolfgang Denk Sent: Tuesday, October 26, 2010 10:59 AM To: Reinhard Meyer Cc: Menon, Nishanth; u-boot Subject: Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix Dear

Re: [U-Boot] [PATCH v2] mmc: omap: timeout counter fix

2010-10-25 Thread Reinhard Meyer
Dear Wolfgang Denk, In message4cc62b6c.30...@emk-elektronik.de you wrote: In such cases I prefer to use: uint64_t etime; ... etime = get_ticks() + get_tbclk(); /* 1 second */ do { whatever; udelay (xx); } while (condition get_ticks()=