aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/cpu/cpuinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze/kernel/cpu/cpuinfo.c')
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/arch/microblaze/kernel/cpu/cpuinfo.c b/arch/microblaze/kernel/cpu/cpuinfo.c
index c9203b1007aa..234acad79b9e 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo.c
@@ -8,6 +8,7 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/clk.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <asm/cpuinfo.h> 13#include <asm/cpuinfo.h>
13#include <asm/pvr.h> 14#include <asm/pvr.h>
@@ -39,6 +40,7 @@ const struct cpu_ver_key cpu_ver_lookup[] = {
39 {"8.30.a", 0x17}, 40 {"8.30.a", 0x17},
40 {"8.40.a", 0x18}, 41 {"8.40.a", 0x18},
41 {"8.40.b", 0x19}, 42 {"8.40.b", 0x19},
43 {"8.50.a", 0x1a},
42 {"9.0", 0x1b}, 44 {"9.0", 0x1b},
43 {"9.1", 0x1d}, 45 {"9.1", 0x1d},
44 {NULL, 0}, 46 {NULL, 0},
@@ -68,11 +70,10 @@ const struct family_string_key family_string_lookup[] = {
68}; 70};
69 71
70struct cpuinfo cpuinfo; 72struct cpuinfo cpuinfo;
73static struct device_node *cpu;
71 74
72void __init setup_cpuinfo(void) 75void __init setup_cpuinfo(void)
73{ 76{
74 struct device_node *cpu = NULL;
75
76 cpu = (struct device_node *) of_find_node_by_type(NULL, "cpu"); 77 cpu = (struct device_node *) of_find_node_by_type(NULL, "cpu");
77 if (!cpu) 78 if (!cpu)
78 pr_err("You don't have cpu!!!\n"); 79 pr_err("You don't have cpu!!!\n");
@@ -102,3 +103,22 @@ void __init setup_cpuinfo(void)
102 pr_warn("%s: Stream instructions enabled" 103 pr_warn("%s: Stream instructions enabled"
103 " - USERSPACE CAN LOCK THIS KERNEL!\n", __func__); 104 " - USERSPACE CAN LOCK THIS KERNEL!\n", __func__);
104} 105}
106
107void __init setup_cpuinfo_clk(void)
108{
109 struct clk *clk;
110
111 clk = of_clk_get(cpu, 0);
112 if (IS_ERR(clk)) {
113 pr_err("ERROR: CPU CCF input clock not found\n");
114 /* take timebase-frequency from DTS */
115 cpuinfo.cpu_clock_freq = fcpu(cpu, "timebase-frequency");
116 } else {
117 cpuinfo.cpu_clock_freq = clk_get_rate(clk);
118 }
119
120 if (!cpuinfo.cpu_clock_freq) {
121 pr_err("ERROR: CPU clock frequency not setup\n");
122 BUG();
123 }
124}