blob: 89f08eccc7be72240aea4b08e2e0902baa5bee0d [file] [log] [blame]
Simon Glass76135792017-05-17 08:23:05 -06001/*
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 Leroy069fa832017-07-06 10:23:22 +020016#if defined(CONFIG_8xx)
17#include <asm/8xx_immap.h>
Christophe Leroy069fa832017-07-06 10:23:22 +020018#endif
Simon Glass76135792017-05-17 08:23:05 -060019#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 Glass76135792017-05-17 08:23:05 -060031#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 Leroy069fa832017-07-06 10:23:22 +020041#if defined(CONFIG_8xx)
42uint get_immr(uint);
43#endif
Simon Glass243182c2017-05-17 08:23:06 -060044uint get_pvr(void);
45uint get_svr(void);
46uint rd_ic_cst(void);
47void wr_ic_cst(uint);
48void wr_ic_adr(uint);
49uint rd_dc_cst(void);
50void wr_dc_cst(uint);
51void wr_dc_adr(uint);
52
Heiko Schocher20280122017-06-27 16:49:14 +020053#if defined(CONFIG_MPC85xx) || \
Simon Glass243182c2017-05-17 08:23:06 -060054 defined(CONFIG_MPC86xx) || \
55 defined(CONFIG_MPC83xx)
56unsigned char in8(unsigned int);
57void out8(unsigned int, unsigned char);
58unsigned short in16(unsigned int);
59unsigned short in16r(unsigned int);
60void out16(unsigned int, unsigned short value);
61void out16r(unsigned int, unsigned short value);
62unsigned long in32(unsigned int);
63unsigned long in32r(unsigned int);
64void out32(unsigned int, unsigned long value);
65void out32r(unsigned int, unsigned long value);
66void ppcDcbf(unsigned long value);
67void ppcDcbi(unsigned long value);
68void ppcSync(void);
69void ppcDcbz(unsigned long value);
70#endif
71#if defined(CONFIG_MPC83xx)
72void ppcDWload(unsigned int *addr, unsigned int *ret);
73void ppcDWstore(unsigned int *addr, unsigned int *value);
74void disable_addr_trans(void);
75void enable_addr_trans(void);
76#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
77void ddr_enable_ecc(unsigned int dram_size);
78#endif
79#endif
80
Simon Glass243182c2017-05-17 08:23:06 -060081#if defined(CONFIG_MPC85xx)
82typedef MPC85xx_SYS_INFO sys_info_t;
83void get_sys_info(sys_info_t *);
84void ft_fixup_cpu(void *, u64);
85void ft_fixup_num_cores(void *);
86#endif
87#if defined(CONFIG_MPC86xx)
88ulong get_bus_freq(ulong);
89typedef MPC86xx_SYS_INFO sys_info_t;
90void get_sys_info(sys_info_t *);
91static inline ulong get_ddr_freq(ulong dummy)
92{
93 return get_bus_freq(dummy);
94}
95#else
96ulong get_ddr_freq(ulong);
97#endif
98
Christophe Leroybed40202017-07-13 15:09:52 +020099static inline unsigned long get_msr(void)
100{
101 unsigned long msr;
102
103 asm volatile ("mfmsr %0" : "=r" (msr) : );
104
105 return msr;
106}
107
108static inline void set_msr(unsigned long msr)
109{
110 asm volatile ("mtmsr %0" : : "r" (msr));
111}
112
Simon Glass76135792017-05-17 08:23:05 -0600113#endif /* !__ASSEMBLY__ */
114
Simon Glass243182c2017-05-17 08:23:06 -0600115#ifdef CONFIG_PPC
116/*
117 * Has to be included outside of the #ifndef __ASSEMBLY__ section.
118 * Otherwise might lead to compilation errors in assembler files.
119 */
120#include <asm/cache.h>
121#endif
122
Simon Glass76135792017-05-17 08:23:05 -0600123#endif