1*41173abcSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 27ca5dc14SFlorian Fainelli /* 37ca5dc14SFlorian Fainelli * Carsten Langgaard, carstenl@mips.com 47ca5dc14SFlorian Fainelli * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. 57ca5dc14SFlorian Fainelli * 67ca5dc14SFlorian Fainelli * Setting up the clock on the MIPS boards. 77ca5dc14SFlorian Fainelli */ 87ca5dc14SFlorian Fainelli 9d9c0390aSPaul Gortmaker #include <linux/init.h> 107ca5dc14SFlorian Fainelli #include <linux/time.h> 11780019ddSFlorian Fainelli #include <linux/err.h> 12780019ddSFlorian Fainelli #include <linux/clk.h> 137ca5dc14SFlorian Fainelli 147ca5dc14SFlorian Fainelli #include <asm/time.h> 157ca5dc14SFlorian Fainelli #include <asm/mach-ar7/ar7.h> 167ca5dc14SFlorian Fainelli plat_time_init(void)177ca5dc14SFlorian Fainellivoid __init plat_time_init(void) 187ca5dc14SFlorian Fainelli { 19780019ddSFlorian Fainelli struct clk *cpu_clk; 20780019ddSFlorian Fainelli 210bc67917SFlorian Fainelli /* Initialize ar7 clocks so the CPU clock frequency is correct */ 220bc67917SFlorian Fainelli ar7_init_clocks(); 230bc67917SFlorian Fainelli 24780019ddSFlorian Fainelli cpu_clk = clk_get(NULL, "cpu"); 25780019ddSFlorian Fainelli if (IS_ERR(cpu_clk)) { 26780019ddSFlorian Fainelli printk(KERN_ERR "unable to get cpu clock\n"); 27780019ddSFlorian Fainelli return; 28780019ddSFlorian Fainelli } 29780019ddSFlorian Fainelli 30780019ddSFlorian Fainelli mips_hpt_frequency = clk_get_rate(cpu_clk) / 2; 317ca5dc14SFlorian Fainelli } 32