xref: /rk3399_rockchip-uboot/arch/powerpc/include/asm/global_data.h (revision 609e6ec3f623f3c3aa2a056654fbc5886e092897)
1a47a12beSStefan Roese /*
291a76751SWolfgang Denk  * (C) Copyright 2002-2010
3a47a12beSStefan Roese  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4a47a12beSStefan Roese  *
5a47a12beSStefan Roese  * See file CREDITS for list of people who contributed to this
6a47a12beSStefan Roese  * project.
7a47a12beSStefan Roese  *
8a47a12beSStefan Roese  * This program is free software; you can redistribute it and/or
9a47a12beSStefan Roese  * modify it under the terms of the GNU General Public License as
10a47a12beSStefan Roese  * published by the Free Software Foundation; either version 2 of
11a47a12beSStefan Roese  * the License, or (at your option) any later version.
12a47a12beSStefan Roese  *
13a47a12beSStefan Roese  * This program is distributed in the hope that it will be useful,
14a47a12beSStefan Roese  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15a47a12beSStefan Roese  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16a47a12beSStefan Roese  * GNU General Public License for more details.
17a47a12beSStefan Roese  *
18a47a12beSStefan Roese  * You should have received a copy of the GNU General Public License
19a47a12beSStefan Roese  * along with this program; if not, write to the Free Software
20a47a12beSStefan Roese  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21a47a12beSStefan Roese  * MA 02111-1307 USA
22a47a12beSStefan Roese  */
23a47a12beSStefan Roese 
24a47a12beSStefan Roese #ifndef	__ASM_GBL_DATA_H
25a47a12beSStefan Roese #define __ASM_GBL_DATA_H
26a47a12beSStefan Roese 
27a47a12beSStefan Roese #include "config.h"
28a47a12beSStefan Roese #include "asm/types.h"
29a47a12beSStefan Roese 
305cb48582SSimon Glass /* Architecture-specific global data */
315cb48582SSimon Glass struct arch_global_data {
321206c184SSimon Glass #if defined(CONFIG_8xx)
331206c184SSimon Glass 	unsigned long brg_clk;
341206c184SSimon Glass #endif
351206c184SSimon Glass #if defined(CONFIG_CPM2)
36748cd059SSimon Glass 	/* There are many clocks on the MPC8260 - see page 9-5 */
37748cd059SSimon Glass 	unsigned long vco_out;
38748cd059SSimon Glass 	unsigned long cpm_clk;
39748cd059SSimon Glass 	unsigned long scc_clk;
401206c184SSimon Glass 	unsigned long brg_clk;
411206c184SSimon Glass #endif
421206c184SSimon Glass #if defined(CONFIG_QE)
431206c184SSimon Glass 	u32 brg_clk;
441206c184SSimon Glass #endif
45c6731fe2SSimon Glass 	/* TODO: sjg@chromium.org: Should these be unslgned long? */
46a47a12beSStefan Roese #if defined(CONFIG_MPC83xx)
47a47a12beSStefan Roese 	/* There are other clocks in the MPC83XX */
48a47a12beSStefan Roese 	u32 csb_clk;
497c619ddcSIlya Yanok # if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
507c619ddcSIlya Yanok 	defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x)
51a47a12beSStefan Roese 	u32 tsec1_clk;
52a47a12beSStefan Roese 	u32 tsec2_clk;
53a47a12beSStefan Roese 	u32 usbdr_clk;
54a88731a6SGerlando Falauto # elif defined(CONFIG_MPC8309)
55a88731a6SGerlando Falauto 	u32 usbdr_clk;
56a47a12beSStefan Roese # endif
57a47a12beSStefan Roese # if defined(CONFIG_MPC834x)
58a47a12beSStefan Roese 	u32 usbmph_clk;
59a47a12beSStefan Roese # endif /* CONFIG_MPC834x */
60a47a12beSStefan Roese # if defined(CONFIG_MPC8315)
61a47a12beSStefan Roese 	u32 tdm_clk;
62a47a12beSStefan Roese # endif
63a47a12beSStefan Roese 	u32 core_clk;
64a47a12beSStefan Roese 	u32 enc_clk;
65a47a12beSStefan Roese 	u32 lbiu_clk;
66a47a12beSStefan Roese 	u32 lclk_clk;
677c619ddcSIlya Yanok # if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
687c619ddcSIlya Yanok 	defined(CONFIG_MPC837x)
69a47a12beSStefan Roese 	u32 pciexp1_clk;
70a47a12beSStefan Roese 	u32 pciexp2_clk;
71a47a12beSStefan Roese # endif
72a47a12beSStefan Roese # if defined(CONFIG_MPC837x) || defined(CONFIG_MPC8315)
73a47a12beSStefan Roese 	u32 sata_clk;
74a47a12beSStefan Roese # endif
75a47a12beSStefan Roese # if defined(CONFIG_MPC8360)
76a47a12beSStefan Roese 	u32 mem_sec_clk;
77a47a12beSStefan Roese # endif /* CONFIG_MPC8360 */
78a47a12beSStefan Roese #endif
7967ac13b1SSimon Glass #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
8067ac13b1SSimon Glass 	u32 lbc_clk;
8167ac13b1SSimon Glass 	void *cpu;
8267ac13b1SSimon Glass #endif /* CONFIG_MPC85xx || CONFIG_MPC86xx */
83*609e6ec3SSimon Glass #if defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \
84*609e6ec3SSimon Glass 		defined(CONFIG_MPC86xx)
85*609e6ec3SSimon Glass 	u32 i2c1_clk;
86*609e6ec3SSimon Glass 	u32 i2c2_clk;
87*609e6ec3SSimon Glass #endif
88c6731fe2SSimon Glass };
89c6731fe2SSimon Glass 
90c6731fe2SSimon Glass /*
91c6731fe2SSimon Glass  * The following data structure is placed in some memory wich is
92c6731fe2SSimon Glass  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
93c6731fe2SSimon Glass  * some locked parts of the data cache) to allow for a minimum set of
94c6731fe2SSimon Glass  * global variables during system initialization (until we have set
95c6731fe2SSimon Glass  * up the memory controller so that we can use RAM).
96c6731fe2SSimon Glass  */
97c6731fe2SSimon Glass 
98c6731fe2SSimon Glass typedef	struct	global_data {
99c6731fe2SSimon Glass 	bd_t		*bd;
100c6731fe2SSimon Glass 	unsigned long	flags;
101c6731fe2SSimon Glass 	unsigned int	baudrate;
102c6731fe2SSimon Glass 	unsigned long	cpu_clk;	/* CPU clock in Hz! */
103c6731fe2SSimon Glass 	unsigned long	bus_clk;
104c6731fe2SSimon Glass 	/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
105c6731fe2SSimon Glass 	unsigned long pci_clk;
106c6731fe2SSimon Glass 	unsigned long   mem_clk;
107a47a12beSStefan Roese #if defined(CONFIG_FSL_ESDHC)
108a47a12beSStefan Roese 	u32 sdhc_clk;
109a47a12beSStefan Roese #endif
110a47a12beSStefan Roese #if defined(CONFIG_QE)
111a47a12beSStefan Roese 	u32 qe_clk;
112a47a12beSStefan Roese 	uint mp_alloc_base;
113a47a12beSStefan Roese 	uint mp_alloc_top;
114a47a12beSStefan Roese #endif /* CONFIG_QE */
115a47a12beSStefan Roese #if defined(CONFIG_FSL_LAW)
116a47a12beSStefan Roese 	u32 used_laws;
117a47a12beSStefan Roese #endif
118a47a12beSStefan Roese #if defined(CONFIG_E500)
119a47a12beSStefan Roese 	u32 used_tlb_cams[(CONFIG_SYS_NUM_TLBCAMS+31)/32];
120a47a12beSStefan Roese #endif
121a47a12beSStefan Roese #if defined(CONFIG_MPC5xxx)
122a47a12beSStefan Roese 	unsigned long	ipb_clk;
123a47a12beSStefan Roese #endif
124a47a12beSStefan Roese #if defined(CONFIG_MPC512X)
125a47a12beSStefan Roese 	u32 ips_clk;
126a47a12beSStefan Roese 	u32 csb_clk;
127a47a12beSStefan Roese #endif /* CONFIG_MPC512X */
128a47a12beSStefan Roese #if defined(CONFIG_MPC8220)
129a47a12beSStefan Roese 	unsigned long   bExtUart;
130a47a12beSStefan Roese 	unsigned long   inp_clk;
131a47a12beSStefan Roese 	unsigned long   vco_clk;
132a47a12beSStefan Roese 	unsigned long   pev_clk;
133a47a12beSStefan Roese 	unsigned long   flb_clk;
134a47a12beSStefan Roese #endif
135a47a12beSStefan Roese 	phys_size_t	ram_size;	/* RAM size */
136a47a12beSStefan Roese 	unsigned long	reset_status;	/* reset status register at boot	*/
137a47a12beSStefan Roese #if defined(CONFIG_MPC83xx)
138a47a12beSStefan Roese 	unsigned long	arbiter_event_attributes;
139a47a12beSStefan Roese 	unsigned long	arbiter_event_address;
140a47a12beSStefan Roese #endif
141a47a12beSStefan Roese 	unsigned long	env_addr;	/* Address  of Environment struct	*/
142a47a12beSStefan Roese 	unsigned long	env_valid;	/* Checksum of Environment valid?	*/
143a47a12beSStefan Roese 	unsigned long	have_console;	/* serial_init() was called		*/
1449558b48aSGraeme Russ #ifdef CONFIG_PRE_CONSOLE_BUFFER
1459558b48aSGraeme Russ 	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
1469558b48aSGraeme Russ #endif
147a47a12beSStefan Roese #if defined(CONFIG_SYS_ALLOC_DPRAM) || defined(CONFIG_CPM2)
148a47a12beSStefan Roese 	unsigned int	dp_alloc_base;
149a47a12beSStefan Roese 	unsigned int	dp_alloc_top;
150a47a12beSStefan Roese #endif
151a47a12beSStefan Roese #if defined(CONFIG_4xx)
152a47a12beSStefan Roese 	u32  uart_clk;
153a47a12beSStefan Roese #endif /* CONFIG_4xx */
154a47a12beSStefan Roese #if defined(CONFIG_SYS_GT_6426x)
155a47a12beSStefan Roese 	unsigned int	mirror_hack[16];
156a47a12beSStefan Roese #endif
157a47a12beSStefan Roese #if defined(CONFIG_A3000)	|| \
158a47a12beSStefan Roese     defined(CONFIG_HIDDEN_DRAGON)  || \
159a47a12beSStefan Roese     defined(CONFIG_MUSENKI)	||  \
160a47a12beSStefan Roese     defined(CONFIG_SANDPOINT)
161a47a12beSStefan Roese 	void *		console_addr;
162a47a12beSStefan Roese #endif
163a47a12beSStefan Roese 	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
164a47a12beSStefan Roese #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
165a47a12beSStefan Roese 	unsigned long	fb_base;	/* Base address of framebuffer memory	*/
166a47a12beSStefan Roese #endif
167a47a12beSStefan Roese #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
168a47a12beSStefan Roese 	unsigned long	post_log_word;  /* Record POST activities */
16979843950SValentin Longchamp 	unsigned long	post_log_res; /* success of POST test */
170a47a12beSStefan Roese 	unsigned long	post_init_f_time;  /* When post_init_f started */
171a47a12beSStefan Roese #endif
172a47a12beSStefan Roese #ifdef CONFIG_BOARD_TYPES
173a47a12beSStefan Roese 	unsigned long	board_type;
174a47a12beSStefan Roese #endif
175a47a12beSStefan Roese #ifdef CONFIG_MODEM_SUPPORT
176a47a12beSStefan Roese 	unsigned long do_mdm_init;
177a47a12beSStefan Roese 	unsigned long be_quiet;
178a47a12beSStefan Roese #endif
179a47a12beSStefan Roese #if defined(CONFIG_LWMON) || defined(CONFIG_LWMON5)
180a47a12beSStefan Roese 	unsigned long kbd_status;
181a47a12beSStefan Roese #endif
1822da0fc0dSDirk Eibach #ifdef CONFIG_SYS_FPGA_COUNT
1832da0fc0dSDirk Eibach 	unsigned fpga_state[CONFIG_SYS_FPGA_COUNT];
1842da0fc0dSDirk Eibach #endif
185a47a12beSStefan Roese #if defined(CONFIG_WD_MAX_RATE)
186a47a12beSStefan Roese 	unsigned long long wdt_last;	/* trace watch-dog triggering rate */
187a47a12beSStefan Roese #endif
188a47a12beSStefan Roese 	void		**jt;		/* jump table */
18991a76751SWolfgang Denk 	char		env_buf[32];	/* buffer for getenv() before reloc. */
1905cb48582SSimon Glass 	struct arch_global_data arch;	/* architecture-specific data */
191a47a12beSStefan Roese } gd_t;
192a47a12beSStefan Roese 
19347fde91fSMike Frysinger #include <asm-generic/global_data_flags.h>
194a47a12beSStefan Roese 
195a47a12beSStefan Roese #if 1
196a47a12beSStefan Roese #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
197a47a12beSStefan Roese #else /* We could use plain global data, but the resulting code is bigger */
198a47a12beSStefan Roese #define XTRN_DECLARE_GLOBAL_DATA_PTR	extern
199a47a12beSStefan Roese #define DECLARE_GLOBAL_DATA_PTR     XTRN_DECLARE_GLOBAL_DATA_PTR \
200a47a12beSStefan Roese 				    gd_t *gd
201a47a12beSStefan Roese #endif
202a47a12beSStefan Roese 
203a47a12beSStefan Roese #endif /* __ASM_GBL_DATA_H */
204