cpu.h 5.5 KB

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