]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/powerpc/include/asm/ppc.h
powerpc, 8xx: move cache helper into C
[people/ms/u-boot.git] / arch / powerpc / include / asm / ppc.h
CommitLineData
85043159
SG
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
907208c4
CL
16#if defined(CONFIG_8xx)
17#include <asm/8xx_immap.h>
907208c4 18#endif
85043159
SG
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
85043159
SG
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
7fd697fd
CL
41#include <asm/processor.h>
42
907208c4 43#if defined(CONFIG_8xx)
7fd697fd
CL
44static inline uint get_immr(uint mask)
45{
46 uint immr = mfspr(SPRN_IMMR);
47
48 return mask ? (immr & mask) : immr;
49}
907208c4 50#endif
6e2941d7
SG
51uint get_pvr(void);
52uint get_svr(void);
6e2941d7 53
98f705c9 54#if defined(CONFIG_MPC85xx) || \
6e2941d7
SG
55 defined(CONFIG_MPC86xx) || \
56 defined(CONFIG_MPC83xx)
57unsigned char in8(unsigned int);
58void out8(unsigned int, unsigned char);
59unsigned short in16(unsigned int);
60unsigned short in16r(unsigned int);
61void out16(unsigned int, unsigned short value);
62void out16r(unsigned int, unsigned short value);
63unsigned long in32(unsigned int);
64unsigned long in32r(unsigned int);
65void out32(unsigned int, unsigned long value);
66void out32r(unsigned int, unsigned long value);
67void ppcDcbf(unsigned long value);
68void ppcDcbi(unsigned long value);
69void ppcSync(void);
70void ppcDcbz(unsigned long value);
71#endif
72#if defined(CONFIG_MPC83xx)
73void ppcDWload(unsigned int *addr, unsigned int *ret);
74void ppcDWstore(unsigned int *addr, unsigned int *value);
75void disable_addr_trans(void);
76void enable_addr_trans(void);
77#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
78void ddr_enable_ecc(unsigned int dram_size);
79#endif
80#endif
81
6e2941d7
SG
82#if defined(CONFIG_MPC85xx)
83typedef MPC85xx_SYS_INFO sys_info_t;
84void get_sys_info(sys_info_t *);
85void ft_fixup_cpu(void *, u64);
86void ft_fixup_num_cores(void *);
87#endif
88#if defined(CONFIG_MPC86xx)
89ulong get_bus_freq(ulong);
90typedef MPC86xx_SYS_INFO sys_info_t;
91void get_sys_info(sys_info_t *);
92static inline ulong get_ddr_freq(ulong dummy)
93{
94 return get_bus_freq(dummy);
95}
96#else
97ulong get_ddr_freq(ulong);
98#endif
99
f1cd7367
CL
100static inline unsigned long get_msr(void)
101{
102 unsigned long msr;
103
104 asm volatile ("mfmsr %0" : "=r" (msr) : );
105
106 return msr;
107}
108
109static inline void set_msr(unsigned long msr)
110{
111 asm volatile ("mtmsr %0" : : "r" (msr));
112}
113
f3603b43
CL
114#ifdef CONFIG_CMD_REGINFO
115void print_reginfo(void);
116#endif
117
85043159
SG
118#endif /* !__ASSEMBLY__ */
119
6e2941d7
SG
120#ifdef CONFIG_PPC
121/*
122 * Has to be included outside of the #ifndef __ASSEMBLY__ section.
123 * Otherwise might lead to compilation errors in assembler files.
124 */
125#include <asm/cache.h>
126#endif
127
85043159 128#endif