platform.c 872 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (C) 2009 Lemote Inc.
  3. * Author: Wu Zhangjin, wuzhangjin@gmail.com
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. */
  10. #include <linux/err.h>
  11. #include <linux/smp.h>
  12. #include <linux/platform_device.h>
  13. static struct platform_device loongson2_cpufreq_device = {
  14. .name = "loongson2_cpufreq",
  15. .id = -1,
  16. };
  17. static int __init loongson2_cpufreq_init(void)
  18. {
  19. struct cpuinfo_mips *c = &current_cpu_data;
  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. return -ENODEV;
  24. }
  25. arch_initcall(loongson2_cpufreq_init);