cpu.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /* linux/arch/arm/plat-s5p/cpu.c
  2. *
  3. * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  5. *
  6. * S5P 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/init.h>
  13. #include <linux/module.h>
  14. #include <asm/mach/arch.h>
  15. #include <asm/mach/map.h>
  16. #include <mach/map.h>
  17. #include <mach/regs-clock.h>
  18. #include <plat/cpu.h>
  19. #include <plat/s5p6440.h>
  20. #include <plat/s5p6450.h>
  21. #include <plat/s5pc100.h>
  22. #include <plat/s5pv210.h>
  23. #include <plat/exynos4.h>
  24. /* table of supported CPUs */
  25. static const char name_s5p6440[] = "S5P6440";
  26. static const char name_s5p6450[] = "S5P6450";
  27. static const char name_s5pc100[] = "S5PC100";
  28. static const char name_s5pv210[] = "S5PV210/S5PC110";
  29. static const char name_exynos4210[] = "EXYNOS4210";
  30. static const char name_exynos4212[] = "EXYNOS4212";
  31. static const char name_exynos4412[] = "EXYNOS4412";
  32. static struct cpu_table cpu_ids[] __initdata = {
  33. {
  34. .idcode = S5P6440_CPU_ID,
  35. .idmask = S5P64XX_CPU_MASK,
  36. .map_io = s5p6440_map_io,
  37. .init_clocks = s5p6440_init_clocks,
  38. .init_uarts = s5p6440_init_uarts,
  39. .init = s5p64x0_init,
  40. .name = name_s5p6440,
  41. }, {
  42. .idcode = S5P6450_CPU_ID,
  43. .idmask = S5P64XX_CPU_MASK,
  44. .map_io = s5p6450_map_io,
  45. .init_clocks = s5p6450_init_clocks,
  46. .init_uarts = s5p6450_init_uarts,
  47. .init = s5p64x0_init,
  48. .name = name_s5p6450,
  49. }, {
  50. .idcode = S5PC100_CPU_ID,
  51. .idmask = S5PC100_CPU_MASK,
  52. .map_io = s5pc100_map_io,
  53. .init_clocks = s5pc100_init_clocks,
  54. .init_uarts = s5pc100_init_uarts,
  55. .init = s5pc100_init,
  56. .name = name_s5pc100,
  57. }, {
  58. .idcode = S5PV210_CPU_ID,
  59. .idmask = S5PV210_CPU_MASK,
  60. .map_io = s5pv210_map_io,
  61. .init_clocks = s5pv210_init_clocks,
  62. .init_uarts = s5pv210_init_uarts,
  63. .init = s5pv210_init,
  64. .name = name_s5pv210,
  65. }, {
  66. .idcode = EXYNOS4210_CPU_ID,
  67. .idmask = EXYNOS4_CPU_MASK,
  68. .map_io = exynos4_map_io,
  69. .init_clocks = exynos4_init_clocks,
  70. .init_uarts = exynos4_init_uarts,
  71. .init = exynos_init,
  72. .name = name_exynos4210,
  73. }, {
  74. .idcode = EXYNOS4212_CPU_ID,
  75. .idmask = EXYNOS4_CPU_MASK,
  76. .map_io = exynos4_map_io,
  77. .init_clocks = exynos4_init_clocks,
  78. .init_uarts = exynos4_init_uarts,
  79. .init = exynos_init,
  80. .name = name_exynos4212,
  81. }, {
  82. .idcode = EXYNOS4412_CPU_ID,
  83. .idmask = EXYNOS4_CPU_MASK,
  84. .map_io = exynos4_map_io,
  85. .init_clocks = exynos4_init_clocks,
  86. .init_uarts = exynos4_init_uarts,
  87. .init = exynos_init,
  88. .name = name_exynos4412,
  89. },
  90. };
  91. /* minimal IO mapping */
  92. static struct map_desc s5p_iodesc[] __initdata = {
  93. {
  94. .virtual = (unsigned long)S5P_VA_CHIPID,
  95. .pfn = __phys_to_pfn(S5P_PA_CHIPID),
  96. .length = SZ_4K,
  97. .type = MT_DEVICE,
  98. }, {
  99. .virtual = (unsigned long)S3C_VA_SYS,
  100. .pfn = __phys_to_pfn(S5P_PA_SYSCON),
  101. .length = SZ_64K,
  102. .type = MT_DEVICE,
  103. }, {
  104. .virtual = (unsigned long)S3C_VA_TIMER,
  105. .pfn = __phys_to_pfn(S5P_PA_TIMER),
  106. .length = SZ_16K,
  107. .type = MT_DEVICE,
  108. }, {
  109. .virtual = (unsigned long)S3C_VA_WATCHDOG,
  110. .pfn = __phys_to_pfn(S3C_PA_WDT),
  111. .length = SZ_4K,
  112. .type = MT_DEVICE,
  113. }, {
  114. .virtual = (unsigned long)S5P_VA_SROMC,
  115. .pfn = __phys_to_pfn(S5P_PA_SROMC),
  116. .length = SZ_4K,
  117. .type = MT_DEVICE,
  118. },
  119. };
  120. /* read cpu identification code */
  121. void __init s5p_init_io(struct map_desc *mach_desc,
  122. int size, void __iomem *cpuid_addr)
  123. {
  124. /* initialize the io descriptors we need for initialization */
  125. iotable_init(s5p_iodesc, ARRAY_SIZE(s5p_iodesc));
  126. if (mach_desc)
  127. iotable_init(mach_desc, size);
  128. /* detect cpu id and rev. */
  129. s5p_init_cpu(cpuid_addr);
  130. s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
  131. }