blob: 2923350bd7b9209076a6f2796b2b83b7c0c738bd [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glass85043152017-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 Glass85043152017-05-17 08:23:05 -06008 */
9
10#ifndef __ASM_PPC_H
11#define __ASM_PPC_H
12
13#ifndef __ASSEMBLY__
14
Christophe Leroyee1e6002018-03-16 17:20:41 +010015#if defined(CONFIG_MPC8xx)
16#include <asm/immap_8xx.h>
Christophe Leroy907208c2017-07-06 10:23:22 +020017#endif
Simon Glass85043152017-05-17 08:23:05 -060018#ifdef CONFIG_MPC85xx
19#include <mpc85xx.h>
20#include <asm/immap_85xx.h>
21#endif
22#ifdef CONFIG_MPC83xx
23#include <mpc83xx.h>
24#include <asm/immap_83xx.h>
25#endif
Simon Glass85043152017-05-17 08:23:05 -060026#ifdef CONFIG_SOC_DA8XX
27#include <asm/arch/hardware.h>
28#endif
29#ifdef CONFIG_FSL_LSCH3
30#include <asm/arch/immap_lsch3.h>
31#endif
32#ifdef CONFIG_FSL_LSCH2
33#include <asm/arch/immap_lsch2.h>
34#endif
35
Christophe Leroy7fd697f2017-07-13 15:10:02 +020036#include <asm/processor.h>
37
Christophe Leroy0ebb5382018-03-16 17:20:39 +010038static inline uint get_immr(void)
Christophe Leroy7fd697f2017-07-13 15:10:02 +020039{
Christophe Leroy0ebb5382018-03-16 17:20:39 +010040 return mfspr(SPRN_IMMR);
Christophe Leroy7fd697f2017-07-13 15:10:02 +020041}
Christophe Leroy14119902018-03-16 17:20:37 +010042
Christophe Leroyba2c5a52017-07-13 15:10:06 +020043static inline uint get_pvr(void)
44{
45 return mfspr(PVR);
46}
47
48static inline uint get_svr(void)
49{
50 return mfspr(SVR);
51}
Simon Glass6e2941d2017-05-17 08:23:06 -060052
Heiko Schocher98f705c2017-06-27 16:49:14 +020053#if defined(CONFIG_MPC85xx) || \
Simon Glass6e2941d2017-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 Glass6e2941d2017-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 Leroyf1cd7362017-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
Christophe Leroyf3603b42017-07-13 15:09:54 +0200113#ifdef CONFIG_CMD_REGINFO
114void print_reginfo(void);
115#endif
116
Tom Rinideff9b12017-08-13 22:44:37 -0400117void interrupt_init_cpu(unsigned *);
Christophe Leroy08dd9882017-07-13 15:10:08 +0200118void timer_interrupt_cpu(struct pt_regs *);
119unsigned long search_exception_table(unsigned long addr);
Simon Glass6d1fdb12019-12-28 10:44:57 -0700120void upmconfig(uint upm, uint *table, uint size);
Christophe Leroy08dd9882017-07-13 15:10:08 +0200121
Simon Glass85043152017-05-17 08:23:05 -0600122#endif /* !__ASSEMBLY__ */
123
Simon Glass6e2941d2017-05-17 08:23:06 -0600124#ifdef CONFIG_PPC
125/*
126 * Has to be included outside of the #ifndef __ASSEMBLY__ section.
127 * Otherwise might lead to compilation errors in assembler files.
128 */
129#include <asm/cache.h>
130#endif
131
Simon Glass85043152017-05-17 08:23:05 -0600132#endif