18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2009 Lemote Inc.
48c2ecf20Sopenharmony_ci * Author: Wu Zhangjin, wuzhangjin@gmail.com
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <linux/err.h>
88c2ecf20Sopenharmony_ci#include <linux/smp.h>
98c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cistatic struct platform_device loongson2_cpufreq_device = {
128c2ecf20Sopenharmony_ci	.name = "loongson2_cpufreq",
138c2ecf20Sopenharmony_ci	.id = -1,
148c2ecf20Sopenharmony_ci};
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistatic int __init loongson2_cpufreq_init(void)
178c2ecf20Sopenharmony_ci{
188c2ecf20Sopenharmony_ci	struct cpuinfo_mips *c = &current_cpu_data;
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	/* Only 2F revision and it's successors support CPUFreq */
218c2ecf20Sopenharmony_ci	if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON2F)
228c2ecf20Sopenharmony_ci		return platform_device_register(&loongson2_cpufreq_device);
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci	return -ENODEV;
258c2ecf20Sopenharmony_ci}
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciarch_initcall(loongson2_cpufreq_init);
28