uboot/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
..
asm-arm Move definition of container_of() to common.h 2008-06-03 20:27:23 +02:00
asm-avr32 atmel_spi: Driver for the Atmel SPI controller 2008-06-03 20:30:05 +02:00
asm-blackfin Merge branch 'lwmon5' of /home/wd/git/u-boot/projects 2008-05-21 01:13:39 +02:00
asm-i386 Merge branch 'lwmon5' of /home/wd/git/u-boot/projects 2008-05-21 01:13:39 +02:00
asm-m68k Merge branch 'lwmon5' of /home/wd/git/u-boot/projects 2008-05-21 01:13:39 +02:00
asm-microblaze Merge branch 'lwmon5' of /home/wd/git/u-boot/projects 2008-05-21 01:13:39 +02:00
asm-mips mips: Add an 'include/asm/errno.h', like all other architectures 2008-05-30 00:53:38 +09:00
asm-nios Merge branch 'lwmon5' of /home/wd/git/u-boot/projects 2008-05-21 01:13:39 +02:00
asm-nios2 POST: replace the LOGBUFF_INITIALIZED flag in gd->post_log_word (1 << 31) with the GD_FLG_LOGINIT flag in gd->flags. 2008-05-20 23:24:38 +02:00
asm-ppc Fix warnings from gcc-4.3.0 build on a ppc host 2008-06-03 19:52:52 +02:00
asm-sh Merge branch 'lwmon5' of /home/wd/git/u-boot/projects 2008-05-21 01:13:39 +02:00
asm-sparc POST: replace the LOGBUFF_INITIALIZED flag in gd->post_log_word (1 << 31) with the GD_FLG_LOGINIT flag in gd->flags. 2008-05-20 23:24:38 +02:00
bedbug Big white-space cleanup. 2008-05-21 00:14:08 +02:00
configs [MIPS] lib_mips/time.c: Fix CP0 count register usage and timer routines 2008-06-05 22:29:00 +09:00
cramfs
galileo Big white-space cleanup. 2008-05-21 00:14:08 +02:00
jffs2
linux NAND: Provide a sane default for NAND_MAX_CHIPS. 2008-05-28 11:06:24 -05:00
pcmcia
u-boot Add support for calculating hashes with watchdog triggering 2008-04-25 00:01:06 +02:00
.gitignore include/gitignore: update to all architectures 2008-05-09 20:59:21 +02:00
4xx_i2c.h
74xx_7xx.h
405_dimm.h
405_mal.h
ACEX1K.h Add size #defines for Altera Cyclone-II EP2C8 and EP2C20. 2008-06-03 21:40:09 +02:00
MCD_dma.h
MCD_progCheck.h
MCD_tasksInit.h
SA-1100.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
_exports.h
ahci.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
altera.h Altera Stratix II support 2008-04-13 14:52:48 -07:00
ambapp.h Coding Style cleanup; update CHANGELOG 2008-04-13 09:59:26 -07:00
api_public.h
arm920t.h
arm925t.h
arm926ejs.h
arm946es.h
armcoremodule.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
at45.h
at91rm9200_i2c.h
at91rm9200_net.h
ata.h
atmel_lcdc.h Add ATMEL LCD driver 2008-05-10 11:44:55 +02:00
bcd.h
bcm5221.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
bmp_layout.h
bzlib.h
circbuf.h
clps7111.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
command.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
common.h Move definition of container_of() to common.h 2008-06-03 20:27:23 +02:00
commproc.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
config_cmd_all.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
config_cmd_default.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
console.h
crc.h
da9030.h
dataflash.h Clean up dataflash partitioning 2008-04-18 00:24:05 -07:00
devices.h
div64.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
dm9161.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
dp83848.h
dtt.h
e500.h
elf.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
environment.h environment: fix bug introduced by commit a8409f4f1a 2008-05-14 23:36:10 +02:00
exports.h
ext2fs.h
fat.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
fdc.h
fdt.h
fdt_support.h
fis.h
flash.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
fpga.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
ft_build.h
hush.h
i2c.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
i8042.h
ide.h
image.h Use watchdog-aware functions when calculating hashes of images - take two 2008-04-25 14:05:21 +02:00
ioports.h
keyboard.h
kgdb.h
lcd.h Add ATMEL LCD driver 2008-05-10 11:44:55 +02:00
lcdvideo.h
lh7a40x.h
lh7a400.h
lh7a404.h
libata.h ata: update the libata.h from ata.h of linux kernel 2008-04-13 23:20:16 -07:00
libfdt.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
libfdt_env.h
linux_logo.h
lists.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
lmb.h
logbuff.h Avoid initrd and logbuffer area overlaps 2008-06-03 19:34:19 +02:00
lpd7a400_cpld.h
lxt971a.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
lynxkdi.h
malloc.h
mb862xx.h
mii_phy.h
miiphy.h
mk48t59.h
mmc.h
mpc5xx.h
mpc5xxx.h
mpc8xx.h
mpc8xx_irq.h
mpc83xx.h mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code 2008-03-28 16:01:06 -05:00
mpc85xx.h
mpc86xx.h
mpc106.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
mpc512x.h
mpc824x.h
mpc8220.h
mpc8260.h
mpc8260_irq.h
nand.h NAND: fix some strict-aliasing compiler warnings 2008-04-28 12:08:18 +02:00
net.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
nios-io.h
nios.h
nios2-epcs.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
nios2-io.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
nios2.h
ns7520_eth.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
ns9750_bbus.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
ns9750_eth.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
ns9750_mem.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
ns9750_ser.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
ns9750_sys.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
ns16550.h
ns87308.h
onenand_uboot.h Make onenand_uboot.h self-sufficient. 2008-05-28 11:06:28 -05:00
part.h
pc_keyb.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
pci.h Update pci code to use phys_addr_t 2008-05-10 00:59:57 +02:00
pci_ids.h Additional PCI IDs for IDE and network controllers 2008-04-17 13:37:57 -07:00
pcmcia.h
post.h POST: add POST_STOP flag 2008-05-20 23:24:37 +02:00
ppc4xx.h
ppc4xx_enet.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
ppc405.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
ppc440.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
ppc_asm.tmpl
ppc_defs.h
ps2mult.h
radeon.h
reiserfs.h
rtc.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
s3c24x0.h
s3c2400.h
s3c2410.h
s_record.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
sa1100.h
sata.h drivers: code clean up 2008-04-13 14:57:46 -07:00
scsi.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
sed156x.h
sed13806.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
serial.h
sha1.h Add support for calculating hashes with watchdog triggering 2008-04-25 00:01:06 +02:00
sm501.h
smiLynxEM.h
spartan2.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
spartan3.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
spd.h
spd_sdram.h
spi.h SPI API improvements 2008-06-03 20:28:50 +02:00
spi_flash.h SPI Flash subsystem 2008-06-03 20:31:34 +02:00
status_led.h
stratixII.h Altera Stratix II support 2008-04-13 14:52:48 -07:00
sym53c8xx.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
systemace.h
tsi108.h
universe.h
usb.h
usb_cdc_acm.h
usb_defs.h
usbdcore.h
usbdcore_ep0.h
usbdcore_mpc8xx.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
usbdcore_omap1510.h
usbdescriptors.h
version.h Makefile: fix "error: version_autogenerated.h: No such file or directory" 2008-05-13 23:15:52 +02:00
vfd_logo.h
video.h
video_ad7176.h
video_ad7177.h
video_ad7179.h
video_easylogo.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
video_fb.h
video_font.h
video_logo.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
virtex2.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
vsc7385.h
w83c553f.h
watchdog.h
xilinx.h Big white-space cleanup. 2008-05-21 00:14:08 +02:00
xyzModem.h
zlib.h