ppc.h 3.1 KB

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