File: time.c

package info (click to toggle)
linux 3.2.78-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 693,024 kB
  • sloc: ansic: 9,721,346; asm: 244,047; xml: 40,377; makefile: 23,845; perl: 16,079; python: 4,929; sh: 4,425; cpp: 3,598; yacc: 2,979; lex: 1,726; awk: 708; pascal: 231; lisp: 218; sed: 30
file content (39 lines) | stat: -rw-r--r-- 1,084 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * time.c: MIPS CPU Count/Compare timer hookup
 *
 * Author: Mark.Zhan, <rongkai.zhan@windriver.com>
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org)
 * Copyright (C) 2006, Wind River System Inc.
 */
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>

#include <asm/gt64120.h>
#include <asm/time.h>

#define WRPPMC_CPU_CLK_FREQ 40000000 /* 40MHZ */

/*
 * Estimate CPU frequency.  Sets mips_hpt_frequency as a side-effect
 *
 * NOTE: We disable all GT64120 timers, and use MIPS processor internal
 * timer as the source of kernel clock tick.
 */
void __init plat_time_init(void)
{
	/* Disable GT64120 timers */
	GT_WRITE(GT_TC_CONTROL_OFS, 0x00);
	GT_WRITE(GT_TC0_OFS, 0x00);
	GT_WRITE(GT_TC1_OFS, 0x00);
	GT_WRITE(GT_TC2_OFS, 0x00);
	GT_WRITE(GT_TC3_OFS, 0x00);

	/* Use MIPS compare/count internal timer */
	mips_hpt_frequency = WRPPMC_CPU_CLK_FREQ;
}