blob: 5e0aa08be936e1b44b099ae6a9083c31610f6d9f [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 Leroy9b021ae2017-07-13 15:10:02 +020041#include <asm/processor.h>
42
Christophe Leroy069fa832017-07-06 10:23:22 +020043#if defined(CONFIG_8xx)
Christophe Leroy9b021ae2017-07-13 15:10:02 +020044static inline uint get_immr(uint mask)
45{
46 uint immr = mfspr(SPRN_IMMR);
47
48 return mask ? (immr & mask) : immr;
49}
Christophe Leroy069fa832017-07-06 10:23:22 +020050#endif
Christophe Leroy3d97f8e2017-07-13 15:10:06 +020051static inline uint get_pvr(void)
52{
53 return mfspr(PVR);
54}
55
56static inline uint get_svr(void)
57{
58 return mfspr(SVR);
59}
Simon Glass243182c2017-05-17 08:23:06 -060060
Heiko Schocher20280122017-06-27 16:49:14 +020061#if defined(CONFIG_MPC85xx) || \
Simon Glass243182c2017-05-17 08:23:06 -060062 defined(CONFIG_MPC86xx) || \
63 defined(CONFIG_MPC83xx)
64unsigned char in8(unsigned int);
65void out8(unsigned int, unsigned char);
66unsigned short in16(unsigned int);
67unsigned short in16r(unsigned int);
68void out16(unsigned int, unsigned short value);
69void out16r(unsigned int, unsigned short value);
70unsigned long in32(unsigned int);
71unsigned long in32r(unsigned int);
72void out32(unsigned int, unsigned long value);
73void out32r(unsigned int, unsigned long value);
74void ppcDcbf(unsigned long value);
75void ppcDcbi(unsigned long value);
76void ppcSync(void);
77void ppcDcbz(unsigned long value);
78#endif
79#if defined(CONFIG_MPC83xx)
80void ppcDWload(unsigned int *addr, unsigned int *ret);
81void ppcDWstore(unsigned int *addr, unsigned int *value);
82void disable_addr_trans(void);
83void enable_addr_trans(void);
84#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
85void ddr_enable_ecc(unsigned int dram_size);
86#endif
87#endif
88
Simon Glass243182c2017-05-17 08:23:06 -060089#if defined(CONFIG_MPC85xx)
90typedef MPC85xx_SYS_INFO sys_info_t;
91void get_sys_info(sys_info_t *);
92void ft_fixup_cpu(void *, u64);
93void ft_fixup_num_cores(void *);
94#endif
95#if defined(CONFIG_MPC86xx)
96ulong get_bus_freq(ulong);
97typedef MPC86xx_SYS_INFO sys_info_t;
98void get_sys_info(sys_info_t *);
99static inline ulong get_ddr_freq(ulong dummy)
100{
101 return get_bus_freq(dummy);
102}
103#else
104ulong get_ddr_freq(ulong);
105#endif
106
Christophe Leroybed40202017-07-13 15:09:52 +0200107static inline unsigned long get_msr(void)
108{
109 unsigned long msr;
110
111 asm volatile ("mfmsr %0" : "=r" (msr) : );
112
113 return msr;
114}
115
116static inline void set_msr(unsigned long msr)
117{
118 asm volatile ("mtmsr %0" : : "r" (msr));
119}
120
Christophe Leroy31f6e932017-07-13 15:09:54 +0200121#ifdef CONFIG_CMD_REGINFO
122void print_reginfo(void);
123#endif
124
Tom Rinice103982017-08-13 22:44:37 -0400125void interrupt_init_cpu(unsigned *);
Christophe Leroy4a4750b2017-07-13 15:10:08 +0200126void timer_interrupt_cpu(struct pt_regs *);
127unsigned long search_exception_table(unsigned long addr);
128
Simon Glass76135792017-05-17 08:23:05 -0600129#endif /* !__ASSEMBLY__ */
130
Simon Glass243182c2017-05-17 08:23:06 -0600131#ifdef CONFIG_PPC
132/*
133 * Has to be included outside of the #ifndef __ASSEMBLY__ section.
134 * Otherwise might lead to compilation errors in assembler files.
135 */
136#include <asm/cache.h>
137#endif
138
Simon Glass76135792017-05-17 08:23:05 -0600139#endif