[U-Boot] [PATCH v3] arm926ejs: timer: Replace bss variable by gdr

Reinhard Meyer u-boot at emk-elektronik.de
Sat Jan 22 09:14:06 CET 2011


Dear Albert ARIBAUD,
> However a general rework of ARM timer code is in order so that all SoCs
> and CPUs share the same set of gd variables with the same names and the
> same logic; and when we get that, this code shall move along.
>
> About this rework, as the saying goes... "Patches Welcome ©". :)

There were several suggestions about that in the past (including from me)
that involve rework everywhere HZ related timeouts are used. I still
prefer a method as follows (because it does not need repeated mul/div calculations
nor necessarily 64 bit arithmetic):

u32 timeout = timeout_init(100); /* 100ms timeout */

do {...} while (!timed_out(timeout));

Internally it would be like:

timeout_init(x):
  return fast_tick + (x * fast_tick_rate) / CONFIG_SYS_HZ;
  /* this might need 64 bit precision in some implementations */

time_out(x):
  return ((i32)(x - fast_tick)) < 0;

If the tick were really high speed (and then 64 bits),
fast_tick could be derived by shifting the tick some bits to the right.

But, as long as we cannot agree on something, there will be no time spent
to make patches...

Best Regards,
Reinhard


More information about the U-Boot mailing list