Dear Nishanth Menon, In message <4cc6f23a.2040...@ti.com> you wrote: > > > 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?
No, not at all, as get_timer() returns milliseconds, not ticks. You probably want something like: ulong start = get_timer(0); while (!(readl(&mmc_base->stat) & CC_MASK)) { if (get_timer(0) - start >= MAX_RETRY_US/1000) { printf(...); return; } udelay(100); } or such. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de He had quite a powerful intellect, but it was as powerful like a locomotive, and ran on rails and was therefore almost impossible to steer. - Terry Pratchett, _Lords and Ladies_ _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot