]> git.kernelconcepts.de Git - karo-tx-uboot.git/commit
- Implement missing get_ticks(), get_timer() and get_tbclk() functions
authorLothar Waßmann <LW@KARO-electronics.de>
Fri, 9 Mar 2012 08:23:32 +0000 (09:23 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 9 Mar 2012 08:23:32 +0000 (09:23 +0100)
commit8e0c912301053ea4255a4bb93657711e862d429a
treee1dd26e823a60c40faffb38ceccda1e9719944c0
parentbcae62734ffbdb94d6d8e61eaba2fe87d9a99ff6
- Implement missing get_ticks(), get_timer() and get_tbclk() functions
  to fix build error
- Simplify the implementation of __udelay() and fix an OBIWAN error in
  the bogus rollover handling
  The period of the MX28_HW_DIGCTL_MICROSECONDS counter is 2^32, thus
  in the rollover case the correct calculation would be:
incr = 0x100000000 - old;
incr += new;
  instead of:
incr = 0xffffffff - old;
incr += new;
  But in 32bit arithmetic that is the same as:
incr = 0 - old;
incr += new;
  which is in no way different from the else path:
incr += new - old;
  Thus the 'if' clause is absolutely useless!
  Whoever invented this routine should read up on two's complement
  arithmetic!
  Subtracting two unsigned integers with a finite number of bits in
  two's complement arithmetic will _ALWAYS_ yield the difference
  between the two numbers (thus the number of ticks between two timer
  reads). There is NO NEED for any fancy rollover checks if one only
  deals with differences between timer ticks rather than absolute
  tick values!
- Add some debug code to verify the rollover handling
- Remove unused us_to_tick()
arch/arm/cpu/arm926ejs/mx28/timer.c