ppc.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Ugly header containing required header files. This could be adjusted
  4. * so that including asm/arch/hardware includes the correct file.
  5. *
  6. * (C) Copyright 2000-2009
  7. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  8. */
  9. #ifndef __ASM_PPC_H
  10. #define __ASM_PPC_H
  11. #ifndef __ASSEMBLY__
  12. #if defined(CONFIG_MPC8xx)
  13. #include <asm/immap_8xx.h>
  14. #endif
  15. #ifdef CONFIG_MPC86xx
  16. #include <mpc86xx.h>
  17. #include <asm/immap_86xx.h>
  18. #endif
  19. #ifdef CONFIG_MPC85xx
  20. #include <mpc85xx.h>
  21. #include <asm/immap_85xx.h>
  22. #endif
  23. #ifdef CONFIG_MPC83xx
  24. #include <mpc83xx.h>
  25. #include <asm/immap_83xx.h>
  26. #endif
  27. #ifdef CONFIG_SOC_DA8XX
  28. #include <asm/arch/hardware.h>
  29. #endif
  30. #ifdef CONFIG_FSL_LSCH3
  31. #include <asm/arch/immap_lsch3.h>
  32. #endif
  33. #ifdef CONFIG_FSL_LSCH2
  34. #include <asm/arch/immap_lsch2.h>
  35. #endif
  36. #include <asm/processor.h>
  37. static inline uint get_immr(void)
  38. {
  39. return mfspr(SPRN_IMMR);
  40. }
  41. static inline uint get_pvr(void)
  42. {
  43. return mfspr(PVR);
  44. }
  45. static inline uint get_svr(void)
  46. {
  47. return mfspr(SVR);
  48. }
  49. #if defined(CONFIG_MPC85xx) || \
  50. defined(CONFIG_MPC86xx) || \
  51. defined(CONFIG_MPC83xx)
  52. unsigned char in8(unsigned int);
  53. void out8(unsigned int, unsigned char);
  54. unsigned short in16(unsigned int);
  55. unsigned short in16r(unsigned int);
  56. void out16(unsigned int, unsigned short value);
  57. void out16r(unsigned int, unsigned short value);
  58. unsigned long in32(unsigned int);
  59. unsigned long in32r(unsigned int);
  60. void out32(unsigned int, unsigned long value);
  61. void out32r(unsigned int, unsigned long value);
  62. void ppcDcbf(unsigned long value);
  63. void ppcDcbi(unsigned long value);
  64. void ppcSync(void);
  65. void ppcDcbz(unsigned long value);
  66. #endif
  67. #if defined(CONFIG_MPC83xx)
  68. void ppcDWload(unsigned int *addr, unsigned int *ret);
  69. void ppcDWstore(unsigned int *addr, unsigned int *value);
  70. void disable_addr_trans(void);
  71. void enable_addr_trans(void);
  72. #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
  73. void ddr_enable_ecc(unsigned int dram_size);
  74. #endif
  75. #endif
  76. #if defined(CONFIG_MPC85xx)
  77. typedef MPC85xx_SYS_INFO sys_info_t;
  78. void get_sys_info(sys_info_t *);
  79. void ft_fixup_cpu(void *, u64);
  80. void ft_fixup_num_cores(void *);
  81. #endif
  82. #if defined(CONFIG_MPC86xx)
  83. ulong get_bus_freq(ulong);
  84. typedef MPC86xx_SYS_INFO sys_info_t;
  85. void get_sys_info(sys_info_t *);
  86. static inline ulong get_ddr_freq(ulong dummy)
  87. {
  88. return get_bus_freq(dummy);
  89. }
  90. #else
  91. ulong get_ddr_freq(ulong);
  92. #endif
  93. static inline unsigned long get_msr(void)
  94. {
  95. unsigned long msr;
  96. asm volatile ("mfmsr %0" : "=r" (msr) : );
  97. return msr;
  98. }
  99. static inline void set_msr(unsigned long msr)
  100. {
  101. asm volatile ("mtmsr %0" : : "r" (msr));
  102. }
  103. #ifdef CONFIG_CMD_REGINFO
  104. void print_reginfo(void);
  105. #endif
  106. void interrupt_init_cpu(unsigned *);
  107. void timer_interrupt_cpu(struct pt_regs *);
  108. unsigned long search_exception_table(unsigned long addr);
  109. #endif /* !__ASSEMBLY__ */
  110. #ifdef CONFIG_PPC
  111. /*
  112. * Has to be included outside of the #ifndef __ASSEMBLY__ section.
  113. * Otherwise might lead to compilation errors in assembler files.
  114. */
  115. #include <asm/cache.h>
  116. #endif
  117. #endif