cpu.h 5.7 KB

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