time.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * time.c: MIPS CPU Count/Compare timer hookup
  3. *
  4. * Author: Mark.Zhan, <rongkai.zhan@windriver.com>
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. *
  10. * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org)
  11. * Copyright (C) 2006, Wind River System Inc.
  12. */
  13. #include <linux/init.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/irq.h>
  16. #include <asm/gt64120.h>
  17. #include <asm/time.h>
  18. #define WRPPMC_CPU_CLK_FREQ 40000000 /* 40MHZ */
  19. /*
  20. * Estimate CPU frequency. Sets mips_hpt_frequency as a side-effect
  21. *
  22. * NOTE: We disable all GT64120 timers, and use MIPS processor internal
  23. * timer as the source of kernel clock tick.
  24. */
  25. void __init plat_time_init(void)
  26. {
  27. /* Disable GT64120 timers */
  28. GT_WRITE(GT_TC_CONTROL_OFS, 0x00);
  29. GT_WRITE(GT_TC0_OFS, 0x00);
  30. GT_WRITE(GT_TC1_OFS, 0x00);
  31. GT_WRITE(GT_TC2_OFS, 0x00);
  32. GT_WRITE(GT_TC3_OFS, 0x00);
  33. /* Use MIPS compare/count internal timer */
  34. mips_hpt_frequency = WRPPMC_CPU_CLK_FREQ;
  35. }