cpus {
#address-cells = <1>;
#size-cells = <0>;
- frequency = <500000000>;
cpu@0 {
compatible = "mips,mips4KEc";
reg = <0>;
+ clocks = <&cpu_clk>;
+ clock-names = "cpu";
};
};
bootargs = "console=ttyS0,115200";
};
+ cpu_clk: cpu_clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <500000000>;
+ };
+
lx_clk: lx_clk {
compatible = "fixed-clock";
#clock-cells = <0>;
cpus {
#address-cells = <1>;
#size-cells = <0>;
- frequency = <800000000>;
cpu@0 {
compatible = "mips,mips34Kc";
reg = <0>;
+ clocks = <&cpu_clk>;
+ clock-names = "cpu";
};
};
interrupt-controller;
};
+ cpu_clk: cpu_clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <800000000>;
+ };
+
lx_clk: lx_clk {
compatible = "fixed-clock";
#clock-cells = <0>;
#include <linux/console.h>
#include <linux/init.h>
-#include <linux/clkdev.h>
-#include <linux/clk-provider.h>
+#include <linux/clk.h>
#include <linux/delay.h>
+#include <linux/of_clk.h>
#include <linux/of_fdt.h>
#include <linux/irqchip.h>
void __init plat_time_init(void)
{
struct device_node *np;
- u32 freq = 500000000;
+ struct clk *clk;
of_clk_init(NULL);
- timer_probe();
- np = of_find_node_by_name(NULL, "cpus");
+ np = of_get_cpu_node(0, NULL);
if (!np) {
- pr_err("Missing 'cpus' DT node, using default frequency.");
- } else {
- if (of_property_read_u32(np, "frequency", &freq) < 0)
- pr_err("No 'frequency' property in DT, using default.");
- else
- pr_info("CPU frequency from device tree: %dMHz", freq / 1000000);
- of_node_put(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 = freq / 2;
+ mips_hpt_frequency = clk_get_rate(clk);
+ clk_put(clk);
+
+ /* The counter runs at half the CPU clock rate */
+ mips_hpt_frequency /= 2;
+
+ timer_probe();
}
void __init arch_init_irq(void)