xref: /rk3399_rockchip-uboot/include/asm-generic/global_data.h (revision 8f9052fd98e2e97e33b0e5ccf57f028e595abb5d)
150b1fa39SSimon Glass /*
250b1fa39SSimon Glass  * Copyright (c) 2012 The Chromium OS Authors.
350b1fa39SSimon Glass  * (C) Copyright 2002-2010
450b1fa39SSimon Glass  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
550b1fa39SSimon Glass  *
61a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
750b1fa39SSimon Glass  */
850b1fa39SSimon Glass 
950b1fa39SSimon Glass #ifndef __ASM_GENERIC_GBL_DATA_H
1050b1fa39SSimon Glass #define __ASM_GENERIC_GBL_DATA_H
1150b1fa39SSimon Glass /*
1250b1fa39SSimon Glass  * The following data structure is placed in some memory which is
1350b1fa39SSimon Glass  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
1450b1fa39SSimon Glass  * some locked parts of the data cache) to allow for a minimum set of
1550b1fa39SSimon Glass  * global variables during system initialization (until we have set
1650b1fa39SSimon Glass  * up the memory controller so that we can use RAM).
1750b1fa39SSimon Glass  *
1850b1fa39SSimon Glass  * Keep it *SMALL* and remember to set GENERATED_GBL_DATA_SIZE > sizeof(gd_t)
1950b1fa39SSimon Glass  *
2050b1fa39SSimon Glass  * Each architecture has its own private fields. For now all are private
2150b1fa39SSimon Glass  */
2250b1fa39SSimon Glass 
2350b1fa39SSimon Glass #ifndef __ASSEMBLY__
246494d708SSimon Glass #include <linux/list.h>
256494d708SSimon Glass 
2650b1fa39SSimon Glass typedef struct global_data {
2750b1fa39SSimon Glass 	bd_t *bd;
2850b1fa39SSimon Glass 	unsigned long flags;
29b5bec884SSimon Glass 	unsigned int baudrate;
3050b1fa39SSimon Glass 	unsigned long cpu_clk;	/* CPU clock in Hz!		*/
3150b1fa39SSimon Glass 	unsigned long bus_clk;
3250b1fa39SSimon Glass 	/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
3350b1fa39SSimon Glass 	unsigned long pci_clk;
3450b1fa39SSimon Glass 	unsigned long mem_clk;
3550b1fa39SSimon Glass #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
3650b1fa39SSimon Glass 	unsigned long fb_base;	/* Base address of framebuffer mem */
3750b1fa39SSimon Glass #endif
3850b1fa39SSimon Glass #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
3950b1fa39SSimon Glass 	unsigned long post_log_word;  /* Record POST activities */
4050b1fa39SSimon Glass 	unsigned long post_log_res; /* success of POST test */
4150b1fa39SSimon Glass 	unsigned long post_init_f_time;  /* When post_init_f started */
4250b1fa39SSimon Glass #endif
4350b1fa39SSimon Glass #ifdef CONFIG_BOARD_TYPES
4450b1fa39SSimon Glass 	unsigned long board_type;
4550b1fa39SSimon Glass #endif
4650b1fa39SSimon Glass 	unsigned long have_console;	/* serial_init() was called */
4750b1fa39SSimon Glass #ifdef CONFIG_PRE_CONSOLE_BUFFER
4850b1fa39SSimon Glass 	unsigned long precon_buf_idx;	/* Pre-Console buffer index */
4950b1fa39SSimon Glass #endif
5050b1fa39SSimon Glass #ifdef CONFIG_MODEM_SUPPORT
5150b1fa39SSimon Glass 	unsigned long do_mdm_init;
5250b1fa39SSimon Glass 	unsigned long be_quiet;
5350b1fa39SSimon Glass #endif
5450b1fa39SSimon Glass 	unsigned long env_addr;	/* Address  of Environment struct */
5550b1fa39SSimon Glass 	unsigned long env_valid;	/* Checksum of Environment valid? */
5650b1fa39SSimon Glass 
5750b1fa39SSimon Glass 	unsigned long ram_top;	/* Top address of RAM used by U-Boot */
5850b1fa39SSimon Glass 
5950b1fa39SSimon Glass 	unsigned long relocaddr;	/* Start address of U-Boot in RAM */
6050b1fa39SSimon Glass 	phys_size_t ram_size;	/* RAM size */
6150b1fa39SSimon Glass 	unsigned long mon_len;	/* monitor len */
6250b1fa39SSimon Glass 	unsigned long irq_sp;		/* irq stack pointer */
6350b1fa39SSimon Glass 	unsigned long start_addr_sp;	/* start_addr_stackpointer */
6450b1fa39SSimon Glass 	unsigned long reloc_off;
6550b1fa39SSimon Glass 	struct global_data *new_gd;	/* relocated global data */
666494d708SSimon Glass 
676494d708SSimon Glass #ifdef CONFIG_DM
6854c5d08aSHeiko Schocher 	struct udevice	*dm_root;	/* Root instance for Driver Model */
69ab7cd627SSimon Glass 	struct udevice	*dm_root_f;	/* Pre-relocation root instance */
706494d708SSimon Glass 	struct list_head uclass_root;	/* Head of core tree */
716494d708SSimon Glass #endif
726494d708SSimon Glass 
7350b1fa39SSimon Glass 	const void *fdt_blob;	/* Our device tree, NULL if none */
741938f4a5SSimon Glass 	void *new_fdt;		/* Relocated FDT */
751938f4a5SSimon Glass 	unsigned long fdt_size;	/* Space reserved for relocated FDT */
7650b1fa39SSimon Glass 	void **jt;		/* jump table */
7750b1fa39SSimon Glass 	char env_buf[32];	/* buffer for getenv() before reloc. */
7871c52dbaSSimon Glass #ifdef CONFIG_TRACE
7971c52dbaSSimon Glass 	void		*trace_buff;	/* The trace buffer */
8071c52dbaSSimon Glass #endif
81385c9ef5SHeiko Schocher #if defined(CONFIG_SYS_I2C)
82385c9ef5SHeiko Schocher 	int		cur_i2c_bus;	/* current used i2c bus */
83385c9ef5SHeiko Schocher #endif
84dec1861bSYork Sun #ifdef CONFIG_SYS_I2C_MXC
85dec1861bSYork Sun 	void *srdata[10];
86dec1861bSYork Sun #endif
878dfafddeSRob Herring 	unsigned long timebase_h;
888dfafddeSRob Herring 	unsigned long timebase_l;
89d59476b6SSimon Glass #ifdef CONFIG_SYS_MALLOC_F_LEN
90d59476b6SSimon Glass 	unsigned long malloc_base;	/* base address of early malloc() */
91d59476b6SSimon Glass 	unsigned long malloc_limit;	/* limit address */
92d59476b6SSimon Glass 	unsigned long malloc_ptr;	/* current address */
93d59476b6SSimon Glass #endif
94*8f9052fdSBin Meng #ifdef CONFIG_PCI
95*8f9052fdSBin Meng 	struct pci_controller *hose;	/* PCI hose for early use */
96*8f9052fdSBin Meng #endif
97*8f9052fdSBin Meng #ifdef CONFIG_PCI_BOOTDELAY
98*8f9052fdSBin Meng 	int pcidelay_done;
99*8f9052fdSBin Meng #endif
100469a579dSSimon Glass 	struct udevice *cur_serial_dev;	/* current serial device */
10150b1fa39SSimon Glass 	struct arch_global_data arch;	/* architecture-specific data */
10250b1fa39SSimon Glass } gd_t;
10350b1fa39SSimon Glass #endif
10450b1fa39SSimon Glass 
10550b1fa39SSimon Glass /*
10650b1fa39SSimon Glass  * Global Data Flags
10750b1fa39SSimon Glass  */
10850b1fa39SSimon Glass #define GD_FLG_RELOC		0x00001	/* Code was relocated to RAM	   */
10950b1fa39SSimon Glass #define GD_FLG_DEVINIT		0x00002	/* Devices have been initialized   */
11050b1fa39SSimon Glass #define GD_FLG_SILENT		0x00004	/* Silent mode			   */
11150b1fa39SSimon Glass #define GD_FLG_POSTFAIL		0x00008	/* Critical POST test failed	   */
11250b1fa39SSimon Glass #define GD_FLG_POSTSTOP		0x00010	/* POST seqeunce aborted	   */
11350b1fa39SSimon Glass #define GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized */
11450b1fa39SSimon Glass #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)	   */
11550b1fa39SSimon Glass #define GD_FLG_ENV_READY	0x00080	/* Env. imported into hash table   */
116093f79abSSimon Glass #define GD_FLG_SERIAL_READY	0x00100	/* Pre-reloc serial console ready  */
117c9356be3SSimon Glass #define GD_FLG_FULL_MALLOC_INIT	0x00200	/* Full malloc() is ready	   */
11850b1fa39SSimon Glass 
11950b1fa39SSimon Glass #endif /* __ASM_GENERIC_GBL_DATA_H */
120