/*1* Cobalt time initialization.2*3* Copyright (C) 2007 Yoichi Yuasa <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/19#include <linux/init.h>2021#include <asm/gt64120.h>22#include <asm/i8253.h>23#include <asm/time.h>2425#define GT641XX_BASE_CLOCK 50000000 /* 50MHz */2627void __init plat_time_init(void)28{29u32 start, end;30int i = HZ / 10;3132setup_pit_timer();3334gt641xx_set_base_clock(GT641XX_BASE_CLOCK);3536/*37* MIPS counter frequency is measured during a 100msec interval38* using GT64111 timer0.39*/40while (!gt641xx_timer0_state())41;4243start = read_c0_count();4445while (i--)46while (!gt641xx_timer0_state())47;4849end = read_c0_count();5051mips_hpt_frequency = (end - start) * 10;52printk(KERN_INFO "MIPS counter frequency %dHz\n", mips_hpt_frequency);53}545556