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