[U-Boot] [PATCH 2/2 rev2] ep93xx: Refactoring of timer code

Alessandro Rubini rubini-list at gnudd.com
Thu Feb 25 20:22:59 CET 2010


> i was/am working on a new version of the patch, taking into account
> your remarks about the unit of TIMER_FREQ and fixing some issues
> discussed with Alessandro Rubini off-list, who worked on a similar
> patch.

Actually, I checked the point we disagreed about, which is the unit of
get_ticks() and get_tbclk().  You currently return hw-ticks in
get_ticks, and CONFIG_SYS_HZ (i.e. 1000) in get_tbclk.  However, these
two functions are expected to be used together, so they must be
consistent in their return value.

It's true that the functions are little used (they are mostly used in
ppc code, within cpu/*/interrupts), and that's why I didn't even
provide them in cpu/arm926ejs/nomadik/timer.c. All few users assume
they are consistent, but there is no documentation:

     tornado% grep -qr get_tbclk README* doc  || echo not found
     not found
     tornado% grep -qr get_ticks README* doc/* || echo not found
     not found

I've made a quick tour of all definitions in cpu/ and here is the result.
As you see, at91 (which you used as reference, I understand) is wrong,
while all the others use either hwticks or SYS_HZ consistently.


  source-file                    get_ticks()          get_tbclk

arm920t/at91/timer.c                 get_timer()      CONFIG_SYS_HZ
arm920t/a320/timer.c                 get_timer()      CONFIG_SYS_HZ
arm920t/s3c24x0/timer.c              hw-ticks         (I didn't understand)
arm920t/imx/timer.c                  get_timer()      CONFIG_SYS_HZ
arm920t/at91rm9200/timer.c           get_timer()      CONFIG_SYS_HZ
pxa/timer.c                          hw-ticks-32bits  TIMER_FREQ_HZ
arm_cortexa8/omap3/timer.c           get_timer()      CONFIG_SYS_HZ
arm_cortexa8/s5pc1xx/timer.c         get_timer()      CONFIG_SYS_HZ
arm925t/timer.c                      get_timer()      CONFIG_SYS_HZ
ppc4xx/cpu.c                         lib_ppc/ticks.S  freqProcessor
blackfin/interrupts.c                get_timer()      CONFIG_SYS_HZ
sa1100/timer.c                       get_timer()      CONFIG_SYS_HZ
mpc824x/cpu.c                        lib_ppc/ticks.S  bus_freq
mpc8xx/cpu.c                         lib_ppc/ticks.S  timebase
mpc512x/cpu.c                        lib_ppc/ticks.S  timebase
mpc5xxx/cpu.c                        lib_ppc/ticks.S  timebase
mpc8220/cpu.c                        lib_ppc/ticks.S  timebase
at32ap/interrupts.c                  hw-ticks         cpu_hz
mpc85xx/cpu.c                        lib_ppc/ticks.S  timebase
74xx_7xx/cpu.c                       lib_ppc/ticks.S  timebase
arm1136/omap24xx/timer.c             get_timer()      CONFIG_SYS_HZ
mpc86xx/cpu.c                        lib_ppc/ticks.S  timebase
mpc8260/cpu.c                        lib_ppc/ticks.S  timebase
arm926ejs/omap/timer.c               get_timer()      CONFIG_SYS_HZ
arm926ejs/davinci/timer.c            get_timer()      CONFIG_SYS_HZ
arm926ejs/versatile/timer.c          get_timer()      CONFIG_SYS_HZ
arm926ejs/at91/timer.c               hwticks          CONFIG_SYS_HZ
arm926ejs/spear/timer.c              hwticks          CONFIG_SYS_HZ
arm1176/s3c64xx/timer.c              hwrticks         (I didn't understand)
lh7a40x/timer.c                      get_timer        (I didn't understand)
mpc5xx/cpu.c                         lib_ppc/ticks.S  timebase

/alessandro


More information about the U-Boot mailing list