blob: 7d6edbd65df6dc843692f07a2120c8595c206b9c [file] [log] [blame]
Rayagonda Kokatanur291635a2020-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
Rayagonda Kokatanur291635a2020-07-15 22:48:55 +053019
20/*
21 * Initial SP before reloaction is placed at end of first DRAM bank,
22 * which is 0x1_0000_0000.
23 * Just before re-loaction, new SP is updated and re-location happens.
24 * So pointing the initial SP to end of 2GB DDR is not a problem
25 */
26#define CONFIG_SYS_INIT_SP_ADDR (PHYS_SDRAM_1 + 0x80000000)
27/* 12MB Malloc size */
Rayagonda Kokatanur291635a2020-07-15 22:48:55 +053028
29/* console configuration */
30#define CONFIG_SYS_NS16550_CLK 25000000
31
32#define CONFIG_SYS_CBSIZE SZ_1K
33#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
34 sizeof(CONFIG_SYS_PROMPT) + 16)
35#define CONFIG_SYS_MAXARGS 64
36#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
37
Bharat Gootyd5ab69a2020-07-15 22:49:06 +053038/*
39 * Increase max uncompressed/gunzip size, keeping size same as EMMC linux
40 * partition.
41 */
42#define CONFIG_SYS_BOOTM_LEN 0x01800000
43
Bharat Gootyd5ab69a2020-07-15 22:49:06 +053044/* Access eMMC Boot_1 and Boot_2 partitions */
Bharat Gootyd5ab69a2020-07-15 22:49:06 +053045
46/* enable 64-bit PCI resources */
47#define CONFIG_SYS_PCI_64BIT 1
48
49#define CONSOLE_ARGS "console_args=console=ttyS0,115200n8\0"
50#define MAX_CPUS "max_cpus=maxcpus=8\0"
51#define OS_LOG_LEVEL "log_level=loglevel=7\0"
52#define EXTRA_ARGS "extra_args=earlycon=uart8250,mmio32,0x68A10000 " \
53 "earlyelog=" __stringify(ELOG_AP_UART_LOG_BASE) ",0x10000 " \
54 "crashkernel=512M reboot=w\0"
55
56#define PCIE_ARGS "pcie_args=pci=pcie_bus_safe pcie_ports=native vfio_pci.disable_idle_d3=1\0"
57
58#ifdef CONFIG_BCM_SF2_ETH
59#define ETH_ADDR "ethaddr=00:0A:F7:95:65:A4\0"
60#define NET_ARGS "bgmac_platform.ethaddr=${ethaddr} " \
61 "ip=${ipaddr}::${gatewayip}:${netmask}::${ethif}:off"
62#else
63#define ETH_ADDR
64#define NET_ARGS
65#endif
66
67#define RESERVED_MEM "reserved_mem=memmap=0xff000000$0x1000000\0"
68
69#define BASE_ARGS "${console_args} ${extra_args} ${pcie_args}" \
70 " ${max_cpus} ${log_level} ${reserved_mem}"
71#define SETBOOTARGS "setbootargs=setenv bootargs " BASE_ARGS " " NET_ARGS "\0"
72
73#define UPDATEME_FLASH_PARAMS "bcm_compat_level=4\0" \
74 "bcm_need_recovery_rootfs=0\0" \
75 "bcm_bl_flash_pending_rfs_imgs=0\0"
76
77#define KERNEL_LOADADDR_CFG \
78 "fit_image_loadaddr=0x90000000\0" \
79 "dtb_loadaddr=0x82000000\0"
80
81#define INITRD_ARGS "initrd_args=root=/dev/ram rw\0"
82#define INITRD_LOADADDR "initrd_loadaddr=0x92000000\0"
83#define INITRD_IMAGE "initrd_image=rootfs-lake-bcm958742t.cpio.gz\0"
84#define MMC_DEV "sd_device_number=0\0"
85#define EXEC_STATE "exec_state=normal\0"
86
87#define EXT4RD_ARGS "ext4rd_args="\
88 "root=/dev/mmcblk${sd_device_number}p${gpt_partition_entry} rw rootwait\0"
89
90#define WDT_CNTRL "wdt_enable=1\0" \
91 "wdt_timeout_sec=0\0"
92
93#define ELOG_SETUP \
94 "mbox0_addr=0x66424024\0"\
95 "elog_setup="\
96 "if logsetup -s ${mbox0_addr}; then "\
97 "else "\
98 "echo ELOG is not supported by this version of the MCU patch.;"\
99 "exit;"\
100 "fi;"\
101 "if logsetup -c ${mbox0_addr}; then "\
102 "echo ELOG is ready;"\
103 "else "\
104 "echo ELOG is supported, but is not set up.;"\
105 "echo Getting setup file from the server ${serverip}...;"\
106 "if tftp ${tftp_dir}elog_src.txt; then "\
107 "echo Setting up ELOG. Please wait...;"\
108 "if logsetup ${loadaddr} ${mbox0_addr} ${filesize}; "\
109 "then "\
110 "else "\
111 "echo [logsetup] ERROR.;"\
112 "fi;"\
113 "if logsetup -c ${mbox0_addr}; then "\
114 "echo ELOG is READY.;"\
115 "else "\
116 "echo ELOG is NOT SET UP.;"\
117 "fi;"\
118 "else "\
119 "echo ELOG setup file is not available on the server.;"\
120 "fi;"\
121 "fi \0"
122
123/* eMMC partition for FIT images */
124#define FIT_MMC_PARTITION \
125 "fit_partitions=" \
126 "uuid_disk=${uuid_gpt_disk};" \
127 "name=env,size=512K,uuid=${uuid_gpt_env};" \
128 "name=Image_rsa.img,size=24MiB,uuid=${uuid_gpt_linux};" \
129 "name=Image1_rsa.img,size=24MiB,uuid=${uuid_gpt_linux1};" \
130 "name=Image2_rsa.img,size=24MiB,uuid=${uuid_gpt_linux2};" \
131 "name=nitro,size=8MiB,uuid=${uuid_gpt_nitro};" \
132 "name=recovery,size=940MiB,uuid=${uuid_gpt_recovery};" \
133 "name=rootfs,size=-,uuid=${uuid_gpt_prootfs}\0"
134
135#define QSPI_FLASH_NITRO_PARAMS \
136 "spi_nitro_img_bin_start=0x400000\0" \
137 "spi_nitro_img_bin_mirror_start=0x580000\0" \
138 "spi_nitro_bspd_cfg_start=0x700000\0" \
139 "spi_nitro_bspd_mirror_cfg_start=0x710000\0" \
140
141#define QSPI_ACCESS_ENABLE \
142 "qspi_access_en=" \
143 "mw 0x68a403e8 1;" \
144 "mw 0x68a403ec 1;" \
145 "mw 0x68a403f0 1;" \
146 "mw 0x68a403f4 1;" \
147 "mw 0x68a403f8 1;" \
148 "mw 0x68a403fc 1 \0"
149
150#define FUNC_QSPI_PROBE \
151 "func_qspi_probe="\
152 "if run qspi_access_en; then "\
153 "else "\
154 "echo ${errstr} run qspi_access_en ** FAILED **;"\
155 "exit;"\
156 "fi;"\
157 "if sf probe 0; then "\
158 "else "\
159 "echo echo ${errstr} sf probe command ** FAILED **;"\
160 "exit;"\
161 "fi \0"
162
163#define NITRO_FW_IMAGES \
164 "nitro_bin=nitro.img\0" \
165 "nitro_bspd_cfg=nitro_fb_bspd_config.bin\0"
166
167#define FASTBOOT_NITRO_SETUP \
168 "nitro_fastboot_type=1\0" \
169 "nitro_fastboot_secure=1\0" \
170 "nitro_fastboot_img_buffer=0\0" \
171 "nitro_fit_img_loc=0x90000000\0"
172
173#define FASTBOOT_SETUP \
174 "fastboot_nitro_setup=" \
175 "setenv errstr fastboot_setup;" \
176 "run func_qspi_probe;" \
177 /* first load header only */ \
178 "if sf read ${nitro_fit_img_loc} "\
179 "${spi_nitro_img_bin_start} 0x18; then "\
180 "else "\
181 "echo [fastboot_nitro_setup] sf read "\
182 "${spi_nitro_img_bin_start} ** FAILED **;"\
183 "exit;"\
184 "fi;"\
185 "if spi_nitro_images_addr ${nitro_fit_img_loc} "\
186 "${spi_nitro_img_bin_start}; then "\
187 "else "\
188 "echo [fastboot_nitro_setup] spi_nitro_images_addr "\
189 "** FAILED **;"\
190 "exit;"\
191 "fi \0"
192
193#define CHECK_CHIMP_HS\
194 "check_chimp_hs=chimp_hs"\
195 "\0"
196
197#define FASTBOOT_NITRO "fastboot_nitro=chimp_ld_secure\0"
198
199#define FIT_IMAGE "fit_image=Image_rsa.img\0"
200#define BOOTCMD_MMC_FIT \
201 "bootcmd_mmc_fit="\
202 "mmc dev ${sd_device_number};"\
203 "if test $exec_state = normal; then " \
204 "setenv use_rootfs rootfs;"\
205 "else " \
206 "setenv use_rootfs recovery;"\
207 "fi;" \
208 "echo used filesystem :${use_rootfs};"\
209 "gpt setenv mmc ${sd_device_number} ${use_rootfs};"\
210 "setenv bootargs_fs ${setbootargs} ${ext4rd_args}; run bootargs_fs;"\
211 "gpt setenv mmc ${sd_device_number} ${fit_image};"\
212 "mmc read ${fit_image_loadaddr} ${gpt_partition_addr} "\
213 "${gpt_partition_size};"\
214 "bootm ${fit_image_loadaddr}\0"
215
216#define BOOTCMD_MMC_FITS \
217 "bootcmd_mmc_fits="\
218 "setenv mmc_fit0 " \
219 "'setenv fit_image Image_rsa.img; run bootcmd_mmc_fit';"\
220 "setenv mmc_fit1 " \
221 "'setenv fit_image Image1_rsa.img; run bootcmd_mmc_fit';"\
222 "setenv mmc_fit2 " \
223 "'setenv fit_image Image2_rsa.img; run bootcmd_mmc_fit';"\
224 "run mmc_fit0 || run mmc_fit1 || run mmc_fit2\0"
225
226#define USBDEV "usbdev=0\0"
227#define BOOTCMD_USB\
228 "bootcmd_usb="\
229 "setenv usb_image_loadaddr 90000000;"\
230 "setenv fit_image Image_rsa.img;"\
231 "setenv bootargs_fs ${setbootargs} ${initrd_args}; run bootargs_fs;"\
232 "if usb dev ${usbdev}; && usb start; then "\
233 "echo Booting from USB...;"\
234 "fatload usb ${usbdev} ${usb_image_loadaddr} ${fit_image};"\
235 "fatload usb ${usbdev} ${initrd_loadaddr} ${initrd_image};"\
236 "bootm ${usb_image_loadaddr} ${initrd_loadaddr}:${filesize};"\
237 "fi;"\
238 "\0"
239
240#define START_PCI\
241 "start_pci=pci e "\
242 "\0"
243
244#define BNXT_LOAD\
245 "bnxt_load=bnxt 0 probe "\
246 "\0"
247
248#define BOOTCMD_PXE\
249 "bootcmd_pxe="\
250 "run check_chimp_hs && "\
251 "run start_pci && "\
252 "run bnxt_load;"\
253 "setenv ethact bnxt_eth0;"\
254 "setenv autoload no;"\
255 "setenv bootargs_fs ${setbootargs} ${initrd_args}; run bootargs_fs;"\
256 "if dhcp; then "\
257 "setenv pxefile_addr_r ${loadaddr};"\
258 "if pxe get; then "\
259 "setenv ramdisk_addr_r ${initrd_loadaddr};"\
260 "setenv kernel_addr_r ${fit_image_loadaddr};"\
261 "pxe boot; "\
262 "fi;"\
263 "fi;"\
264 "\0"
265
266#define FLASH_PENDING_RFS_IMGS \
267 "flash_pending_rfs_imgs=" \
268 "if test $bcm_bl_flash_pending_rfs_imgs = 1; then " \
269 "if test $bl_flash_pending_rfs_imgs = rootfs; then " \
270 "dhcp;" \
271 "run mmc_flash_rootfs;" \
272 "fi;" \
273 "if test $bl_flash_pending_rfs_imgs = recovery; then " \
274 "dhcp;" \
275 "run mmc_flash_recovery;" \
276 "fi;" \
277 "setenv bl_flash_pending_rfs_imgs;" \
278 "fi; \0"
279
Bharat Gootye32a25e2020-07-15 22:49:07 +0530280/* Flashing commands */
281#define TFTP_QSPI_PARAM \
282 "fip_qspi_addr=0x0\0"\
283 "fip_qspi_mirror_addr=0x200000\0"\
284 "loadaddr=0x90000000\0"\
285 "tftpblocksize=1468\0"\
286 "qspi_flash_fip=fip\0"\
287
288/* Flash fit_GPT partition to eMMC */
289#define MMC_FLASH_FIT_GPT \
290 "mmc_flash_gpt="\
291 "if mmc dev ${sd_device_number}; then "\
292 "else "\
293 "echo [mmc_flash_gpt] mmc dev ${sd_device_number} "\
294 "** FAILED **;"\
295 "exit;"\
296 "fi;"\
297 "if gpt write mmc ${sd_device_number} ${fit_partitions}; then "\
298 "else "\
299 "echo [mmc_flash_gpt] gpt write ${fit_partitions} "\
300 "** FAILED **;"\
301 "exit;"\
302 "fi \0"
303
304#define MMC_FLASH_IMAGE_RSA \
305 "mmc_flash_image_rsa="\
306 "if mmc dev ${sd_device_number}; then "\
307 "else "\
308 "echo [mmc_flash_image_rsa] mmc dev ${sd_device_number} "\
309 "** FAILED **;"\
310 "exit;"\
311 "fi;"\
312 "if gpt setenv mmc ${sd_device_number} ${fit_image}; then "\
313 "else "\
314 "echo [mmc_flash_image_rsa] gpt setenv ${fit_image} "\
315 "** FAILED **;"\
316 "exit;"\
317 "fi;"\
318 "if tftp ${loadaddr} ${tftp_dir}${fit_image}; then "\
319 "if test ${fit_image} = Image_rsa.img; then "\
320 "if setenv tftp_fit_image yes; then "\
321 "else "\
322 "echo [mmc_flash_image_rsa] "\
323 "setenv tftp_fit_image to yes"\
324 "** FAILED **;"\
325 "exit;"\
326 "fi;"\
327 "fi;"\
328 "else "\
329 "if test ${fit_image} = Image_rsa.img; then "\
330 "echo [mmc_flash_image_rsa] tftp "\
331 "${tftp_dir}${fit_image} ** FAILED **;"\
332 "else "\
333 "if test ${tftp_fit_image} = yes; then "\
334 "if mmc write ${loadaddr} "\
335 "${gpt_partition_addr} "\
336 "${fileblocks}; then "\
337 "else "\
338 "echo "\
339 "[mmc_flash_image_rsa] "\
340 "mmc write "\
341 "${gpt_partition_addr} "\
342 "** FAILED **;"\
343 "exit;"\
344 "fi;"\
345 "else "\
346 "echo [mmc_flash_image_rsa] tftp "\
347 "${tftp_dir}${fit_image} "\
348 "** FAILED **;"\
349 "fi;"\
350 "fi;"\
351 "exit;"\
352 "fi;"\
353 "if math add filesize filesize 1FF; then "\
354 "else "\
355 "echo [mmc_flash_image_rsa] math add command ** FAILED **;"\
356 "exit;"\
357 "fi;"\
358 "if math div fileblocks filesize 200; then "\
359 "else "\
360 "echo [mmc_flash_image_rsa] math div command ** FAILED **;"\
361 "exit;"\
362 "fi;"\
363 "if mmc write ${loadaddr} ${gpt_partition_addr} ${fileblocks}; then "\
364 "else "\
365 "echo [mmc_flash_image_rsa] mmc write ${gpt_partition_addr} "\
366 "** FAILED **;"\
367 "exit;"\
368 "fi;"\
369 "if setenv image_sz_blk_cnt ${fileblocks}; then "\
370 "else "\
371 "echo [mmc_flash_image_rsa] setenv image_sz_blk_cnt ** "\
372 "FAILED **;"\
373 "exit;"\
374 "fi;"\
375 "if saveenv; then "\
376 "else "\
377 "echo [mmc_flash_image_rsa] saveenv command ** FAILED **;"\
378 "exit;"\
379 "fi \0"
380
381#define MMC_FLASH_RECOVERY \
382 "mmc_flash_recovery="\
383 "if mmc dev ${sd_device_number}; then "\
384 "else "\
385 "echo [mmc_flash_recovery] mmc dev ${sd_device_number} "\
386 "** FAILED **;"\
387 "exit;"\
388 "fi;"\
389 "if gpt setenv mmc ${sd_device_number} recovery; then "\
390 "else "\
391 "echo [mmc_flash_recovery] gpt setenv recovery ** FAILED **;"\
392 "exit;"\
393 "fi;"\
394 "setenv index 1;"\
395 "while tftp ${loadaddr} "\
396 "${tftp_dir}${gpt_partition_name}/chunk_00${index}; do "\
397 "if math add filesize filesize 1FF; then "\
398 "else "\
399 "echo [mmc_flash_recovery] math add command "\
400 "** FAILED **;"\
401 "exit;"\
402 "fi;"\
403 "if math div fileblocks filesize 200; then "\
404 "else "\
405 "echo [mmc_flash_recovery] math div command "\
406 "** FAILED **;"\
407 "exit;"\
408 "fi;"\
409 "if mmc write ${loadaddr} ${gpt_partition_addr} "\
410 "${fileblocks}; then "\
411 "else "\
412 "echo [mmc_flash_recovery] mmc write "\
413 "${gpt_partition_addr} ** FAILED **;"\
414 "exit;"\
415 "fi;"\
416 "if math add index index 1; then "\
417 "else "\
418 "echo [mmc_flash_recovery] math add command "\
419 "** FAILED **;"\
420 "exit;"\
421 "fi;"\
422 "if math add gpt_partition_addr gpt_partition_addr"\
423 " ${fileblocks}; then "\
424 "else "\
425 "echo [mmc_flash_recovery] math add command"\
426 " ** FAILED **;"\
427 "exit;"\
428 "fi;"\
429 "done;"\
430 "if itest ${index} -ne 1; then "\
431 "else "\
432 "echo [mmc_flash_recovery] "\
433 "${tftp_dir}${gpt_partition_name}/chunk_00${index} file "\
434 "not found ** FAILED **;"\
435 "exit;"\
436 "fi \0"
437
438#define MMC_FLASH_ROOTFS \
439 "mmc_flash_rootfs="\
440 "if mmc dev ${sd_device_number}; then "\
441 "else "\
442 "echo [mmc_flash_rootfs] mmc dev ${sd_device_number} "\
443 "** FAILED **;"\
444 "exit;"\
445 "fi;"\
446 "if gpt setenv mmc ${sd_device_number} rootfs; then "\
447 "else "\
448 "echo [mmc_flash_rootfs] gpt setenv rootfs ** FAILED **;"\
449 "exit;"\
450 "fi;"\
451 "setenv index 1;"\
452 "while tftp ${loadaddr} "\
453 "${tftp_dir}${gpt_partition_name}/chunk_00${index}; do "\
454 "if math add filesize filesize 1FF; then "\
455 "else "\
456 "echo [mmc_flash_rootfs] math add command "\
457 "** FAILED **;"\
458 "exit;"\
459 "fi;"\
460 "if math div fileblocks filesize 200; then "\
461 "else "\
462 "echo [mmc_flash_rootfs] math div command "\
463 "** FAILED **;"\
464 "exit;"\
465 "fi;"\
466 "if mmc write ${loadaddr} ${gpt_partition_addr} "\
467 "${fileblocks}; then "\
468 "else "\
469 "echo [mmc_flash_rootfs] mmc write "\
470 "${gpt_partition_addr} ** FAILED **;"\
471 "exit;"\
472 "fi;"\
473 "if math add index index 1; then "\
474 "else "\
475 "echo [mmc_flash_rootfs] math add command "\
476 "** FAILED **;"\
477 "exit;"\
478 "fi;"\
479 "if math add gpt_partition_addr gpt_partition_addr"\
480 " ${fileblocks}; then "\
481 "else "\
482 "echo [mmc_flash_rootfs] math add command"\
483 " ** FAILED **;"\
484 "exit;"\
485 "fi;"\
486 "done;"\
487 "if itest ${index} -ne 1; then "\
488 "else "\
489 "echo [mmc_flash_rootfs] "\
490 "${tftp_dir}${gpt_partition_name}/chunk_00${index} file "\
491 "not found ** FAILED **;"\
492 "exit;"\
493 "fi \0"
494
495/*
496 * For individual flash commands like mmc_flash_gpt, it is not
497 * necessary to check for errors.
498 * If any of its intermediate commands fails, then next commands
499 * will not execute. Script will exit from the failure command.
500 * For uniformity, checking for mmc_flash_gpt, mmc_flash_image_rsa
501 * mmc_flash_nitro and mmc_flash_rootfs
502 */
503#define MMC_FLASH \
504 "flash_mmc="\
505 "if run mmc_flash_gpt; then "\
506 "else "\
507 "echo [flash_mmc] run mmc_flash_gpt ** FAILED **;"\
508 "exit;"\
509 "fi;"\
510 "if setenv tftp_fit_image no; then "\
511 "else "\
512 "echo [flash_mmc] setenv tftp_fit_image to no "\
513 "** FAILED **;"\
514 "exit;"\
515 "fi;"\
516 "if setenv fit_image Image_rsa.img; then "\
517 "else "\
518 "echo [flash_mmc] setenv fit_image to Image_rsa.img "\
519 "** FAILED **;"\
520 "exit;"\
521 "fi;"\
522 "if run mmc_flash_image_rsa; then "\
523 "else "\
524 "echo [flash_mmc] run mmc_flash_image_rsa ** FAILED **;"\
525 "exit;"\
526 "fi;"\
527 "if setenv fit_image Image1_rsa.img; then "\
528 "else "\
529 "echo [flash_mmc] setenv fit_image to Image1_rsa.img "\
530 "** FAILED **;"\
531 "exit;"\
532 "fi;"\
533 "if run mmc_flash_image_rsa; then "\
534 "else "\
535 "echo [flash_mmc] run mmc_flash_image_rsa "\
536 "for Image1_rsa.img ** FAILED **;"\
537 "exit;"\
538 "fi;"\
539 "if setenv fit_image Image2_rsa.img; then "\
540 "else "\
541 "echo [flash_mmc] setenv fit_image to Image2_rsa.img "\
542 "** FAILED **;"\
543 "exit;"\
544 "fi;"\
545 "if run mmc_flash_image_rsa; then "\
546 "else "\
547 "echo [flash_mmc] run mmc_flash_image_rsa "\
548 "for Image2_rsa.img ** FAILED **;"\
549 "exit;"\
550 "fi;"\
551 "if run mmc_flash_recovery; then "\
552 "else "\
553 "echo [flash_mmc] run mmc_flash_recovery ** FAILED **;"\
554 "exit;"\
555 "fi;"\
556 "if run mmc_flash_rootfs; then "\
557 "else "\
558 "echo [flash_mmc] run mmc_flash_rootfs ** FAILED **;"\
559 "exit;"\
560 "fi \0"
561
562#define FUNC_ALIGN_QSPI_ERASE_BLOCK_SIZE \
563 "align_erase_blk_size=" \
564 "setenv fl_write_size 0;" \
565 "if math add fl_write_size filesize FFFF; then "\
566 "else "\
567 "echo ${errstr} math add command ** FAILED **;"\
568 "exit;"\
569 "fi;"\
570 "if math div fl_write_size fl_write_size 10000; then "\
571 "else "\
572 "echo ${errstr} math div command ** FAILED **;"\
573 "exit;"\
574 "fi;"\
575 "if math mul fl_write_size fl_write_size 10000; then "\
576 "else "\
577 "echo ${errstr} math mul command ** FAILED **;"\
578 "exit;"\
579 "fi \0"
580
581#define QSPI_FLASH_FIP \
582 "flash_fip="\
583 "if run qspi_access_en; then "\
584 "else "\
585 "echo [flash_fip] run qspi_access_en ** FAILED **;"\
586 "exit;"\
587 "fi;"\
588 "if tftp ${loadaddr} ${tftp_dir}fip.bin; then "\
589 "else "\
590 "echo [flash_fip] tftp ${tftp_dir}fip.bin "\
591 "** FAILED **;"\
592 "exit;"\
593 "fi;"\
594 "if math add tmpsize filesize FFFF; then "\
595 "else "\
596 "echo [flash_fip] math add command ** FAILED **;"\
597 "exit;"\
598 "fi;"\
599 "if math div tmpsize tmpsize 10000; then "\
600 "else "\
601 "echo [flash_fip] math div command ** FAILED **;"\
602 "exit;"\
603 "fi;"\
604 "if math mul tmpsize tmpsize 10000; then "\
605 "else "\
606 "echo [flash_fip] math mul command ** FAILED **;"\
607 "exit;"\
608 "fi;"\
609 "if sf probe 0; then "\
610 "else "\
611 "echo [flash_fip] sf probe command ** FAILED **;"\
612 "exit;"\
613 "fi;"\
614 "if sf erase ${fip_qspi_addr} ${tmpsize}; then "\
615 "else "\
616 "echo [flash_fip] sf erase ${fip_qspi_addr} ** FAILED **;"\
617 "exit;"\
618 "fi;"\
619 "if sf write ${loadaddr} ${fip_qspi_addr} ${filesize}; then "\
620 "else "\
621 "echo [flash_fip] sf write ${fip_qspi_addr} ** FAILED **;"\
622 "exit;"\
623 "fi;"\
624 /* Flash mirror FIP image */ \
625 "if sf erase ${fip_qspi_mirror_addr} ${tmpsize}; then "\
626 "else "\
627 "echo [flash_fip] sf erase ${fip_qspi_mirror_addr} "\
628 "** FAILED **;"\
629 "exit;"\
630 "fi;"\
631 "if sf write ${loadaddr} ${fip_qspi_mirror_addr} ${filesize}; then "\
632 "else "\
633 "echo [flash_fip] sf write ${fip_qspi_mirror_addr} "\
634 "** FAILED **;"\
635 "exit;"\
636 "fi \0"
637
638#define QSPI_FLASH_NITRO \
639 "flash_nitro="\
640 "run func_qspi_probe; "\
641 "if tftp ${loadaddr} ${tftp_dir}${nitro_bin}; then "\
642 "else "\
643 "echo [flash_nitro] tftp ${tftp_dir}${nitro_bin} "\
644 "** FAILED **;"\
645 "exit;"\
646 "fi;"\
647 "setenv errstr flash_nitro;" \
648 "run align_erase_blk_size;" \
649 /* Flash Nitro fw fit + configuration */ \
650 "if sf erase ${spi_nitro_img_bin_start} ${fl_write_size}; then "\
651 "else "\
652 "echo [flash_nitro] sf erase ${spi_nitro_img_bin_start} "\
653 "** FAILED **;"\
654 "exit;"\
655 "fi;"\
656 "if sf write ${loadaddr} ${spi_nitro_img_bin_start}" \
657 " ${fl_write_size}; then "\
658 "else "\
659 "echo [flash_nitro] sf write ${spi_nitro_bin_start} "\
660 "** FAILED **;"\
661 "exit;"\
662 "fi;"\
663 /* Mirror of Flash Nitro fw fit + configuration */ \
664 "if sf erase ${spi_nitro_img_bin_mirror_start} ${fl_write_size}; then "\
665 "else "\
666 "echo [flash_nitro] sf erase "\
667 "${spi_nitro_img_bin_mirror_start} "\
668 "** FAILED **;"\
669 "exit;"\
670 "fi;"\
671 "if sf write ${loadaddr} ${spi_nitro_img_bin_mirror_start}" \
672 " ${fl_write_size}; then "\
673 "else "\
674 "echo [flash_nitro] sf write "\
675 "${spi_nitro_img_bin_mirror_start} "\
676 "** FAILED **;"\
677 "exit;"\
678 "fi \0"
679
680#define QSPI_FLASH_NITRO_BSPD_CONFIG \
681 "flash_nitro_bspd_config="\
682 "run func_qspi_probe; "\
683 /* Flash BSPD configuration */ \
684 "if tftp ${loadaddr} ${tftp_dir}${nitro_bspd_cfg}; then "\
685 "setenv bspd_cfg_avialable 1; "\
686 "setenv errstr flash_nitro_bspd_config; "\
687 "run align_erase_blk_size;" \
688 "if sf erase ${spi_nitro_bspd_cfg_start} "\
689 "${fl_write_size}; then "\
690 "else "\
691 "echo [flash_nitro] sf erase "\
692 "${spi_nitro_bspd_cfg_start} "\
693 "** FAILED **;"\
694 "exit;"\
695 "fi;"\
696 "if sf write ${loadaddr} ${spi_nitro_bspd_cfg_start} "\
697 "${fl_write_size}; then "\
698 "else "\
699 "echo [flash_nitro] sf write "\
700 "${spi_nitro_bspd_cfg_start} "\
701 "** FAILED **;"\
702 "exit;"\
703 "fi;" \
704 /* Flash BSPD mirror configuration */ \
705 "if sf erase ${spi_nitro_bspd_mirror_cfg_start} "\
706 "${fl_write_size}; then "\
707 "else "\
708 "echo [flash_nitro] sf erase "\
709 "${spi_nitro_bspd_mirror_cfg_start} "\
710 "** FAILED **;"\
711 "exit;"\
712 "fi;"\
713 "if sf write ${loadaddr} ${spi_nitro_bspd_mirror_cfg_start} "\
714 "${fl_write_size}; then "\
715 "else "\
716 "echo [flash_nitro] sf write "\
717 "${spi_nitro_bspd_mirror_cfg_start} "\
718 "** FAILED **;"\
719 "exit;"\
720 "fi;" \
721 "else "\
722 "echo [flash_nitro] tftp ${tftp_dir}${nitro_bspd_cfg} "\
723 "** Skip flashing bspd config file **;"\
724 "fi \0"
725
726#define QSPI_FLASH \
727 "flash_qspi="\
728 "if run qspi_access_en; then "\
729 "else "\
730 "echo [flash_qspi] run qspi_access_en ** FAILED **;"\
731 "exit;"\
732 "fi;"\
733 "if run flash_fip; then "\
734 "else "\
735 "echo [flash_qspi] run flash_fip ** FAILED **;"\
736 "exit;"\
737 "fi;"\
738 "if run flash_nitro; then "\
739 "else "\
740 "echo [flash_qspi] run flash_nitro ** FAILED **;"\
741 "exit;"\
742 "fi \0"
743
744#define FLASH_IMAGES \
745 "flash_images=" \
746 "if run flash_qspi; then "\
747 "else "\
748 "echo [flash_images] run flash_qspi ** FAILED **;"\
749 "exit;"\
750 "fi;"\
751 "if run flash_mmc; then "\
752 "else "\
753 "echo [flash_images] run flash_mmc ** FAILED **;"\
754 "exit;"\
755 "fi \0"
756
Bharat Gootyd5ab69a2020-07-15 22:49:06 +0530757#define ARCH_ENV_SETTINGS \
758 CONSOLE_ARGS \
759 MAX_CPUS \
760 OS_LOG_LEVEL \
761 EXTRA_ARGS \
762 PCIE_ARGS \
763 ETH_ADDR \
764 RESERVED_MEM \
765 SETBOOTARGS \
766 UPDATEME_FLASH_PARAMS \
767 KERNEL_LOADADDR_CFG\
768 INITRD_ARGS \
769 INITRD_LOADADDR \
770 INITRD_IMAGE \
771 MMC_DEV \
772 EXEC_STATE \
773 EXT4RD_ARGS \
774 WDT_CNTRL \
775 ELOG_SETUP \
776 FIT_MMC_PARTITION \
777 QSPI_FLASH_NITRO_PARAMS \
778 QSPI_ACCESS_ENABLE \
779 FUNC_QSPI_PROBE \
780 NITRO_FW_IMAGES \
781 FASTBOOT_NITRO_SETUP \
782 FASTBOOT_SETUP \
783 CHECK_CHIMP_HS \
784 FASTBOOT_NITRO \
785 FIT_IMAGE \
786 BOOTCMD_MMC_FIT \
787 BOOTCMD_MMC_FITS \
788 USBDEV \
789 BOOTCMD_USB \
790 START_PCI \
791 BNXT_LOAD \
792 BOOTCMD_PXE \
Bharat Gootye32a25e2020-07-15 22:49:07 +0530793 FLASH_PENDING_RFS_IMGS \
794 TFTP_QSPI_PARAM \
795 MMC_FLASH_FIT_GPT \
796 MMC_FLASH_IMAGE_RSA \
797 MMC_FLASH_RECOVERY \
798 MMC_FLASH_ROOTFS \
799 MMC_FLASH \
800 FUNC_ALIGN_QSPI_ERASE_BLOCK_SIZE \
801 QSPI_FLASH_FIP \
802 QSPI_FLASH_NITRO \
803 QSPI_FLASH_NITRO_BSPD_CONFIG \
804 QSPI_FLASH \
805 FLASH_IMAGES
Bharat Gootyd5ab69a2020-07-15 22:49:06 +0530806
807#define CONFIG_EXTRA_ENV_SETTINGS \
808 ARCH_ENV_SETTINGS
809
Rayagonda Kokatanur291635a2020-07-15 22:48:55 +0530810#endif /* __BCM_NS3_H */