blob: 7aa5cc2dbbe55de927d7b6ef0b4eef2b2567e657 [file] [log] [blame]
Rayagonda Kokatanur1d8fa362020-07-15 22:48:55 +05301/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright 2020 Broadcom.
4 *
5 */
6
7#ifndef __BCM_NS3_H
8#define __BCM_NS3_H
9
10#include <linux/sizes.h>
11
12#define CONFIG_HOSTNAME "NS3"
13
14/* Physical Memory Map */
15#define V2M_BASE 0x80000000
16#define PHYS_SDRAM_1 V2M_BASE
17
18#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
19#define CONFIG_SYS_LOAD_ADDR (PHYS_SDRAM_1 + 0x80000)
20
21/*
22 * Initial SP before reloaction is placed at end of first DRAM bank,
23 * which is 0x1_0000_0000.
24 * Just before re-loaction, new SP is updated and re-location happens.
25 * So pointing the initial SP to end of 2GB DDR is not a problem
26 */
27#define CONFIG_SYS_INIT_SP_ADDR (PHYS_SDRAM_1 + 0x80000000)
28/* 12MB Malloc size */
29#define CONFIG_SYS_MALLOC_LEN (SZ_8M + SZ_4M)
30
31/* console configuration */
32#define CONFIG_SYS_NS16550_CLK 25000000
33
34#define CONFIG_SYS_CBSIZE SZ_1K
35#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
36 sizeof(CONFIG_SYS_PROMPT) + 16)
37#define CONFIG_SYS_MAXARGS 64
38#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
39
Bharat Gooty208e79d2020-07-15 22:49:06 +053040/*
41 * Increase max uncompressed/gunzip size, keeping size same as EMMC linux
42 * partition.
43 */
44#define CONFIG_SYS_BOOTM_LEN 0x01800000
45
46/* Env configuration */
47#define CONFIG_SYS_MMC_ENV_DEV 0
48#define CONFIG_SYS_MMC_ENV_PART 0
49
50/* Access eMMC Boot_1 and Boot_2 partitions */
51#define CONFIG_SUPPORT_EMMC_BOOT
52
53/* enable 64-bit PCI resources */
54#define CONFIG_SYS_PCI_64BIT 1
55
56#define CONSOLE_ARGS "console_args=console=ttyS0,115200n8\0"
57#define MAX_CPUS "max_cpus=maxcpus=8\0"
58#define OS_LOG_LEVEL "log_level=loglevel=7\0"
59#define EXTRA_ARGS "extra_args=earlycon=uart8250,mmio32,0x68A10000 " \
60 "earlyelog=" __stringify(ELOG_AP_UART_LOG_BASE) ",0x10000 " \
61 "crashkernel=512M reboot=w\0"
62
63#define PCIE_ARGS "pcie_args=pci=pcie_bus_safe pcie_ports=native vfio_pci.disable_idle_d3=1\0"
64
65#ifdef CONFIG_BCM_SF2_ETH
66#define ETH_ADDR "ethaddr=00:0A:F7:95:65:A4\0"
67#define NET_ARGS "bgmac_platform.ethaddr=${ethaddr} " \
68 "ip=${ipaddr}::${gatewayip}:${netmask}::${ethif}:off"
69#else
70#define ETH_ADDR
71#define NET_ARGS
72#endif
73
74#define RESERVED_MEM "reserved_mem=memmap=0xff000000$0x1000000\0"
75
76#define BASE_ARGS "${console_args} ${extra_args} ${pcie_args}" \
77 " ${max_cpus} ${log_level} ${reserved_mem}"
78#define SETBOOTARGS "setbootargs=setenv bootargs " BASE_ARGS " " NET_ARGS "\0"
79
80#define UPDATEME_FLASH_PARAMS "bcm_compat_level=4\0" \
81 "bcm_need_recovery_rootfs=0\0" \
82 "bcm_bl_flash_pending_rfs_imgs=0\0"
83
84#define KERNEL_LOADADDR_CFG \
85 "fit_image_loadaddr=0x90000000\0" \
86 "dtb_loadaddr=0x82000000\0"
87
88#define INITRD_ARGS "initrd_args=root=/dev/ram rw\0"
89#define INITRD_LOADADDR "initrd_loadaddr=0x92000000\0"
90#define INITRD_IMAGE "initrd_image=rootfs-lake-bcm958742t.cpio.gz\0"
91#define MMC_DEV "sd_device_number=0\0"
92#define EXEC_STATE "exec_state=normal\0"
93
94#define EXT4RD_ARGS "ext4rd_args="\
95 "root=/dev/mmcblk${sd_device_number}p${gpt_partition_entry} rw rootwait\0"
96
97#define WDT_CNTRL "wdt_enable=1\0" \
98 "wdt_timeout_sec=0\0"
99
100#define ELOG_SETUP \
101 "mbox0_addr=0x66424024\0"\
102 "elog_setup="\
103 "if logsetup -s ${mbox0_addr}; then "\
104 "else "\
105 "echo ELOG is not supported by this version of the MCU patch.;"\
106 "exit;"\
107 "fi;"\
108 "if logsetup -c ${mbox0_addr}; then "\
109 "echo ELOG is ready;"\
110 "else "\
111 "echo ELOG is supported, but is not set up.;"\
112 "echo Getting setup file from the server ${serverip}...;"\
113 "if tftp ${tftp_dir}elog_src.txt; then "\
114 "echo Setting up ELOG. Please wait...;"\
115 "if logsetup ${loadaddr} ${mbox0_addr} ${filesize}; "\
116 "then "\
117 "else "\
118 "echo [logsetup] ERROR.;"\
119 "fi;"\
120 "if logsetup -c ${mbox0_addr}; then "\
121 "echo ELOG is READY.;"\
122 "else "\
123 "echo ELOG is NOT SET UP.;"\
124 "fi;"\
125 "else "\
126 "echo ELOG setup file is not available on the server.;"\
127 "fi;"\
128 "fi \0"
129
130/* eMMC partition for FIT images */
131#define FIT_MMC_PARTITION \
132 "fit_partitions=" \
133 "uuid_disk=${uuid_gpt_disk};" \
134 "name=env,size=512K,uuid=${uuid_gpt_env};" \
135 "name=Image_rsa.img,size=24MiB,uuid=${uuid_gpt_linux};" \
136 "name=Image1_rsa.img,size=24MiB,uuid=${uuid_gpt_linux1};" \
137 "name=Image2_rsa.img,size=24MiB,uuid=${uuid_gpt_linux2};" \
138 "name=nitro,size=8MiB,uuid=${uuid_gpt_nitro};" \
139 "name=recovery,size=940MiB,uuid=${uuid_gpt_recovery};" \
140 "name=rootfs,size=-,uuid=${uuid_gpt_prootfs}\0"
141
142#define QSPI_FLASH_NITRO_PARAMS \
143 "spi_nitro_img_bin_start=0x400000\0" \
144 "spi_nitro_img_bin_mirror_start=0x580000\0" \
145 "spi_nitro_bspd_cfg_start=0x700000\0" \
146 "spi_nitro_bspd_mirror_cfg_start=0x710000\0" \
147
148#define QSPI_ACCESS_ENABLE \
149 "qspi_access_en=" \
150 "mw 0x68a403e8 1;" \
151 "mw 0x68a403ec 1;" \
152 "mw 0x68a403f0 1;" \
153 "mw 0x68a403f4 1;" \
154 "mw 0x68a403f8 1;" \
155 "mw 0x68a403fc 1 \0"
156
157#define FUNC_QSPI_PROBE \
158 "func_qspi_probe="\
159 "if run qspi_access_en; then "\
160 "else "\
161 "echo ${errstr} run qspi_access_en ** FAILED **;"\
162 "exit;"\
163 "fi;"\
164 "if sf probe 0; then "\
165 "else "\
166 "echo echo ${errstr} sf probe command ** FAILED **;"\
167 "exit;"\
168 "fi \0"
169
170#define NITRO_FW_IMAGES \
171 "nitro_bin=nitro.img\0" \
172 "nitro_bspd_cfg=nitro_fb_bspd_config.bin\0"
173
174#define FASTBOOT_NITRO_SETUP \
175 "nitro_fastboot_type=1\0" \
176 "nitro_fastboot_secure=1\0" \
177 "nitro_fastboot_img_buffer=0\0" \
178 "nitro_fit_img_loc=0x90000000\0"
179
180#define FASTBOOT_SETUP \
181 "fastboot_nitro_setup=" \
182 "setenv errstr fastboot_setup;" \
183 "run func_qspi_probe;" \
184 /* first load header only */ \
185 "if sf read ${nitro_fit_img_loc} "\
186 "${spi_nitro_img_bin_start} 0x18; then "\
187 "else "\
188 "echo [fastboot_nitro_setup] sf read "\
189 "${spi_nitro_img_bin_start} ** FAILED **;"\
190 "exit;"\
191 "fi;"\
192 "if spi_nitro_images_addr ${nitro_fit_img_loc} "\
193 "${spi_nitro_img_bin_start}; then "\
194 "else "\
195 "echo [fastboot_nitro_setup] spi_nitro_images_addr "\
196 "** FAILED **;"\
197 "exit;"\
198 "fi \0"
199
200#define CHECK_CHIMP_HS\
201 "check_chimp_hs=chimp_hs"\
202 "\0"
203
204#define FASTBOOT_NITRO "fastboot_nitro=chimp_ld_secure\0"
205
206#define FIT_IMAGE "fit_image=Image_rsa.img\0"
207#define BOOTCMD_MMC_FIT \
208 "bootcmd_mmc_fit="\
209 "mmc dev ${sd_device_number};"\
210 "if test $exec_state = normal; then " \
211 "setenv use_rootfs rootfs;"\
212 "else " \
213 "setenv use_rootfs recovery;"\
214 "fi;" \
215 "echo used filesystem :${use_rootfs};"\
216 "gpt setenv mmc ${sd_device_number} ${use_rootfs};"\
217 "setenv bootargs_fs ${setbootargs} ${ext4rd_args}; run bootargs_fs;"\
218 "gpt setenv mmc ${sd_device_number} ${fit_image};"\
219 "mmc read ${fit_image_loadaddr} ${gpt_partition_addr} "\
220 "${gpt_partition_size};"\
221 "bootm ${fit_image_loadaddr}\0"
222
223#define BOOTCMD_MMC_FITS \
224 "bootcmd_mmc_fits="\
225 "setenv mmc_fit0 " \
226 "'setenv fit_image Image_rsa.img; run bootcmd_mmc_fit';"\
227 "setenv mmc_fit1 " \
228 "'setenv fit_image Image1_rsa.img; run bootcmd_mmc_fit';"\
229 "setenv mmc_fit2 " \
230 "'setenv fit_image Image2_rsa.img; run bootcmd_mmc_fit';"\
231 "run mmc_fit0 || run mmc_fit1 || run mmc_fit2\0"
232
233#define USBDEV "usbdev=0\0"
234#define BOOTCMD_USB\
235 "bootcmd_usb="\
236 "setenv usb_image_loadaddr 90000000;"\
237 "setenv fit_image Image_rsa.img;"\
238 "setenv bootargs_fs ${setbootargs} ${initrd_args}; run bootargs_fs;"\
239 "if usb dev ${usbdev}; && usb start; then "\
240 "echo Booting from USB...;"\
241 "fatload usb ${usbdev} ${usb_image_loadaddr} ${fit_image};"\
242 "fatload usb ${usbdev} ${initrd_loadaddr} ${initrd_image};"\
243 "bootm ${usb_image_loadaddr} ${initrd_loadaddr}:${filesize};"\
244 "fi;"\
245 "\0"
246
247#define START_PCI\
248 "start_pci=pci e "\
249 "\0"
250
251#define BNXT_LOAD\
252 "bnxt_load=bnxt 0 probe "\
253 "\0"
254
255#define BOOTCMD_PXE\
256 "bootcmd_pxe="\
257 "run check_chimp_hs && "\
258 "run start_pci && "\
259 "run bnxt_load;"\
260 "setenv ethact bnxt_eth0;"\
261 "setenv autoload no;"\
262 "setenv bootargs_fs ${setbootargs} ${initrd_args}; run bootargs_fs;"\
263 "if dhcp; then "\
264 "setenv pxefile_addr_r ${loadaddr};"\
265 "if pxe get; then "\
266 "setenv ramdisk_addr_r ${initrd_loadaddr};"\
267 "setenv kernel_addr_r ${fit_image_loadaddr};"\
268 "pxe boot; "\
269 "fi;"\
270 "fi;"\
271 "\0"
272
273#define FLASH_PENDING_RFS_IMGS \
274 "flash_pending_rfs_imgs=" \
275 "if test $bcm_bl_flash_pending_rfs_imgs = 1; then " \
276 "if test $bl_flash_pending_rfs_imgs = rootfs; then " \
277 "dhcp;" \
278 "run mmc_flash_rootfs;" \
279 "fi;" \
280 "if test $bl_flash_pending_rfs_imgs = recovery; then " \
281 "dhcp;" \
282 "run mmc_flash_recovery;" \
283 "fi;" \
284 "setenv bl_flash_pending_rfs_imgs;" \
285 "fi; \0"
286
287#define CONFIG_BOOTCOMMAND "run flash_pending_rfs_imgs;" \
288 "run fastboot_nitro && "\
289 "run bootcmd_mmc_fits || "\
290 "run bootcmd_usb || "\
291 "run bootcmd_pxe"
292
293#define ARCH_ENV_SETTINGS \
294 CONSOLE_ARGS \
295 MAX_CPUS \
296 OS_LOG_LEVEL \
297 EXTRA_ARGS \
298 PCIE_ARGS \
299 ETH_ADDR \
300 RESERVED_MEM \
301 SETBOOTARGS \
302 UPDATEME_FLASH_PARAMS \
303 KERNEL_LOADADDR_CFG\
304 INITRD_ARGS \
305 INITRD_LOADADDR \
306 INITRD_IMAGE \
307 MMC_DEV \
308 EXEC_STATE \
309 EXT4RD_ARGS \
310 WDT_CNTRL \
311 ELOG_SETUP \
312 FIT_MMC_PARTITION \
313 QSPI_FLASH_NITRO_PARAMS \
314 QSPI_ACCESS_ENABLE \
315 FUNC_QSPI_PROBE \
316 NITRO_FW_IMAGES \
317 FASTBOOT_NITRO_SETUP \
318 FASTBOOT_SETUP \
319 CHECK_CHIMP_HS \
320 FASTBOOT_NITRO \
321 FIT_IMAGE \
322 BOOTCMD_MMC_FIT \
323 BOOTCMD_MMC_FITS \
324 USBDEV \
325 BOOTCMD_USB \
326 START_PCI \
327 BNXT_LOAD \
328 BOOTCMD_PXE \
329 FLASH_PENDING_RFS_IMGS
330
331#define CONFIG_EXTRA_ENV_SETTINGS \
332 ARCH_ENV_SETTINGS
333
Rayagonda Kokatanur1d8fa362020-07-15 22:48:55 +0530334#endif /* __BCM_NS3_H */