xref: /rk3399_rockchip-uboot/arch/powerpc/include/asm/global_data.h (revision e9adeca3fc4fd9b353f2514daa7d799076ae079c)
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 {
32*e9adeca3SSimon Glass #if defined(CONFIG_FSL_ESDHC)
33*e9adeca3SSimon Glass 	u32 sdhc_clk;
34*e9adeca3SSimon Glass #endif
351206c184SSimon Glass #if defined(CONFIG_8xx)
361206c184SSimon Glass 	unsigned long brg_clk;
371206c184SSimon Glass #endif
381206c184SSimon Glass #if defined(CONFIG_CPM2)
39748cd059SSimon Glass 	/* There are many clocks on the MPC8260 - see page 9-5 */
40748cd059SSimon Glass 	unsigned long vco_out;
41748cd059SSimon Glass 	unsigned long cpm_clk;
42748cd059SSimon Glass 	unsigned long scc_clk;
431206c184SSimon Glass 	unsigned long 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 */
83609e6ec3SSimon Glass #if defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \
84609e6ec3SSimon Glass 		defined(CONFIG_MPC86xx)
85609e6ec3SSimon Glass 	u32 i2c1_clk;
86609e6ec3SSimon Glass 	u32 i2c2_clk;
87609e6ec3SSimon Glass #endif
8845bae2e3SSimon Glass #if defined(CONFIG_QE)
8945bae2e3SSimon Glass 	u32 qe_clk;
9045bae2e3SSimon Glass 	u32 brg_clk;
9145bae2e3SSimon Glass 	uint mp_alloc_base;
9245bae2e3SSimon Glass 	uint mp_alloc_top;
9345bae2e3SSimon Glass #endif /* CONFIG_QE */
948670dbc9SSimon Glass #if defined(CONFIG_FSL_LAW)
958670dbc9SSimon Glass 	u32 used_laws;
968670dbc9SSimon Glass #endif
977c80c6c5SSimon Glass #if defined(CONFIG_E500)
987c80c6c5SSimon Glass 	u32 used_tlb_cams[(CONFIG_SYS_NUM_TLBCAMS+31)/32];
997c80c6c5SSimon Glass #endif
100b2877496SSimon Glass #if defined(CONFIG_MPC5xxx)
101b2877496SSimon Glass 	unsigned long ipb_clk;
102b2877496SSimon Glass #endif
103fefb098bSSimon Glass #if defined(CONFIG_MPC512X)
104fefb098bSSimon Glass 	u32 ips_clk;
105fefb098bSSimon Glass 	u32 csb_clk;
106fefb098bSSimon Glass #endif /* CONFIG_MPC512X */
1071c356135SSimon Glass #if defined(CONFIG_MPC8220)
1081c356135SSimon Glass 	unsigned long inp_clk;
1091c356135SSimon Glass 	unsigned long vco_clk;
1101c356135SSimon Glass 	unsigned long pev_clk;
1111c356135SSimon Glass 	unsigned long flb_clk;
1121c356135SSimon Glass #endif
1133c4c308cSSimon Glass 	unsigned long reset_status;	/* reset status register at boot */
11443e60814SSimon Glass #if defined(CONFIG_MPC83xx)
11543e60814SSimon Glass 	unsigned long arbiter_event_attributes;
11643e60814SSimon Glass 	unsigned long arbiter_event_address;
11743e60814SSimon Glass #endif
1186bb9ba72SSimon Glass #if defined(CONFIG_SYS_ALLOC_DPRAM) || defined(CONFIG_CPM2)
1196bb9ba72SSimon Glass 	unsigned int dp_alloc_base;
1206bb9ba72SSimon Glass 	unsigned int dp_alloc_top;
1216bb9ba72SSimon Glass #endif
1223a1dc8f1SSimon Glass #if defined(CONFIG_4xx)
1233a1dc8f1SSimon Glass 	u32 uart_clk;
1243a1dc8f1SSimon Glass #endif /* CONFIG_4xx */
1257e15d6dbSSimon Glass #if defined(CONFIG_SYS_GT_6426x)
1267e15d6dbSSimon Glass 	unsigned int mirror_hack[16];
1277e15d6dbSSimon Glass #endif
128923a662fSSimon Glass #ifdef CONFIG_SYS_FPGA_COUNT
129923a662fSSimon Glass 	unsigned fpga_state[CONFIG_SYS_FPGA_COUNT];
130923a662fSSimon Glass #endif
131a0d3c820SSimon Glass #if defined(CONFIG_WD_MAX_RATE)
132a0d3c820SSimon Glass 	unsigned long long wdt_last;	/* trace watch-dog triggering rate */
133a0d3c820SSimon Glass #endif
134225ca83dSSimon Glass #if defined(CONFIG_LWMON) || defined(CONFIG_LWMON5)
135225ca83dSSimon Glass 	unsigned long kbd_status;
136225ca83dSSimon Glass #endif
137c6731fe2SSimon Glass };
138c6731fe2SSimon Glass 
139c6731fe2SSimon Glass /*
140c6731fe2SSimon Glass  * The following data structure is placed in some memory wich is
141c6731fe2SSimon Glass  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
142c6731fe2SSimon Glass  * some locked parts of the data cache) to allow for a minimum set of
143c6731fe2SSimon Glass  * global variables during system initialization (until we have set
144c6731fe2SSimon Glass  * up the memory controller so that we can use RAM).
145c6731fe2SSimon Glass  */
146c6731fe2SSimon Glass 
147c6731fe2SSimon Glass typedef	struct	global_data {
148c6731fe2SSimon Glass 	bd_t		*bd;
149c6731fe2SSimon Glass 	unsigned long	flags;
150c6731fe2SSimon Glass 	unsigned int	baudrate;
151c6731fe2SSimon Glass 	unsigned long	cpu_clk;	/* CPU clock in Hz! */
152c6731fe2SSimon Glass 	unsigned long	bus_clk;
153c6731fe2SSimon Glass 	/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
154c6731fe2SSimon Glass 	unsigned long pci_clk;
155c6731fe2SSimon Glass 	unsigned long   mem_clk;
156a47a12beSStefan Roese 	phys_size_t	ram_size;	/* RAM size */
157a47a12beSStefan Roese 	unsigned long	env_addr;	/* Address  of Environment struct	*/
158a47a12beSStefan Roese 	unsigned long	env_valid;	/* Checksum of Environment valid?	*/
159a47a12beSStefan Roese 	unsigned long	have_console;	/* serial_init() was called		*/
1609558b48aSGraeme Russ #ifdef CONFIG_PRE_CONSOLE_BUFFER
1619558b48aSGraeme Russ 	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
1629558b48aSGraeme Russ #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 	void		**jt;		/* jump table */
18091a76751SWolfgang Denk 	char		env_buf[32];	/* buffer for getenv() before reloc. */
1815cb48582SSimon Glass 	struct arch_global_data arch;	/* architecture-specific data */
182a47a12beSStefan Roese } gd_t;
183a47a12beSStefan Roese 
18447fde91fSMike Frysinger #include <asm-generic/global_data_flags.h>
185a47a12beSStefan Roese 
186a47a12beSStefan Roese #if 1
187a47a12beSStefan Roese #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
188a47a12beSStefan Roese #else /* We could use plain global data, but the resulting code is bigger */
189a47a12beSStefan Roese #define XTRN_DECLARE_GLOBAL_DATA_PTR	extern
190a47a12beSStefan Roese #define DECLARE_GLOBAL_DATA_PTR     XTRN_DECLARE_GLOBAL_DATA_PTR \
191a47a12beSStefan Roese 				    gd_t *gd
192a47a12beSStefan Roese #endif
193a47a12beSStefan Roese 
194a47a12beSStefan Roese #endif /* __ASM_GBL_DATA_H */
195