cpu.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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 S3C6400_CPU_ID 0x36400000
  22. #define S3C6410_CPU_ID 0x36410000
  23. #define S3C64XX_CPU_MASK 0xFFFFF000
  24. #define S5P6440_CPU_ID 0x56440000
  25. #define S5P6450_CPU_ID 0x36450000
  26. #define S5P64XX_CPU_MASK 0xFFFFF000
  27. #define S5PC100_CPU_ID 0x43100000
  28. #define S5PC100_CPU_MASK 0xFFFFF000
  29. #define S5PV210_CPU_ID 0x43110000
  30. #define S5PV210_CPU_MASK 0xFFFFF000
  31. #define EXYNOS4210_CPU_ID 0x43210000
  32. #define EXYNOS4212_CPU_ID 0x43220000
  33. #define EXYNOS4412_CPU_ID 0xE4412200
  34. #define EXYNOS4_CPU_MASK 0xFFFE0000
  35. #define EXYNOS5250_SOC_ID 0x43520000
  36. #define EXYNOS5_SOC_MASK 0xFFFFF000
  37. #define IS_SAMSUNG_CPU(name, id, mask) \
  38. static inline int is_samsung_##name(void) \
  39. { \
  40. return ((samsung_cpu_id & mask) == (id & mask)); \
  41. }
  42. IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
  43. IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
  44. IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
  45. IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
  46. IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
  47. IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
  48. IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
  49. IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
  50. IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
  51. IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
  52. IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
  53. #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
  54. defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
  55. defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
  56. defined(CONFIG_CPU_S3C2443)
  57. # define soc_is_s3c24xx() is_samsung_s3c24xx()
  58. #else
  59. # define soc_is_s3c24xx() 0
  60. #endif
  61. #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
  62. # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
  63. #else
  64. # define soc_is_s3c64xx() 0
  65. #endif
  66. #if defined(CONFIG_CPU_S5P6440)
  67. # define soc_is_s5p6440() is_samsung_s5p6440()
  68. #else
  69. # define soc_is_s5p6440() 0
  70. #endif
  71. #if defined(CONFIG_CPU_S5P6450)
  72. # define soc_is_s5p6450() is_samsung_s5p6450()
  73. #else
  74. # define soc_is_s5p6450() 0
  75. #endif
  76. #if defined(CONFIG_CPU_S5PC100)
  77. # define soc_is_s5pc100() is_samsung_s5pc100()
  78. #else
  79. # define soc_is_s5pc100() 0
  80. #endif
  81. #if defined(CONFIG_CPU_S5PV210)
  82. # define soc_is_s5pv210() is_samsung_s5pv210()
  83. #else
  84. # define soc_is_s5pv210() 0
  85. #endif
  86. #if defined(CONFIG_CPU_EXYNOS4210)
  87. # define soc_is_exynos4210() is_samsung_exynos4210()
  88. #else
  89. # define soc_is_exynos4210() 0
  90. #endif
  91. #if defined(CONFIG_SOC_EXYNOS4212)
  92. # define soc_is_exynos4212() is_samsung_exynos4212()
  93. #else
  94. # define soc_is_exynos4212() 0
  95. #endif
  96. #if defined(CONFIG_SOC_EXYNOS4412)
  97. # define soc_is_exynos4412() is_samsung_exynos4412()
  98. #else
  99. # define soc_is_exynos4412() 0
  100. #endif
  101. #define EXYNOS4210_REV_0 (0x0)
  102. #define EXYNOS4210_REV_1_0 (0x10)
  103. #define EXYNOS4210_REV_1_1 (0x11)
  104. #if defined(CONFIG_SOC_EXYNOS5250)
  105. # define soc_is_exynos5250() is_samsung_exynos5250()
  106. #else
  107. # define soc_is_exynos5250() 0
  108. #endif
  109. #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
  110. #ifndef MHZ
  111. #define MHZ (1000*1000)
  112. #endif
  113. #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
  114. /* forward declaration */
  115. struct s3c24xx_uart_resources;
  116. struct platform_device;
  117. struct s3c2410_uartcfg;
  118. struct map_desc;
  119. /* per-cpu initialisation function table. */
  120. struct cpu_table {
  121. unsigned long idcode;
  122. unsigned long idmask;
  123. void (*map_io)(void);
  124. void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
  125. void (*init_clocks)(int xtal);
  126. int (*init)(void);
  127. const char *name;
  128. };
  129. extern void s3c_init_cpu(unsigned long idcode,
  130. struct cpu_table *cpus, unsigned int cputab_size);
  131. /* core initialisation functions */
  132. extern void s3c24xx_init_irq(void);
  133. extern void s5p_init_irq(u32 *vic, u32 num_vic);
  134. extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
  135. extern void s3c24xx_init_cpu(void);
  136. extern void s3c64xx_init_cpu(void);
  137. extern void s5p_init_cpu(void __iomem *cpuid_addr);
  138. extern unsigned int samsung_rev(void);
  139. extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
  140. extern void s3c24xx_init_clocks(int xtal);
  141. extern void s3c24xx_init_uartdevs(char *name,
  142. struct s3c24xx_uart_resources *res,
  143. struct s3c2410_uartcfg *cfg, int no);
  144. /* timer for 2410/2440 */
  145. struct sys_timer;
  146. extern struct sys_timer s3c24xx_timer;
  147. extern struct syscore_ops s3c2410_pm_syscore_ops;
  148. extern struct syscore_ops s3c2412_pm_syscore_ops;
  149. extern struct syscore_ops s3c2416_pm_syscore_ops;
  150. extern struct syscore_ops s3c244x_pm_syscore_ops;
  151. /* system device subsystems */
  152. extern struct bus_type s3c2410_subsys;
  153. extern struct bus_type s3c2410a_subsys;
  154. extern struct bus_type s3c2412_subsys;
  155. extern struct bus_type s3c2416_subsys;
  156. extern struct bus_type s3c2440_subsys;
  157. extern struct bus_type s3c2442_subsys;
  158. extern struct bus_type s3c2443_subsys;
  159. extern struct bus_type s3c6410_subsys;
  160. extern struct bus_type s5p64x0_subsys;
  161. extern struct bus_type s5pv210_subsys;
  162. extern struct bus_type exynos4_subsys;
  163. extern void (*s5pc1xx_idle)(void);
  164. #endif