1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2009 Lemote Inc.
4  * Author: Wu Zhangjin, wuzhangjin@gmail.com
5  */
6 
7 #include <linux/err.h>
8 #include <linux/smp.h>
9 #include <linux/platform_device.h>
10 
11 static struct platform_device loongson2_cpufreq_device = {
12 	.name = "loongson2_cpufreq",
13 	.id = -1,
14 };
15 
loongson2_cpufreq_init(void)16 static int __init loongson2_cpufreq_init(void)
17 {
18 	struct cpuinfo_mips *c = &current_cpu_data;
19 
20 	/* Only 2F revision and it's successors support CPUFreq */
21 	if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON2F)
22 		return platform_device_register(&loongson2_cpufreq_device);
23 
24 	return -ENODEV;
25 }
26 
27 arch_initcall(loongson2_cpufreq_init);
28