Simon Glass | 7613579 | 2017-05-17 08:23:05 -0600 | [diff] [blame] | 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 | |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 16 | #if defined(CONFIG_8xx) |
| 17 | #include <asm/8xx_immap.h> |
Christophe Leroy | 069fa83 | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 18 | #endif |
Simon Glass | 7613579 | 2017-05-17 08:23:05 -0600 | [diff] [blame] | 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 |
Simon Glass | 7613579 | 2017-05-17 08:23:05 -0600 | [diff] [blame] | 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 | |
Christophe Leroy | 9b021ae | 2017-07-13 15:10:02 +0200 | [diff] [blame] | 41 | #include <asm/processor.h> |
| 42 | |
Christophe Leroy | bda8947 | 2018-03-16 17:20:39 +0100 | [diff] [blame^] | 43 | static inline uint get_immr(void) |
Christophe Leroy | 9b021ae | 2017-07-13 15:10:02 +0200 | [diff] [blame] | 44 | { |
Christophe Leroy | bda8947 | 2018-03-16 17:20:39 +0100 | [diff] [blame^] | 45 | return mfspr(SPRN_IMMR); |
Christophe Leroy | 9b021ae | 2017-07-13 15:10:02 +0200 | [diff] [blame] | 46 | } |
Christophe Leroy | edd4ebe | 2018-03-16 17:20:37 +0100 | [diff] [blame] | 47 | |
Christophe Leroy | 3d97f8e | 2017-07-13 15:10:06 +0200 | [diff] [blame] | 48 | static inline uint get_pvr(void) |
| 49 | { |
| 50 | return mfspr(PVR); |
| 51 | } |
| 52 | |
| 53 | static inline uint get_svr(void) |
| 54 | { |
| 55 | return mfspr(SVR); |
| 56 | } |
Simon Glass | 243182c | 2017-05-17 08:23:06 -0600 | [diff] [blame] | 57 | |
Heiko Schocher | 2028012 | 2017-06-27 16:49:14 +0200 | [diff] [blame] | 58 | #if defined(CONFIG_MPC85xx) || \ |
Simon Glass | 243182c | 2017-05-17 08:23:06 -0600 | [diff] [blame] | 59 | defined(CONFIG_MPC86xx) || \ |
| 60 | defined(CONFIG_MPC83xx) |
| 61 | unsigned char in8(unsigned int); |
| 62 | void out8(unsigned int, unsigned char); |
| 63 | unsigned short in16(unsigned int); |
| 64 | unsigned short in16r(unsigned int); |
| 65 | void out16(unsigned int, unsigned short value); |
| 66 | void out16r(unsigned int, unsigned short value); |
| 67 | unsigned long in32(unsigned int); |
| 68 | unsigned long in32r(unsigned int); |
| 69 | void out32(unsigned int, unsigned long value); |
| 70 | void out32r(unsigned int, unsigned long value); |
| 71 | void ppcDcbf(unsigned long value); |
| 72 | void ppcDcbi(unsigned long value); |
| 73 | void ppcSync(void); |
| 74 | void ppcDcbz(unsigned long value); |
| 75 | #endif |
| 76 | #if defined(CONFIG_MPC83xx) |
| 77 | void ppcDWload(unsigned int *addr, unsigned int *ret); |
| 78 | void ppcDWstore(unsigned int *addr, unsigned int *value); |
| 79 | void disable_addr_trans(void); |
| 80 | void enable_addr_trans(void); |
| 81 | #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) |
| 82 | void ddr_enable_ecc(unsigned int dram_size); |
| 83 | #endif |
| 84 | #endif |
| 85 | |
Simon Glass | 243182c | 2017-05-17 08:23:06 -0600 | [diff] [blame] | 86 | #if defined(CONFIG_MPC85xx) |
| 87 | typedef MPC85xx_SYS_INFO sys_info_t; |
| 88 | void get_sys_info(sys_info_t *); |
| 89 | void ft_fixup_cpu(void *, u64); |
| 90 | void ft_fixup_num_cores(void *); |
| 91 | #endif |
| 92 | #if defined(CONFIG_MPC86xx) |
| 93 | ulong get_bus_freq(ulong); |
| 94 | typedef MPC86xx_SYS_INFO sys_info_t; |
| 95 | void get_sys_info(sys_info_t *); |
| 96 | static inline ulong get_ddr_freq(ulong dummy) |
| 97 | { |
| 98 | return get_bus_freq(dummy); |
| 99 | } |
| 100 | #else |
| 101 | ulong get_ddr_freq(ulong); |
| 102 | #endif |
| 103 | |
Christophe Leroy | bed4020 | 2017-07-13 15:09:52 +0200 | [diff] [blame] | 104 | static inline unsigned long get_msr(void) |
| 105 | { |
| 106 | unsigned long msr; |
| 107 | |
| 108 | asm volatile ("mfmsr %0" : "=r" (msr) : ); |
| 109 | |
| 110 | return msr; |
| 111 | } |
| 112 | |
| 113 | static inline void set_msr(unsigned long msr) |
| 114 | { |
| 115 | asm volatile ("mtmsr %0" : : "r" (msr)); |
| 116 | } |
| 117 | |
Christophe Leroy | 31f6e93 | 2017-07-13 15:09:54 +0200 | [diff] [blame] | 118 | #ifdef CONFIG_CMD_REGINFO |
| 119 | void print_reginfo(void); |
| 120 | #endif |
| 121 | |
Tom Rini | ce10398 | 2017-08-13 22:44:37 -0400 | [diff] [blame] | 122 | void interrupt_init_cpu(unsigned *); |
Christophe Leroy | 4a4750b | 2017-07-13 15:10:08 +0200 | [diff] [blame] | 123 | void timer_interrupt_cpu(struct pt_regs *); |
| 124 | unsigned long search_exception_table(unsigned long addr); |
| 125 | |
Simon Glass | 7613579 | 2017-05-17 08:23:05 -0600 | [diff] [blame] | 126 | #endif /* !__ASSEMBLY__ */ |
| 127 | |
Simon Glass | 243182c | 2017-05-17 08:23:06 -0600 | [diff] [blame] | 128 | #ifdef CONFIG_PPC |
| 129 | /* |
| 130 | * Has to be included outside of the #ifndef __ASSEMBLY__ section. |
| 131 | * Otherwise might lead to compilation errors in assembler files. |
| 132 | */ |
| 133 | #include <asm/cache.h> |
| 134 | #endif |
| 135 | |
Simon Glass | 7613579 | 2017-05-17 08:23:05 -0600 | [diff] [blame] | 136 | #endif |