cpu.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 S3C6400_CPU_ID 0x36400000
  16. #define S3C6410_CPU_ID 0x36410000
  17. #define S3C64XX_CPU_MASK 0xFFFFF000
  18. #define S5PV210_CPU_ID 0x43110000
  19. #define S5PV210_CPU_MASK 0xFFFFF000
  20. #define IS_SAMSUNG_CPU(name, id, mask) \
  21. static inline int is_samsung_##name(void) \
  22. { \
  23. return ((samsung_cpu_id & mask) == (id & mask)); \
  24. }
  25. IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
  26. IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
  27. #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
  28. # define soc_is_s3c6400() is_samsung_s3c6400()
  29. # define soc_is_s3c6410() is_samsung_s3c6410()
  30. # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
  31. #else
  32. # define soc_is_s3c6400() 0
  33. # define soc_is_s3c6410() 0
  34. # define soc_is_s3c64xx() 0
  35. #endif
  36. #ifndef MHZ
  37. #define MHZ (1000*1000)
  38. #endif
  39. #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
  40. /* forward declaration */
  41. struct s3c24xx_uart_resources;
  42. struct platform_device;
  43. struct s3c2410_uartcfg;
  44. struct map_desc;
  45. /* per-cpu initialisation function table. */
  46. struct cpu_table {
  47. unsigned long idcode;
  48. unsigned long idmask;
  49. void (*map_io)(void);
  50. void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
  51. int (*init)(void);
  52. const char *name;
  53. };
  54. extern void s3c_init_cpu(unsigned long idcode,
  55. struct cpu_table *cpus, unsigned int cputab_size);
  56. /* core initialisation functions */
  57. extern void s3c64xx_init_cpu(void);
  58. extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
  59. extern void s3c24xx_init_uartdevs(char *name,
  60. struct s3c24xx_uart_resources *res,
  61. struct s3c2410_uartcfg *cfg, int no);
  62. extern const struct bus_type s3c6410_subsys;
  63. #endif