cpu.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. /* linux/arch/arm/plat-samsung/include/plat/cpu.h
  2. *
  3. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com/
  5. *
  6. * Copyright (c) 2004-2005 Simtec Electronics
  7. * Ben Dooks <ben@simtec.co.uk>
  8. *
  9. * Header file for Samsung CPU support
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. /* todo - fix when rmk changes iodescs to use `void __iomem *` */
  16. #ifndef __SAMSUNG_PLAT_CPU_H
  17. #define __SAMSUNG_PLAT_CPU_H
  18. extern unsigned long samsung_cpu_id;
  19. #define S3C24XX_CPU_ID 0x32400000
  20. #define S3C24XX_CPU_MASK 0xFFF00000
  21. #define S3C2412_CPU_ID 0x32412000
  22. #define S3C2412_CPU_MASK 0xFFFFF000
  23. #define S3C6400_CPU_ID 0x36400000
  24. #define S3C6410_CPU_ID 0x36410000
  25. #define S3C64XX_CPU_MASK 0xFFFFF000
  26. #define S5P6440_CPU_ID 0x56440000
  27. #define S5P6450_CPU_ID 0x36450000
  28. #define S5P64XX_CPU_MASK 0xFFFFF000
  29. #define S5PC100_CPU_ID 0x43100000
  30. #define S5PC100_CPU_MASK 0xFFFFF000
  31. #define S5PV210_CPU_ID 0x43110000
  32. #define S5PV210_CPU_MASK 0xFFFFF000
  33. #define EXYNOS4210_CPU_ID 0x43210000
  34. #define EXYNOS4212_CPU_ID 0x43220000
  35. #define EXYNOS4412_CPU_ID 0xE4412200
  36. #define EXYNOS4_CPU_MASK 0xFFFE0000
  37. #define EXYNOS5250_SOC_ID 0x43520000
  38. #define EXYNOS5420_SOC_ID 0xE5420000
  39. #define EXYNOS5440_SOC_ID 0xE5440000
  40. #define EXYNOS5_SOC_MASK 0xFFFFF000
  41. #define IS_SAMSUNG_CPU(name, id, mask) \
  42. static inline int is_samsung_##name(void) \
  43. { \
  44. return ((samsung_cpu_id & mask) == (id & mask)); \
  45. }
  46. IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
  47. IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
  48. IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
  49. IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
  50. IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
  51. IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
  52. IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
  53. IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
  54. IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
  55. IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
  56. IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
  57. IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
  58. IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
  59. IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
  60. #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
  61. defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
  62. defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
  63. defined(CONFIG_CPU_S3C2443)
  64. # define soc_is_s3c24xx() is_samsung_s3c24xx()
  65. #else
  66. # define soc_is_s3c24xx() 0
  67. #endif
  68. #if defined(CONFIG_CPU_S3C2412)
  69. # define soc_is_s3c2412() is_samsung_s3c2412()
  70. #else
  71. # define soc_is_s3c2412() 0
  72. #endif
  73. #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
  74. # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
  75. #else
  76. # define soc_is_s3c64xx() 0
  77. #endif
  78. #if defined(CONFIG_CPU_S5P6440)
  79. # define soc_is_s5p6440() is_samsung_s5p6440()
  80. #else
  81. # define soc_is_s5p6440() 0
  82. #endif
  83. #if defined(CONFIG_CPU_S5P6450)
  84. # define soc_is_s5p6450() is_samsung_s5p6450()
  85. #else
  86. # define soc_is_s5p6450() 0
  87. #endif
  88. #if defined(CONFIG_CPU_S5PC100)
  89. # define soc_is_s5pc100() is_samsung_s5pc100()
  90. #else
  91. # define soc_is_s5pc100() 0
  92. #endif
  93. #if defined(CONFIG_CPU_S5PV210)
  94. # define soc_is_s5pv210() is_samsung_s5pv210()
  95. #else
  96. # define soc_is_s5pv210() 0
  97. #endif
  98. #if defined(CONFIG_CPU_EXYNOS4210)
  99. # define soc_is_exynos4210() is_samsung_exynos4210()
  100. #else
  101. # define soc_is_exynos4210() 0
  102. #endif
  103. #if defined(CONFIG_SOC_EXYNOS4212)
  104. # define soc_is_exynos4212() is_samsung_exynos4212()
  105. #else
  106. # define soc_is_exynos4212() 0
  107. #endif
  108. #if defined(CONFIG_SOC_EXYNOS4412)
  109. # define soc_is_exynos4412() is_samsung_exynos4412()
  110. #else
  111. # define soc_is_exynos4412() 0
  112. #endif
  113. #define EXYNOS4210_REV_0 (0x0)
  114. #define EXYNOS4210_REV_1_0 (0x10)
  115. #define EXYNOS4210_REV_1_1 (0x11)
  116. #if defined(CONFIG_SOC_EXYNOS5250)
  117. # define soc_is_exynos5250() is_samsung_exynos5250()
  118. #else
  119. # define soc_is_exynos5250() 0
  120. #endif
  121. #if defined(CONFIG_SOC_EXYNOS5420)
  122. # define soc_is_exynos5420() is_samsung_exynos5420()
  123. #else
  124. # define soc_is_exynos5420() 0
  125. #endif
  126. #if defined(CONFIG_SOC_EXYNOS5440)
  127. # define soc_is_exynos5440() is_samsung_exynos5440()
  128. #else
  129. # define soc_is_exynos5440() 0
  130. #endif
  131. #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
  132. #ifndef KHZ
  133. #define KHZ (1000)
  134. #endif
  135. #ifndef MHZ
  136. #define MHZ (1000*1000)
  137. #endif
  138. #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
  139. /* forward declaration */
  140. struct s3c24xx_uart_resources;
  141. struct platform_device;
  142. struct s3c2410_uartcfg;
  143. struct map_desc;
  144. /* per-cpu initialisation function table. */
  145. struct cpu_table {
  146. unsigned long idcode;
  147. unsigned long idmask;
  148. void (*map_io)(void);
  149. void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
  150. void (*init_clocks)(int xtal);
  151. int (*init)(void);
  152. const char *name;
  153. };
  154. extern void s3c_init_cpu(unsigned long idcode,
  155. struct cpu_table *cpus, unsigned int cputab_size);
  156. /* core initialisation functions */
  157. extern void s5p_init_irq(u32 *vic, u32 num_vic);
  158. extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
  159. extern void s3c24xx_init_cpu(void);
  160. extern void s3c64xx_init_cpu(void);
  161. extern void s5p_init_cpu(void __iomem *cpuid_addr);
  162. extern unsigned int samsung_rev(void);
  163. extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
  164. extern void s3c24xx_init_clocks(int xtal);
  165. extern void s3c24xx_init_uartdevs(char *name,
  166. struct s3c24xx_uart_resources *res,
  167. struct s3c2410_uartcfg *cfg, int no);
  168. extern struct syscore_ops s3c2410_pm_syscore_ops;
  169. extern struct syscore_ops s3c2412_pm_syscore_ops;
  170. extern struct syscore_ops s3c2416_pm_syscore_ops;
  171. extern struct syscore_ops s3c244x_pm_syscore_ops;
  172. /* system device subsystems */
  173. extern struct bus_type s3c2410_subsys;
  174. extern struct bus_type s3c2410a_subsys;
  175. extern struct bus_type s3c2412_subsys;
  176. extern struct bus_type s3c2416_subsys;
  177. extern struct bus_type s3c2440_subsys;
  178. extern struct bus_type s3c2442_subsys;
  179. extern struct bus_type s3c2443_subsys;
  180. extern struct bus_type s3c6410_subsys;
  181. extern struct bus_type s5p64x0_subsys;
  182. extern struct bus_type s5pv210_subsys;
  183. extern struct bus_type exynos_subsys;
  184. extern void (*s5pc1xx_idle)(void);
  185. #endif