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 417fd697fdSChristophe Leroy #include <asm/processor.h> 427fd697fdSChristophe Leroy 43907208c4SChristophe Leroy #if defined(CONFIG_8xx) 447fd697fdSChristophe Leroy static inline uint get_immr(uint mask) 457fd697fdSChristophe Leroy { 467fd697fdSChristophe Leroy uint immr = mfspr(SPRN_IMMR); 477fd697fdSChristophe Leroy 487fd697fdSChristophe Leroy return mask ? (immr & mask) : immr; 497fd697fdSChristophe Leroy } 50907208c4SChristophe Leroy #endif 51ba2c5a5cSChristophe Leroy static inline uint get_pvr(void) 52ba2c5a5cSChristophe Leroy { 53ba2c5a5cSChristophe Leroy return mfspr(PVR); 54ba2c5a5cSChristophe Leroy } 55ba2c5a5cSChristophe Leroy 56ba2c5a5cSChristophe Leroy static inline uint get_svr(void) 57ba2c5a5cSChristophe Leroy { 58ba2c5a5cSChristophe Leroy return mfspr(SVR); 59ba2c5a5cSChristophe Leroy } 606e2941d7SSimon Glass 6198f705c9SHeiko Schocher #if defined(CONFIG_MPC85xx) || \ 626e2941d7SSimon Glass defined(CONFIG_MPC86xx) || \ 636e2941d7SSimon Glass defined(CONFIG_MPC83xx) 646e2941d7SSimon Glass unsigned char in8(unsigned int); 656e2941d7SSimon Glass void out8(unsigned int, unsigned char); 666e2941d7SSimon Glass unsigned short in16(unsigned int); 676e2941d7SSimon Glass unsigned short in16r(unsigned int); 686e2941d7SSimon Glass void out16(unsigned int, unsigned short value); 696e2941d7SSimon Glass void out16r(unsigned int, unsigned short value); 706e2941d7SSimon Glass unsigned long in32(unsigned int); 716e2941d7SSimon Glass unsigned long in32r(unsigned int); 726e2941d7SSimon Glass void out32(unsigned int, unsigned long value); 736e2941d7SSimon Glass void out32r(unsigned int, unsigned long value); 746e2941d7SSimon Glass void ppcDcbf(unsigned long value); 756e2941d7SSimon Glass void ppcDcbi(unsigned long value); 766e2941d7SSimon Glass void ppcSync(void); 776e2941d7SSimon Glass void ppcDcbz(unsigned long value); 786e2941d7SSimon Glass #endif 796e2941d7SSimon Glass #if defined(CONFIG_MPC83xx) 806e2941d7SSimon Glass void ppcDWload(unsigned int *addr, unsigned int *ret); 816e2941d7SSimon Glass void ppcDWstore(unsigned int *addr, unsigned int *value); 826e2941d7SSimon Glass void disable_addr_trans(void); 836e2941d7SSimon Glass void enable_addr_trans(void); 846e2941d7SSimon Glass #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) 856e2941d7SSimon Glass void ddr_enable_ecc(unsigned int dram_size); 866e2941d7SSimon Glass #endif 876e2941d7SSimon Glass #endif 886e2941d7SSimon Glass 896e2941d7SSimon Glass #if defined(CONFIG_MPC85xx) 906e2941d7SSimon Glass typedef MPC85xx_SYS_INFO sys_info_t; 916e2941d7SSimon Glass void get_sys_info(sys_info_t *); 926e2941d7SSimon Glass void ft_fixup_cpu(void *, u64); 936e2941d7SSimon Glass void ft_fixup_num_cores(void *); 946e2941d7SSimon Glass #endif 956e2941d7SSimon Glass #if defined(CONFIG_MPC86xx) 966e2941d7SSimon Glass ulong get_bus_freq(ulong); 976e2941d7SSimon Glass typedef MPC86xx_SYS_INFO sys_info_t; 986e2941d7SSimon Glass void get_sys_info(sys_info_t *); 996e2941d7SSimon Glass static inline ulong get_ddr_freq(ulong dummy) 1006e2941d7SSimon Glass { 1016e2941d7SSimon Glass return get_bus_freq(dummy); 1026e2941d7SSimon Glass } 1036e2941d7SSimon Glass #else 1046e2941d7SSimon Glass ulong get_ddr_freq(ulong); 1056e2941d7SSimon Glass #endif 1066e2941d7SSimon Glass 107f1cd7367SChristophe Leroy static inline unsigned long get_msr(void) 108f1cd7367SChristophe Leroy { 109f1cd7367SChristophe Leroy unsigned long msr; 110f1cd7367SChristophe Leroy 111f1cd7367SChristophe Leroy asm volatile ("mfmsr %0" : "=r" (msr) : ); 112f1cd7367SChristophe Leroy 113f1cd7367SChristophe Leroy return msr; 114f1cd7367SChristophe Leroy } 115f1cd7367SChristophe Leroy 116f1cd7367SChristophe Leroy static inline void set_msr(unsigned long msr) 117f1cd7367SChristophe Leroy { 118f1cd7367SChristophe Leroy asm volatile ("mtmsr %0" : : "r" (msr)); 119f1cd7367SChristophe Leroy } 120f1cd7367SChristophe Leroy 121f3603b43SChristophe Leroy #ifdef CONFIG_CMD_REGINFO 122f3603b43SChristophe Leroy void print_reginfo(void); 123f3603b43SChristophe Leroy #endif 124f3603b43SChristophe Leroy 125*08dd988bSChristophe Leroy int interrupt_init_cpu(unsigned *); 126*08dd988bSChristophe Leroy void timer_interrupt_cpu(struct pt_regs *); 127*08dd988bSChristophe Leroy unsigned long search_exception_table(unsigned long addr); 128*08dd988bSChristophe Leroy 12985043159SSimon Glass #endif /* !__ASSEMBLY__ */ 13085043159SSimon Glass 1316e2941d7SSimon Glass #ifdef CONFIG_PPC 1326e2941d7SSimon Glass /* 1336e2941d7SSimon Glass * Has to be included outside of the #ifndef __ASSEMBLY__ section. 1346e2941d7SSimon Glass * Otherwise might lead to compilation errors in assembler files. 1356e2941d7SSimon Glass */ 1366e2941d7SSimon Glass #include <asm/cache.h> 1376e2941d7SSimon Glass #endif 1386e2941d7SSimon Glass 13985043159SSimon Glass #endif 140