cpu.h 3.9 KB

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