185043159SSimon Glass /* 285043159SSimon Glass * Ugly header containing required header files. This could be adjusted 385043159SSimon Glass * so that including asm/arch/hardware includes the correct file. 485043159SSimon Glass * 585043159SSimon Glass * (C) Copyright 2000-2009 685043159SSimon Glass * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 785043159SSimon Glass * 885043159SSimon Glass * SPDX-License-Identifier: GPL-2.0+ 985043159SSimon Glass */ 1085043159SSimon Glass 1185043159SSimon Glass #ifndef __ASM_PPC_H 1285043159SSimon Glass #define __ASM_PPC_H 1385043159SSimon Glass 1485043159SSimon Glass #ifndef __ASSEMBLY__ 1585043159SSimon Glass 16907208c4SChristophe Leroy #if defined(CONFIG_8xx) 17907208c4SChristophe Leroy #include <asm/8xx_immap.h> 18907208c4SChristophe Leroy #endif 1985043159SSimon Glass #ifdef CONFIG_MPC86xx 2085043159SSimon Glass #include <mpc86xx.h> 2185043159SSimon Glass #include <asm/immap_86xx.h> 2285043159SSimon Glass #endif 2385043159SSimon Glass #ifdef CONFIG_MPC85xx 2485043159SSimon Glass #include <mpc85xx.h> 2585043159SSimon Glass #include <asm/immap_85xx.h> 2685043159SSimon Glass #endif 2785043159SSimon Glass #ifdef CONFIG_MPC83xx 2885043159SSimon Glass #include <mpc83xx.h> 2985043159SSimon Glass #include <asm/immap_83xx.h> 3085043159SSimon Glass #endif 3185043159SSimon Glass #ifdef CONFIG_SOC_DA8XX 3285043159SSimon Glass #include <asm/arch/hardware.h> 3385043159SSimon Glass #endif 3485043159SSimon Glass #ifdef CONFIG_FSL_LSCH3 3585043159SSimon Glass #include <asm/arch/immap_lsch3.h> 3685043159SSimon Glass #endif 3785043159SSimon Glass #ifdef CONFIG_FSL_LSCH2 3885043159SSimon Glass #include <asm/arch/immap_lsch2.h> 3985043159SSimon Glass #endif 4085043159SSimon Glass 41*7fd697fdSChristophe Leroy #include <asm/processor.h> 42*7fd697fdSChristophe Leroy 43907208c4SChristophe Leroy #if defined(CONFIG_8xx) 44*7fd697fdSChristophe Leroy static inline uint get_immr(uint mask) 45*7fd697fdSChristophe Leroy { 46*7fd697fdSChristophe Leroy uint immr = mfspr(SPRN_IMMR); 47*7fd697fdSChristophe Leroy 48*7fd697fdSChristophe Leroy return mask ? (immr & mask) : immr; 49*7fd697fdSChristophe Leroy } 50907208c4SChristophe Leroy #endif 516e2941d7SSimon Glass uint get_pvr(void); 526e2941d7SSimon Glass uint get_svr(void); 536e2941d7SSimon Glass uint rd_ic_cst(void); 546e2941d7SSimon Glass void wr_ic_cst(uint); 556e2941d7SSimon Glass void wr_ic_adr(uint); 566e2941d7SSimon Glass uint rd_dc_cst(void); 576e2941d7SSimon Glass void wr_dc_cst(uint); 586e2941d7SSimon Glass void wr_dc_adr(uint); 596e2941d7SSimon Glass 6098f705c9SHeiko Schocher #if defined(CONFIG_MPC85xx) || \ 616e2941d7SSimon Glass defined(CONFIG_MPC86xx) || \ 626e2941d7SSimon Glass defined(CONFIG_MPC83xx) 636e2941d7SSimon Glass unsigned char in8(unsigned int); 646e2941d7SSimon Glass void out8(unsigned int, unsigned char); 656e2941d7SSimon Glass unsigned short in16(unsigned int); 666e2941d7SSimon Glass unsigned short in16r(unsigned int); 676e2941d7SSimon Glass void out16(unsigned int, unsigned short value); 686e2941d7SSimon Glass void out16r(unsigned int, unsigned short value); 696e2941d7SSimon Glass unsigned long in32(unsigned int); 706e2941d7SSimon Glass unsigned long in32r(unsigned int); 716e2941d7SSimon Glass void out32(unsigned int, unsigned long value); 726e2941d7SSimon Glass void out32r(unsigned int, unsigned long value); 736e2941d7SSimon Glass void ppcDcbf(unsigned long value); 746e2941d7SSimon Glass void ppcDcbi(unsigned long value); 756e2941d7SSimon Glass void ppcSync(void); 766e2941d7SSimon Glass void ppcDcbz(unsigned long value); 776e2941d7SSimon Glass #endif 786e2941d7SSimon Glass #if defined(CONFIG_MPC83xx) 796e2941d7SSimon Glass void ppcDWload(unsigned int *addr, unsigned int *ret); 806e2941d7SSimon Glass void ppcDWstore(unsigned int *addr, unsigned int *value); 816e2941d7SSimon Glass void disable_addr_trans(void); 826e2941d7SSimon Glass void enable_addr_trans(void); 836e2941d7SSimon Glass #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) 846e2941d7SSimon Glass void ddr_enable_ecc(unsigned int dram_size); 856e2941d7SSimon Glass #endif 866e2941d7SSimon Glass #endif 876e2941d7SSimon Glass 886e2941d7SSimon Glass #if defined(CONFIG_MPC85xx) 896e2941d7SSimon Glass typedef MPC85xx_SYS_INFO sys_info_t; 906e2941d7SSimon Glass void get_sys_info(sys_info_t *); 916e2941d7SSimon Glass void ft_fixup_cpu(void *, u64); 926e2941d7SSimon Glass void ft_fixup_num_cores(void *); 936e2941d7SSimon Glass #endif 946e2941d7SSimon Glass #if defined(CONFIG_MPC86xx) 956e2941d7SSimon Glass ulong get_bus_freq(ulong); 966e2941d7SSimon Glass typedef MPC86xx_SYS_INFO sys_info_t; 976e2941d7SSimon Glass void get_sys_info(sys_info_t *); 986e2941d7SSimon Glass static inline ulong get_ddr_freq(ulong dummy) 996e2941d7SSimon Glass { 1006e2941d7SSimon Glass return get_bus_freq(dummy); 1016e2941d7SSimon Glass } 1026e2941d7SSimon Glass #else 1036e2941d7SSimon Glass ulong get_ddr_freq(ulong); 1046e2941d7SSimon Glass #endif 1056e2941d7SSimon Glass 106f1cd7367SChristophe Leroy static inline unsigned long get_msr(void) 107f1cd7367SChristophe Leroy { 108f1cd7367SChristophe Leroy unsigned long msr; 109f1cd7367SChristophe Leroy 110f1cd7367SChristophe Leroy asm volatile ("mfmsr %0" : "=r" (msr) : ); 111f1cd7367SChristophe Leroy 112f1cd7367SChristophe Leroy return msr; 113f1cd7367SChristophe Leroy } 114f1cd7367SChristophe Leroy 115f1cd7367SChristophe Leroy static inline void set_msr(unsigned long msr) 116f1cd7367SChristophe Leroy { 117f1cd7367SChristophe Leroy asm volatile ("mtmsr %0" : : "r" (msr)); 118f1cd7367SChristophe Leroy } 119f1cd7367SChristophe Leroy 120f3603b43SChristophe Leroy #ifdef CONFIG_CMD_REGINFO 121f3603b43SChristophe Leroy void print_reginfo(void); 122f3603b43SChristophe Leroy #endif 123f3603b43SChristophe Leroy 12485043159SSimon Glass #endif /* !__ASSEMBLY__ */ 12585043159SSimon Glass 1266e2941d7SSimon Glass #ifdef CONFIG_PPC 1276e2941d7SSimon Glass /* 1286e2941d7SSimon Glass * Has to be included outside of the #ifndef __ASSEMBLY__ section. 1296e2941d7SSimon Glass * Otherwise might lead to compilation errors in assembler files. 1306e2941d7SSimon Glass */ 1316e2941d7SSimon Glass #include <asm/cache.h> 1326e2941d7SSimon Glass #endif 1336e2941d7SSimon Glass 13485043159SSimon Glass #endif 135