cpu.h 5.3 KB

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