cpu.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* linux/arch/arm/plat-samsung/cpu.c
  2. *
  3. * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  5. *
  6. * Samsung CPU Support
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/module.h>
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/io.h>
  16. #include <plat/map-base.h>
  17. #include <plat/cpu.h>
  18. unsigned long samsung_cpu_id;
  19. static unsigned int samsung_cpu_rev;
  20. unsigned int samsung_rev(void)
  21. {
  22. return samsung_cpu_rev;
  23. }
  24. EXPORT_SYMBOL(samsung_rev);
  25. void __init s3c64xx_init_cpu(void)
  26. {
  27. samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0x118);
  28. if (!samsung_cpu_id) {
  29. /*
  30. * S3C6400 has the ID register in a different place,
  31. * and needs a write before it can be read.
  32. */
  33. writel_relaxed(0x0, S3C_VA_SYS + 0xA1C);
  34. samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0xA1C);
  35. }
  36. samsung_cpu_rev = 0;
  37. pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id);
  38. }
  39. void __init s5p_init_cpu(const void __iomem *cpuid_addr)
  40. {
  41. samsung_cpu_id = readl_relaxed(cpuid_addr);
  42. samsung_cpu_rev = samsung_cpu_id & 0xFF;
  43. pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id);
  44. }