2015-10-26 18:30:56 +07:00
|
|
|
/*
|
|
|
|
* Xilfpga clocksource/timer setup
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Imagination Technologies
|
|
|
|
* Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/clk.h>
|
|
|
|
#include <linux/clk-provider.h>
|
|
|
|
#include <linux/clocksource.h>
|
|
|
|
#include <linux/of.h>
|
|
|
|
|
|
|
|
#include <asm/time.h>
|
|
|
|
|
|
|
|
void __init plat_time_init(void)
|
|
|
|
{
|
|
|
|
struct device_node *np;
|
|
|
|
struct clk *clk;
|
|
|
|
|
|
|
|
of_clk_init(NULL);
|
2017-05-26 22:40:46 +07:00
|
|
|
timer_probe();
|
2015-10-26 18:30:56 +07:00
|
|
|
|
|
|
|
np = of_get_cpu_node(0, NULL);
|
|
|
|
if (!np) {
|
|
|
|
pr_err("Failed to get CPU node\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
clk = of_clk_get(np, 0);
|
|
|
|
if (IS_ERR(clk)) {
|
|
|
|
pr_err("Failed to get CPU clock: %ld\n", PTR_ERR(clk));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mips_hpt_frequency = clk_get_rate(clk) / 2;
|
|
|
|
clk_put(clk);
|
|
|
|
}
|