From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nishanth Menon Date: Tue, 26 Oct 2010 10:22:34 -0500 Subject: [U-Boot] Timer implementations In-Reply-To: <20101026151748.619481365DB@gemini.denx.de> References: <1288054924-24989-1-git-send-email-nm@ti.com> <4CC62B6C.30601@emk-elektronik.de> <20101026052856.3D467152451@gemini.denx.de> <4CC66A67.4000608@emk-elektronik.de> <20101026054812.60816135DE3@gemini.denx.de> <4CC66ECA.9000106@emk-elektronik.de> <4CC67CA1.9090302@emk-elektronik.de> <20101026074132.8013C152451@gemini.denx.de> <4CC68A07.6050109@emk-elektronik.de> <4CC6EFB1.9000701@ti.com> <20101026151748.619481365DB@gemini.denx.de> Message-ID: <4CC6F23A.2040608@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang Denk had written, on 10/26/2010 10:17 AM, the following: > Dear Nishanth Menon, > > In message <4CC6EFB1.9000701@ti.com> you wrote: >> uint64_t etime; /* actually this could be u32 */ >> >> etime = get_ticks() + usec2ticks(MAX_RETRY_US); >> while (!(readl(&mmc_base->stat) & CC_MASK)) { >> if (get_ticks() <= etime) { >> printf("%s: timedout waiting for cc2!\n", __func__); >> return; >> } >> } >> >> sounds right? > > No. This code is always wrong. Please fix it as described. Apologies on being a dudhead, I suppose you mean the following: ulong start; start = get_timer(0); while (!(readl(&mmc_base->stat) & CC_MASK)) { if (get_timer(start) > usec2ticks(MAX_RETRY_US)) { printf("%s: timedout waiting for cc2!\n", __func__); return; } } would this be better? -- Regards, Nishanth Menon