blob: 055364c58fd94ab8b47e1e6c2778f43c0f40587c [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glass76135792017-05-17 08:23:05 -06002/*
3 * Ugly header containing required header files. This could be adjusted
4 * so that including asm/arch/hardware includes the correct file.
5 *
6 * (C) Copyright 2000-2009
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Simon Glass76135792017-05-17 08:23:05 -06008 */
9
10#ifndef __ASM_PPC_H
11#define __ASM_PPC_H
12
13#ifndef __ASSEMBLY__
14
Christophe Leroyb3510fb2018-03-16 17:20:41 +010015#if defined(CONFIG_MPC8xx)
16#include <asm/immap_8xx.h>
Christophe Leroy069fa832017-07-06 10:23:22 +020017#endif
Simon Glass76135792017-05-17 08:23:05 -060018#ifdef CONFIG_MPC86xx
19#include <mpc86xx.h>
20#include <asm/immap_86xx.h>
21#endif
22#ifdef CONFIG_MPC85xx
23#include <mpc85xx.h>
24#include <asm/immap_85xx.h>
25#endif
26#ifdef CONFIG_MPC83xx
27#include <mpc83xx.h>
28#include <asm/immap_83xx.h>
29#endif
Simon Glass76135792017-05-17 08:23:05 -060030#ifdef CONFIG_SOC_DA8XX
31#include <asm/arch/hardware.h>
32#endif
33#ifdef CONFIG_FSL_LSCH3
34#include <asm/arch/immap_lsch3.h>
35#endif
36#ifdef CONFIG_FSL_LSCH2
37#include <asm/arch/immap_lsch2.h>
38#endif
39
Christophe Leroy9b021ae2017-07-13 15:10:02 +020040#include <asm/processor.h>
41
Christophe Leroybda89472018-03-16 17:20:39 +010042static inline uint get_immr(void)
Christophe Leroy9b021ae2017-07-13 15:10:02 +020043{
Christophe Leroybda89472018-03-16 17:20:39 +010044 return mfspr(SPRN_IMMR);
Christophe Leroy9b021ae2017-07-13 15:10:02 +020045}
Christophe Leroyedd4ebe2018-03-16 17:20:37 +010046
Christophe Leroy3d97f8e2017-07-13 15:10:06 +020047static inline uint get_pvr(void)
48{
49 return mfspr(PVR);
50}
51
52static inline uint get_svr(void)
53{
54 return mfspr(SVR);
55}
Simon Glass243182c2017-05-17 08:23:06 -060056
Heiko Schocher20280122017-06-27 16:49:14 +020057#if defined(CONFIG_MPC85xx) || \
Simon Glass243182c2017-05-17 08:23:06 -060058 defined(CONFIG_MPC86xx) || \
59 defined(CONFIG_MPC83xx)
60unsigned char in8(unsigned int);
61void out8(unsigned int, unsigned char);
62unsigned short in16(unsigned int);
63unsigned short in16r(unsigned int);
64void out16(unsigned int, unsigned short value);
65void out16r(unsigned int, unsigned short value);
66unsigned long in32(unsigned int);
67unsigned long in32r(unsigned int);
68void out32(unsigned int, unsigned long value);
69void out32r(unsigned int, unsigned long value);
70void ppcDcbf(unsigned long value);
71void ppcDcbi(unsigned long value);
72void ppcSync(void);
73void ppcDcbz(unsigned long value);
74#endif
75#if defined(CONFIG_MPC83xx)
76void ppcDWload(unsigned int *addr, unsigned int *ret);
77void ppcDWstore(unsigned int *addr, unsigned int *value);
78void disable_addr_trans(void);
79void enable_addr_trans(void);
80#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
81void ddr_enable_ecc(unsigned int dram_size);
82#endif
83#endif
84
Simon Glass243182c2017-05-17 08:23:06 -060085#if defined(CONFIG_MPC85xx)
86typedef MPC85xx_SYS_INFO sys_info_t;
87void get_sys_info(sys_info_t *);
88void ft_fixup_cpu(void *, u64);
89void ft_fixup_num_cores(void *);
90#endif
91#if defined(CONFIG_MPC86xx)
92ulong get_bus_freq(ulong);
93typedef MPC86xx_SYS_INFO sys_info_t;
94void get_sys_info(sys_info_t *);
95static inline ulong get_ddr_freq(ulong dummy)
96{
97 return get_bus_freq(dummy);
98}
99#else
100ulong get_ddr_freq(ulong);
101#endif
102
Christophe Leroybed40202017-07-13 15:09:52 +0200103static inline unsigned long get_msr(void)
104{
105 unsigned long msr;
106
107 asm volatile ("mfmsr %0" : "=r" (msr) : );
108
109 return msr;
110}
111
112static inline void set_msr(unsigned long msr)
113{
114 asm volatile ("mtmsr %0" : : "r" (msr));
115}
116
Christophe Leroy31f6e932017-07-13 15:09:54 +0200117#ifdef CONFIG_CMD_REGINFO
118void print_reginfo(void);
119#endif
120
Tom Rinice103982017-08-13 22:44:37 -0400121void interrupt_init_cpu(unsigned *);
Christophe Leroy4a4750b2017-07-13 15:10:08 +0200122void timer_interrupt_cpu(struct pt_regs *);
123unsigned long search_exception_table(unsigned long addr);
Simon Glass4be8fc92019-12-28 10:44:57 -0700124void upmconfig(uint upm, uint *table, uint size);
Christophe Leroy4a4750b2017-07-13 15:10:08 +0200125
Simon Glass76135792017-05-17 08:23:05 -0600126#endif /* !__ASSEMBLY__ */
127
Simon Glass243182c2017-05-17 08:23:06 -0600128#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 Glass76135792017-05-17 08:23:05 -0600136#endif