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 41907208c4SChristophe Leroy #if defined(CONFIG_8xx) 42907208c4SChristophe Leroy uint get_immr(uint); 43907208c4SChristophe Leroy #endif 446e2941d7SSimon Glass uint get_pvr(void); 456e2941d7SSimon Glass uint get_svr(void); 466e2941d7SSimon Glass uint rd_ic_cst(void); 476e2941d7SSimon Glass void wr_ic_cst(uint); 486e2941d7SSimon Glass void wr_ic_adr(uint); 496e2941d7SSimon Glass uint rd_dc_cst(void); 506e2941d7SSimon Glass void wr_dc_cst(uint); 516e2941d7SSimon Glass void wr_dc_adr(uint); 526e2941d7SSimon Glass 5398f705c9SHeiko Schocher #if defined(CONFIG_MPC85xx) || \ 546e2941d7SSimon Glass defined(CONFIG_MPC86xx) || \ 556e2941d7SSimon Glass defined(CONFIG_MPC83xx) 566e2941d7SSimon Glass unsigned char in8(unsigned int); 576e2941d7SSimon Glass void out8(unsigned int, unsigned char); 586e2941d7SSimon Glass unsigned short in16(unsigned int); 596e2941d7SSimon Glass unsigned short in16r(unsigned int); 606e2941d7SSimon Glass void out16(unsigned int, unsigned short value); 616e2941d7SSimon Glass void out16r(unsigned int, unsigned short value); 626e2941d7SSimon Glass unsigned long in32(unsigned int); 636e2941d7SSimon Glass unsigned long in32r(unsigned int); 646e2941d7SSimon Glass void out32(unsigned int, unsigned long value); 656e2941d7SSimon Glass void out32r(unsigned int, unsigned long value); 666e2941d7SSimon Glass void ppcDcbf(unsigned long value); 676e2941d7SSimon Glass void ppcDcbi(unsigned long value); 686e2941d7SSimon Glass void ppcSync(void); 696e2941d7SSimon Glass void ppcDcbz(unsigned long value); 706e2941d7SSimon Glass #endif 716e2941d7SSimon Glass #if defined(CONFIG_MPC83xx) 726e2941d7SSimon Glass void ppcDWload(unsigned int *addr, unsigned int *ret); 736e2941d7SSimon Glass void ppcDWstore(unsigned int *addr, unsigned int *value); 746e2941d7SSimon Glass void disable_addr_trans(void); 756e2941d7SSimon Glass void enable_addr_trans(void); 766e2941d7SSimon Glass #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) 776e2941d7SSimon Glass void ddr_enable_ecc(unsigned int dram_size); 786e2941d7SSimon Glass #endif 796e2941d7SSimon Glass #endif 806e2941d7SSimon Glass 816e2941d7SSimon Glass #if defined(CONFIG_MPC85xx) 826e2941d7SSimon Glass typedef MPC85xx_SYS_INFO sys_info_t; 836e2941d7SSimon Glass void get_sys_info(sys_info_t *); 846e2941d7SSimon Glass void ft_fixup_cpu(void *, u64); 856e2941d7SSimon Glass void ft_fixup_num_cores(void *); 866e2941d7SSimon Glass #endif 876e2941d7SSimon Glass #if defined(CONFIG_MPC86xx) 886e2941d7SSimon Glass ulong get_bus_freq(ulong); 896e2941d7SSimon Glass typedef MPC86xx_SYS_INFO sys_info_t; 906e2941d7SSimon Glass void get_sys_info(sys_info_t *); 916e2941d7SSimon Glass static inline ulong get_ddr_freq(ulong dummy) 926e2941d7SSimon Glass { 936e2941d7SSimon Glass return get_bus_freq(dummy); 946e2941d7SSimon Glass } 956e2941d7SSimon Glass #else 966e2941d7SSimon Glass ulong get_ddr_freq(ulong); 976e2941d7SSimon Glass #endif 986e2941d7SSimon Glass 99f1cd7367SChristophe Leroy static inline unsigned long get_msr(void) 100f1cd7367SChristophe Leroy { 101f1cd7367SChristophe Leroy unsigned long msr; 102f1cd7367SChristophe Leroy 103f1cd7367SChristophe Leroy asm volatile ("mfmsr %0" : "=r" (msr) : ); 104f1cd7367SChristophe Leroy 105f1cd7367SChristophe Leroy return msr; 106f1cd7367SChristophe Leroy } 107f1cd7367SChristophe Leroy 108f1cd7367SChristophe Leroy static inline void set_msr(unsigned long msr) 109f1cd7367SChristophe Leroy { 110f1cd7367SChristophe Leroy asm volatile ("mtmsr %0" : : "r" (msr)); 111f1cd7367SChristophe Leroy } 112f1cd7367SChristophe Leroy 113*f3603b43SChristophe Leroy #ifdef CONFIG_CMD_REGINFO 114*f3603b43SChristophe Leroy void print_reginfo(void); 115*f3603b43SChristophe Leroy #endif 116*f3603b43SChristophe Leroy 11785043159SSimon Glass #endif /* !__ASSEMBLY__ */ 11885043159SSimon Glass 1196e2941d7SSimon Glass #ifdef CONFIG_PPC 1206e2941d7SSimon Glass /* 1216e2941d7SSimon Glass * Has to be included outside of the #ifndef __ASSEMBLY__ section. 1226e2941d7SSimon Glass * Otherwise might lead to compilation errors in assembler files. 1236e2941d7SSimon Glass */ 1246e2941d7SSimon Glass #include <asm/cache.h> 1256e2941d7SSimon Glass #endif 1266e2941d7SSimon Glass 12785043159SSimon Glass #endif 128