[U-Boot] [PATCH 2/9] MX51: Add initial support for the Freescale MX51

Stefano Babic
2010-01-18T07:05:13Z

Wolfgang Denk wrote:
> Dear Stefano Babic,
>

Hi Wolfgang,

> It makes little sense to implement arch specific commands that will
> most probably repeated - I don;t want to see a "mx51clocks" command
> here, and "mx25clocks", "mx27clocks", "mx31clocks", "mx35clocks", ...
> commands on other systems. Just name this "clockinfo" (which is more
> in line with the existing commands as "bdinfo", "reginfo", "flinfo"
> etc.) or, if you insist, "showclocks" or just "clocks".

Understood, you are right, clockinfo is a much more neutral name.

>> +/* delay x useconds AND perserve advance timstamp value */
>> +void __udelay(unsigned long usec)
>> +{
>> + unsigned long now, last = readl(&cur_gpt->counter);
>> + long tmo = usec * (CONFIG_MX51_CLK32 / 1000) / 1000;
>> +
>> + if (!tmo)
>> + tmo = 1;
>> +
>> + while (tmo > 0) {
>> + now = readl(&cur_gpt->counter);
>> + if (last > now)
>> + tmo -= 0xFFFFFFFF - last + now;
>> + else
>> + tmo -= now - last;
>
> Is this correct wrap-around handling?

Well, the code is quite the same as in omap3. It seems that omap suffers
from the same issue. Best thing here should be to read the timer before
the loop to get a timestamp and to check in the loop for the
wrap-around, resetting the counter if needed.

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================