Files
u-boot-tk1-som/include
Shinya Kuribayashi a55d48174c [MIPS] lib_mips/time.c: Fix CP0 count register usage and timer routines
MIPS port has two problems in timer routines. One is now we assume CFG_HZ
equals to CP0 counter frequency, but this is wrong. CFG_HZ has to be 1000
in the U-Boot system.

The other is we don't have a proper time management counter like timestamp
other ARCHs have. We need the 32-bit millisecond clock counter.

This patch introduces timestamp and CYCLES_PER_JIFFY. timestamp is a
32-bit non-overflowing CFG_HZ counter, and CYCLES_PER_JIFFY is the number
of calculated CP0 counter cycles in a CFG_HZ.

STRATEGY:

* Fix improper CFG_HZ value to have 1000

* Use CFG_MIPS_TIMER_FREQ for timer counter frequency, instead.

* timer_init: initialize timestamp and set up the first timer expiration.
  Note that we don't need to initialize CP0 count/compare registers here
  as they have been already zeroed out on the system reset. Leave them as
  they are.

* get_timer: calculate how many timestamps have been passed, then return
  base-relative timestamp. Make sure we can easily count missed timestamps
  regardless of CP0 count/compare value.

* get_ticks: return the current timestamp, that is get_timer(0).

Most parts are from good old Linux v2.6.16 kernel.

v2:
- Remove FIXME comments as they turned out to be trivial.
- Use CP0 compare register as a global variable for expirelo.
- Kill a global variable 'cycles_per_jiffy'. Use #define CYCLES_PER_JIFFY
  instead.

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
2008-06-05 22:29:00 +09:00
..
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2003-06-27 21:31:46 +00:00
2008-05-21 00:14:08 +02:00
2008-04-13 14:52:48 -07:00
2003-06-27 21:31:46 +00:00
2008-05-21 00:14:08 +02:00
2007-08-14 18:42:36 +02:00
2004-10-10 18:03:33 +00:00
2007-05-15 23:38:05 +02:00
2008-05-10 11:44:55 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2000-11-12 23:38:42 +00:00
2006-04-16 10:51:58 +02:00
2008-04-18 00:24:05 -07:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2004-12-16 17:33:10 +00:00
2008-05-21 00:14:08 +02:00
2003-06-27 21:31:46 +00:00
2008-03-27 23:49:12 +01:00
2008-03-26 23:38:54 +01:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2002-11-03 00:07:02 +00:00
2008-05-21 00:14:08 +02:00
2003-05-31 18:35:21 +00:00
2002-08-27 10:38:37 +00:00
2008-05-10 11:44:55 +02:00
2001-11-03 22:15:16 +00:00
2008-05-21 00:14:08 +02:00
2002-09-17 21:37:55 +00:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2003-06-27 21:31:46 +00:00
2008-01-11 16:05:36 +01:00
2003-06-27 21:31:46 +00:00
2001-04-28 17:59:11 +00:00
2008-05-21 00:14:08 +02:00
2008-03-02 21:44:59 +01:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2004-10-10 21:27:30 +00:00
2004-05-19 21:33:14 +00:00
2003-10-08 23:26:14 +00:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2006-07-19 13:50:38 +02:00
2002-04-01 14:29:03 +00:00
2008-03-27 00:03:57 +01:00
2008-05-21 00:14:08 +02:00
2008-05-10 00:59:57 +02:00
2008-05-20 23:24:37 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2000-07-19 14:09:16 +00:00
2004-03-25 15:14:43 +00:00
2008-05-21 00:14:08 +02:00
2003-06-27 21:31:46 +00:00
2006-06-26 10:54:52 +02:00
2008-05-21 00:14:08 +02:00
2002-03-27 13:48:44 +00:00
2008-05-21 00:14:08 +02:00
2008-04-13 14:57:46 -07:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2005-09-22 09:04:17 +02:00
2003-06-27 21:31:46 +00:00
2008-05-21 00:14:08 +02:00
2008-05-21 00:14:08 +02:00
2008-06-03 20:31:34 +02:00
2008-06-03 20:28:50 +02:00
2007-10-13 21:15:39 +02:00
2008-04-13 14:52:48 -07:00
2008-05-21 00:14:08 +02:00
2004-02-23 16:11:30 +00:00
2004-12-16 21:44:03 +00:00
2006-06-14 18:14:56 +02:00
2008-03-27 00:12:56 +01:00
2008-05-21 00:14:08 +02:00
2006-06-14 17:45:53 +02:00
2006-06-14 18:14:56 +02:00
2008-05-21 00:14:08 +02:00
2003-06-27 21:31:46 +00:00
2000-10-25 11:24:22 +00:00
2008-05-21 00:14:08 +02:00
2001-11-03 22:21:15 +00:00
2008-05-21 00:14:08 +02:00
2002-03-08 21:31:05 +00:00
2005-09-23 11:05:55 +02:00
2008-05-21 00:14:08 +02:00
2006-07-21 15:24:56 +02:00
2003-06-27 21:31:46 +00:00