cpu.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* SPDX-License-Identifier: GPL-2.0 */
  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. /* todo - fix when rmk changes iodescs to use `void __iomem *` */
  12. #ifndef __SAMSUNG_PLAT_CPU_H
  13. #define __SAMSUNG_PLAT_CPU_H
  14. extern unsigned long samsung_cpu_id;
  15. #define S3C2410_CPU_ID 0x32410000
  16. #define S3C2410_CPU_MASK 0xFFFFFFFF
  17. #define S3C24XX_CPU_ID 0x32400000
  18. #define S3C24XX_CPU_MASK 0xFFF00000
  19. #define S3C2412_CPU_ID 0x32412000
  20. #define S3C2412_CPU_MASK 0xFFFFF000
  21. #define S3C6400_CPU_ID 0x36400000
  22. #define S3C6410_CPU_ID 0x36410000
  23. #define S3C64XX_CPU_MASK 0xFFFFF000
  24. #define S5PV210_CPU_ID 0x43110000
  25. #define S5PV210_CPU_MASK 0xFFFFF000
  26. #define IS_SAMSUNG_CPU(name, id, mask) \
  27. static inline int is_samsung_##name(void) \
  28. { \
  29. return ((samsung_cpu_id & mask) == (id & mask)); \
  30. }
  31. IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
  32. IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
  33. IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
  34. IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
  35. IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
  36. #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
  37. defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
  38. defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
  39. defined(CONFIG_CPU_S3C2443)
  40. # define soc_is_s3c24xx() is_samsung_s3c24xx()
  41. # define soc_is_s3c2410() is_samsung_s3c2410()
  42. #else
  43. # define soc_is_s3c24xx() 0
  44. # define soc_is_s3c2410() 0
  45. #endif
  46. #if defined(CONFIG_CPU_S3C2412)
  47. # define soc_is_s3c2412() is_samsung_s3c2412()
  48. #else
  49. # define soc_is_s3c2412() 0
  50. #endif
  51. #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
  52. # define soc_is_s3c6400() is_samsung_s3c6400()
  53. # define soc_is_s3c6410() is_samsung_s3c6410()
  54. # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
  55. #else
  56. # define soc_is_s3c6400() 0
  57. # define soc_is_s3c6410() 0
  58. # define soc_is_s3c64xx() 0
  59. #endif
  60. #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
  61. #ifndef KHZ
  62. #define KHZ (1000)
  63. #endif
  64. #ifndef MHZ
  65. #define MHZ (1000*1000)
  66. #endif
  67. #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
  68. /* forward declaration */
  69. struct s3c24xx_uart_resources;
  70. struct platform_device;
  71. struct s3c2410_uartcfg;
  72. struct map_desc;
  73. /* per-cpu initialisation function table. */
  74. struct cpu_table {
  75. unsigned long idcode;
  76. unsigned long idmask;
  77. void (*map_io)(void);
  78. void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
  79. void (*init_clocks)(int xtal);
  80. int (*init)(void);
  81. const char *name;
  82. };
  83. extern void s3c_init_cpu(unsigned long idcode,
  84. struct cpu_table *cpus, unsigned int cputab_size);
  85. /* core initialisation functions */
  86. extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
  87. extern void s3c64xx_init_cpu(void);
  88. extern void s5p_init_cpu(const void __iomem *cpuid_addr);
  89. extern unsigned int samsung_rev(void);
  90. extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
  91. extern void s3c24xx_init_clocks(int xtal);
  92. extern void s3c24xx_init_uartdevs(char *name,
  93. struct s3c24xx_uart_resources *res,
  94. struct s3c2410_uartcfg *cfg, int no);
  95. extern struct syscore_ops s3c2410_pm_syscore_ops;
  96. extern struct syscore_ops s3c2412_pm_syscore_ops;
  97. extern struct syscore_ops s3c2416_pm_syscore_ops;
  98. extern struct syscore_ops s3c244x_pm_syscore_ops;
  99. /* system device subsystems */
  100. extern struct bus_type s3c2410_subsys;
  101. extern struct bus_type s3c2410a_subsys;
  102. extern struct bus_type s3c2412_subsys;
  103. extern struct bus_type s3c2416_subsys;
  104. extern struct bus_type s3c2440_subsys;
  105. extern struct bus_type s3c2442_subsys;
  106. extern struct bus_type s3c2443_subsys;
  107. extern struct bus_type s3c6410_subsys;
  108. #endif