xref: /openbmc/u-boot/include/configs/bcmstb.h (revision 78a88f79)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * (C) Copyright 2018  Cisco Systems, Inc.
4  *
5  * Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
6  *
7  * Configuration settings for the Broadcom BCMSTB SoC family.
8  */
9 
10 #ifndef __BCMSTB_H
11 #define __BCMSTB_H
12 
13 #include "version.h"
14 #include <linux/sizes.h>
15 #include <asm/arch/prior_stage.h>
16 
17 /*
18  * Generic board configuration.
19  */
20 #define CONFIG_SYS_GENERIC_BOARD
21 
22 /*
23  * CPU configuration.
24  */
25 #define CONFIG_SKIP_LOWLEVEL_INIT
26 
27 /*
28  * Memory configuration.
29  *
30  * The prior stage BOLT bootloader sets up memory for us.
31  *
32  * An example boot memory layout after loading everything is:
33  *
34  *	 0x0000 8000	vmlinux.bin.gz
35  *	       :	[~31 MiB uncompressed max]
36  *	 0x01ef f000	FIT containing signed public key
37  *	       :	[~2 KiB in size]
38  *	 0x01f0 0000	DTB copied from prior-stage-provided region
39  *	       :	[~1 MiB max]
40  *	 0x0200 0000	FIT containing ramdisk and device tree
41  *             :	  initramfs.cpio.gz
42  *	       :	  [~208 MiB uncompressed max, to CMA/bmem low address]
43  *	       :	  [~80 MiB compressed max, to PSB low address]
44  *             :	  device tree binary
45  *             :	  [~60 KiB]
46  *	 0x0700 0000	Prior stage bootloader (PSB)
47  *	       :
48  *	 0x0761 7000	Prior-stage-provided device tree binary (DTB)
49  *	       :	[~40 KiB in size]
50  *	 0x0f00 0000	Contiguous memory allocator (CMA/bmem) low address
51  *	       :
52  *	 0x8010 0000	U-Boot code at ELF load address
53  *	       :	[~500 KiB in size, stripped]
54  *	 0xc000 0000	Top of RAM
55  *
56  * Setting gd->relocaddr to CONFIG_SYS_TEXT_BASE in dram_init_banksize
57  * prevents U-Boot from relocating itself when it is run as an ELF
58  * program by the prior stage bootloader.
59  *
60  * We want to keep the ramdisk and FDT in the FIT image in-place, to
61  * accommodate stblinux's bmem and CMA regions.  To accomplish this,
62  * we set initrd_high and fdt_high to 0xffffffff, and the load and
63  * entry addresses of the FIT ramdisk entry to 0x0.
64  *
65  * Overwriting the prior stage bootloader causes memory instability,
66  * so the compressed initramfs needs to fit between the load address
67  * and the PSB low address.  In BOLT's default configuration this
68  * limits the compressed size of the initramfs to approximately 80
69  * MiB.  However, BOLT can be configured to allow loading larger
70  * initramfs images, in which case this limitation is eliminated.
71  */
72 #define CONFIG_NR_DRAM_BANKS		3
73 
74 #define CONFIG_SYS_SDRAM_BASE		0x00000000
75 #define CONFIG_SYS_TEXT_BASE		0x80100000
76 #define CONFIG_SYS_INIT_RAM_ADDR	0x80200000
77 #define CONFIG_SYS_INIT_RAM_SIZE	0x100000
78 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_INIT_RAM_ADDR +	\
79 					 CONFIG_SYS_INIT_RAM_SIZE -	\
80 					 GENERATED_GBL_DATA_SIZE)
81 #define CONFIG_SYS_MALLOC_LEN		((10 * 1024) << 10) /* 10 MiB */
82 #define CONFIG_SYS_LOAD_ADDR		0x2000000
83 
84 /*
85  * CONFIG_SYS_LOAD_ADDR - 1 MiB.
86  */
87 #define CONFIG_SYS_FDT_SAVE_ADDRESS	0x1f00000
88 #define CONFIG_SYS_CBSIZE		512
89 #define CONFIG_SYS_MAXARGS		32
90 
91 /*
92  * Large kernel image bootm configuration.
93  */
94 #define CONFIG_SYS_BOOTM_LEN		SZ_64M
95 
96 /*
97  * NS16550 configuration.
98  */
99 #define V_NS16550_CLK			81000000
100 
101 #define CONFIG_SYS_NS16550
102 #define CONFIG_SYS_NS16550_SERIAL
103 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
104 #define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
105 
106 /*
107  * Serial console configuration.
108  */
109 #define CONFIG_SERIAL3			3
110 
111 #define CONFIG_BAUDRATE			115200
112 #define CONFIG_SYS_BAUDRATE_TABLE	{4800, 9600, 19200, 38400, 57600, \
113 					 115200}
114 
115 /*
116  * Informational display configuration.
117  */
118 #define CONFIG_REVISION_TAG
119 
120 /*
121  * Command configuration.
122  */
123 #define CONFIG_CMD_ASKENV
124 #define CONFIG_CMD_CACHE
125 #define CONFIG_CMD_EXT2
126 #define CONFIG_CMD_SF
127 #define CONFIG_CMD_SPI
128 #define CONFIG_CMD_SF_TEST
129 #define CONFIG_CMD_MMC
130 
131 /*
132  * Flash configuration.
133  */
134 #define CONFIG_ST_SMI
135 #define CONFIG_SPI_FLASH_STMICRO
136 #define CONFIG_SPI_FLASH_MACRONIX
137 
138 /*
139  * Filesystem configuration.
140  */
141 #define CONFIG_DOS_PARTITION
142 #define CONFIG_CMD_EXT4
143 #define CONFIG_FS_EXT4
144 #define CONFIG_CMD_FS_GENERIC
145 
146 /*
147  * Environment configuration.
148  */
149 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
150 
151 #define CONFIG_ENV_IS_IN_SPI_FLASH      1
152 #define CONFIG_ENV_OFFSET		0x1e0000
153 #define CONFIG_ENV_SIZE			(64 << 10) /* 64 KiB */
154 #define CONFIG_ENV_SECT_SIZE		CONFIG_ENV_SIZE
155 #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
156 #define CONFIG_ENV_OVERWRITE
157 
158 /*
159  * Save the prior stage provided DTB.
160  */
161 #define CONFIG_PREBOOT					\
162 	"fdt addr ${fdtcontroladdr};"			\
163 	"fdt move ${fdtcontroladdr} ${fdtsaveaddr};"	\
164 	"fdt addr ${fdtsaveaddr};"
165 /*
166  * Enable in-place RFS with this initrd_high setting.
167  */
168 #define CONFIG_EXTRA_ENV_SETTINGS					\
169 	"fdtsaveaddr=" __stringify(CONFIG_SYS_FDT_SAVE_ADDRESS) "\0"	\
170 	"initrd_high=0xffffffff\0"					\
171 	"fdt_high=0xffffffff\0"
172 
173 /*
174  * Set fdtaddr to prior stage-provided DTB in board_late_init, when
175  * writeable environment is available.
176  */
177 #define CONFIG_BOARD_LATE_INIT
178 
179 #define CONFIG_SYS_MAX_FLASH_BANKS 1
180 
181 #define CONFIG_DM_SPI 1
182 
183 #endif /* __BCMSTB_H */
184