blob: a57edf5238d3277750f361e603ddc50d0ef57b07 [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
Rayagonda Kokatanur1d8fa362020-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 Kokatanur1d8fa362020-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 Gooty208e79d2020-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 Gooty208e79d2020-07-15 22:49:06 +053044/* Access eMMC Boot_1 and Boot_2 partitions */
Bharat Gooty208e79d2020-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
280#define CONFIG_BOOTCOMMAND "run flash_pending_rfs_imgs;" \
281 "run fastboot_nitro && "\
282 "run bootcmd_mmc_fits || "\
283 "run bootcmd_usb || "\
284 "run bootcmd_pxe"
285
Bharat Gootydbece712020-07-15 22:49:07 +0530286/* Flashing commands */
287#define TFTP_QSPI_PARAM \
288 "fip_qspi_addr=0x0\0"\
289 "fip_qspi_mirror_addr=0x200000\0"\
290 "loadaddr=0x90000000\0"\
291 "tftpblocksize=1468\0"\
292 "qspi_flash_fip=fip\0"\
293
294/* Flash fit_GPT partition to eMMC */
295#define MMC_FLASH_FIT_GPT \
296 "mmc_flash_gpt="\
297 "if mmc dev ${sd_device_number}; then "\
298 "else "\
299 "echo [mmc_flash_gpt] mmc dev ${sd_device_number} "\
300 "** FAILED **;"\
301 "exit;"\
302 "fi;"\
303 "if gpt write mmc ${sd_device_number} ${fit_partitions}; then "\
304 "else "\
305 "echo [mmc_flash_gpt] gpt write ${fit_partitions} "\
306 "** FAILED **;"\
307 "exit;"\
308 "fi \0"
309
310#define MMC_FLASH_IMAGE_RSA \
311 "mmc_flash_image_rsa="\
312 "if mmc dev ${sd_device_number}; then "\
313 "else "\
314 "echo [mmc_flash_image_rsa] mmc dev ${sd_device_number} "\
315 "** FAILED **;"\
316 "exit;"\
317 "fi;"\
318 "if gpt setenv mmc ${sd_device_number} ${fit_image}; then "\
319 "else "\
320 "echo [mmc_flash_image_rsa] gpt setenv ${fit_image} "\
321 "** FAILED **;"\
322 "exit;"\
323 "fi;"\
324 "if tftp ${loadaddr} ${tftp_dir}${fit_image}; then "\
325 "if test ${fit_image} = Image_rsa.img; then "\
326 "if setenv tftp_fit_image yes; then "\
327 "else "\
328 "echo [mmc_flash_image_rsa] "\
329 "setenv tftp_fit_image to yes"\
330 "** FAILED **;"\
331 "exit;"\
332 "fi;"\
333 "fi;"\
334 "else "\
335 "if test ${fit_image} = Image_rsa.img; then "\
336 "echo [mmc_flash_image_rsa] tftp "\
337 "${tftp_dir}${fit_image} ** FAILED **;"\
338 "else "\
339 "if test ${tftp_fit_image} = yes; then "\
340 "if mmc write ${loadaddr} "\
341 "${gpt_partition_addr} "\
342 "${fileblocks}; then "\
343 "else "\
344 "echo "\
345 "[mmc_flash_image_rsa] "\
346 "mmc write "\
347 "${gpt_partition_addr} "\
348 "** FAILED **;"\
349 "exit;"\
350 "fi;"\
351 "else "\
352 "echo [mmc_flash_image_rsa] tftp "\
353 "${tftp_dir}${fit_image} "\
354 "** FAILED **;"\
355 "fi;"\
356 "fi;"\
357 "exit;"\
358 "fi;"\
359 "if math add filesize filesize 1FF; then "\
360 "else "\
361 "echo [mmc_flash_image_rsa] math add command ** FAILED **;"\
362 "exit;"\
363 "fi;"\
364 "if math div fileblocks filesize 200; then "\
365 "else "\
366 "echo [mmc_flash_image_rsa] math div command ** FAILED **;"\
367 "exit;"\
368 "fi;"\
369 "if mmc write ${loadaddr} ${gpt_partition_addr} ${fileblocks}; then "\
370 "else "\
371 "echo [mmc_flash_image_rsa] mmc write ${gpt_partition_addr} "\
372 "** FAILED **;"\
373 "exit;"\
374 "fi;"\
375 "if setenv image_sz_blk_cnt ${fileblocks}; then "\
376 "else "\
377 "echo [mmc_flash_image_rsa] setenv image_sz_blk_cnt ** "\
378 "FAILED **;"\
379 "exit;"\
380 "fi;"\
381 "if saveenv; then "\
382 "else "\
383 "echo [mmc_flash_image_rsa] saveenv command ** FAILED **;"\
384 "exit;"\
385 "fi \0"
386
387#define MMC_FLASH_RECOVERY \
388 "mmc_flash_recovery="\
389 "if mmc dev ${sd_device_number}; then "\
390 "else "\
391 "echo [mmc_flash_recovery] mmc dev ${sd_device_number} "\
392 "** FAILED **;"\
393 "exit;"\
394 "fi;"\
395 "if gpt setenv mmc ${sd_device_number} recovery; then "\
396 "else "\
397 "echo [mmc_flash_recovery] gpt setenv recovery ** FAILED **;"\
398 "exit;"\
399 "fi;"\
400 "setenv index 1;"\
401 "while tftp ${loadaddr} "\
402 "${tftp_dir}${gpt_partition_name}/chunk_00${index}; do "\
403 "if math add filesize filesize 1FF; then "\
404 "else "\
405 "echo [mmc_flash_recovery] math add command "\
406 "** FAILED **;"\
407 "exit;"\
408 "fi;"\
409 "if math div fileblocks filesize 200; then "\
410 "else "\
411 "echo [mmc_flash_recovery] math div command "\
412 "** FAILED **;"\
413 "exit;"\
414 "fi;"\
415 "if mmc write ${loadaddr} ${gpt_partition_addr} "\
416 "${fileblocks}; then "\
417 "else "\
418 "echo [mmc_flash_recovery] mmc write "\
419 "${gpt_partition_addr} ** FAILED **;"\
420 "exit;"\
421 "fi;"\
422 "if math add index index 1; then "\
423 "else "\
424 "echo [mmc_flash_recovery] math add command "\
425 "** FAILED **;"\
426 "exit;"\
427 "fi;"\
428 "if math add gpt_partition_addr gpt_partition_addr"\
429 " ${fileblocks}; then "\
430 "else "\
431 "echo [mmc_flash_recovery] math add command"\
432 " ** FAILED **;"\
433 "exit;"\
434 "fi;"\
435 "done;"\
436 "if itest ${index} -ne 1; then "\
437 "else "\
438 "echo [mmc_flash_recovery] "\
439 "${tftp_dir}${gpt_partition_name}/chunk_00${index} file "\
440 "not found ** FAILED **;"\
441 "exit;"\
442 "fi \0"
443
444#define MMC_FLASH_ROOTFS \
445 "mmc_flash_rootfs="\
446 "if mmc dev ${sd_device_number}; then "\
447 "else "\
448 "echo [mmc_flash_rootfs] mmc dev ${sd_device_number} "\
449 "** FAILED **;"\
450 "exit;"\
451 "fi;"\
452 "if gpt setenv mmc ${sd_device_number} rootfs; then "\
453 "else "\
454 "echo [mmc_flash_rootfs] gpt setenv rootfs ** FAILED **;"\
455 "exit;"\
456 "fi;"\
457 "setenv index 1;"\
458 "while tftp ${loadaddr} "\
459 "${tftp_dir}${gpt_partition_name}/chunk_00${index}; do "\
460 "if math add filesize filesize 1FF; then "\
461 "else "\
462 "echo [mmc_flash_rootfs] math add command "\
463 "** FAILED **;"\
464 "exit;"\
465 "fi;"\
466 "if math div fileblocks filesize 200; then "\
467 "else "\
468 "echo [mmc_flash_rootfs] math div command "\
469 "** FAILED **;"\
470 "exit;"\
471 "fi;"\
472 "if mmc write ${loadaddr} ${gpt_partition_addr} "\
473 "${fileblocks}; then "\
474 "else "\
475 "echo [mmc_flash_rootfs] mmc write "\
476 "${gpt_partition_addr} ** FAILED **;"\
477 "exit;"\
478 "fi;"\
479 "if math add index index 1; then "\
480 "else "\
481 "echo [mmc_flash_rootfs] math add command "\
482 "** FAILED **;"\
483 "exit;"\
484 "fi;"\
485 "if math add gpt_partition_addr gpt_partition_addr"\
486 " ${fileblocks}; then "\
487 "else "\
488 "echo [mmc_flash_rootfs] math add command"\
489 " ** FAILED **;"\
490 "exit;"\
491 "fi;"\
492 "done;"\
493 "if itest ${index} -ne 1; then "\
494 "else "\
495 "echo [mmc_flash_rootfs] "\
496 "${tftp_dir}${gpt_partition_name}/chunk_00${index} file "\
497 "not found ** FAILED **;"\
498 "exit;"\
499 "fi \0"
500
501/*
502 * For individual flash commands like mmc_flash_gpt, it is not
503 * necessary to check for errors.
504 * If any of its intermediate commands fails, then next commands
505 * will not execute. Script will exit from the failure command.
506 * For uniformity, checking for mmc_flash_gpt, mmc_flash_image_rsa
507 * mmc_flash_nitro and mmc_flash_rootfs
508 */
509#define MMC_FLASH \
510 "flash_mmc="\
511 "if run mmc_flash_gpt; then "\
512 "else "\
513 "echo [flash_mmc] run mmc_flash_gpt ** FAILED **;"\
514 "exit;"\
515 "fi;"\
516 "if setenv tftp_fit_image no; then "\
517 "else "\
518 "echo [flash_mmc] setenv tftp_fit_image to no "\
519 "** FAILED **;"\
520 "exit;"\
521 "fi;"\
522 "if setenv fit_image Image_rsa.img; then "\
523 "else "\
524 "echo [flash_mmc] setenv fit_image to Image_rsa.img "\
525 "** FAILED **;"\
526 "exit;"\
527 "fi;"\
528 "if run mmc_flash_image_rsa; then "\
529 "else "\
530 "echo [flash_mmc] run mmc_flash_image_rsa ** FAILED **;"\
531 "exit;"\
532 "fi;"\
533 "if setenv fit_image Image1_rsa.img; then "\
534 "else "\
535 "echo [flash_mmc] setenv fit_image to Image1_rsa.img "\
536 "** FAILED **;"\
537 "exit;"\
538 "fi;"\
539 "if run mmc_flash_image_rsa; then "\
540 "else "\
541 "echo [flash_mmc] run mmc_flash_image_rsa "\
542 "for Image1_rsa.img ** FAILED **;"\
543 "exit;"\
544 "fi;"\
545 "if setenv fit_image Image2_rsa.img; then "\
546 "else "\
547 "echo [flash_mmc] setenv fit_image to Image2_rsa.img "\
548 "** FAILED **;"\
549 "exit;"\
550 "fi;"\
551 "if run mmc_flash_image_rsa; then "\
552 "else "\
553 "echo [flash_mmc] run mmc_flash_image_rsa "\
554 "for Image2_rsa.img ** FAILED **;"\
555 "exit;"\
556 "fi;"\
557 "if run mmc_flash_recovery; then "\
558 "else "\
559 "echo [flash_mmc] run mmc_flash_recovery ** FAILED **;"\
560 "exit;"\
561 "fi;"\
562 "if run mmc_flash_rootfs; then "\
563 "else "\
564 "echo [flash_mmc] run mmc_flash_rootfs ** FAILED **;"\
565 "exit;"\
566 "fi \0"
567
568#define FUNC_ALIGN_QSPI_ERASE_BLOCK_SIZE \
569 "align_erase_blk_size=" \
570 "setenv fl_write_size 0;" \
571 "if math add fl_write_size filesize FFFF; then "\
572 "else "\
573 "echo ${errstr} math add command ** FAILED **;"\
574 "exit;"\
575 "fi;"\
576 "if math div fl_write_size fl_write_size 10000; then "\
577 "else "\
578 "echo ${errstr} math div command ** FAILED **;"\
579 "exit;"\
580 "fi;"\
581 "if math mul fl_write_size fl_write_size 10000; then "\
582 "else "\
583 "echo ${errstr} math mul command ** FAILED **;"\
584 "exit;"\
585 "fi \0"
586
587#define QSPI_FLASH_FIP \
588 "flash_fip="\
589 "if run qspi_access_en; then "\
590 "else "\
591 "echo [flash_fip] run qspi_access_en ** FAILED **;"\
592 "exit;"\
593 "fi;"\
594 "if tftp ${loadaddr} ${tftp_dir}fip.bin; then "\
595 "else "\
596 "echo [flash_fip] tftp ${tftp_dir}fip.bin "\
597 "** FAILED **;"\
598 "exit;"\
599 "fi;"\
600 "if math add tmpsize filesize FFFF; then "\
601 "else "\
602 "echo [flash_fip] math add command ** FAILED **;"\
603 "exit;"\
604 "fi;"\
605 "if math div tmpsize tmpsize 10000; then "\
606 "else "\
607 "echo [flash_fip] math div command ** FAILED **;"\
608 "exit;"\
609 "fi;"\
610 "if math mul tmpsize tmpsize 10000; then "\
611 "else "\
612 "echo [flash_fip] math mul command ** FAILED **;"\
613 "exit;"\
614 "fi;"\
615 "if sf probe 0; then "\
616 "else "\
617 "echo [flash_fip] sf probe command ** FAILED **;"\
618 "exit;"\
619 "fi;"\
620 "if sf erase ${fip_qspi_addr} ${tmpsize}; then "\
621 "else "\
622 "echo [flash_fip] sf erase ${fip_qspi_addr} ** FAILED **;"\
623 "exit;"\
624 "fi;"\
625 "if sf write ${loadaddr} ${fip_qspi_addr} ${filesize}; then "\
626 "else "\
627 "echo [flash_fip] sf write ${fip_qspi_addr} ** FAILED **;"\
628 "exit;"\
629 "fi;"\
630 /* Flash mirror FIP image */ \
631 "if sf erase ${fip_qspi_mirror_addr} ${tmpsize}; then "\
632 "else "\
633 "echo [flash_fip] sf erase ${fip_qspi_mirror_addr} "\
634 "** FAILED **;"\
635 "exit;"\
636 "fi;"\
637 "if sf write ${loadaddr} ${fip_qspi_mirror_addr} ${filesize}; then "\
638 "else "\
639 "echo [flash_fip] sf write ${fip_qspi_mirror_addr} "\
640 "** FAILED **;"\
641 "exit;"\
642 "fi \0"
643
644#define QSPI_FLASH_NITRO \
645 "flash_nitro="\
646 "run func_qspi_probe; "\
647 "if tftp ${loadaddr} ${tftp_dir}${nitro_bin}; then "\
648 "else "\
649 "echo [flash_nitro] tftp ${tftp_dir}${nitro_bin} "\
650 "** FAILED **;"\
651 "exit;"\
652 "fi;"\
653 "setenv errstr flash_nitro;" \
654 "run align_erase_blk_size;" \
655 /* Flash Nitro fw fit + configuration */ \
656 "if sf erase ${spi_nitro_img_bin_start} ${fl_write_size}; then "\
657 "else "\
658 "echo [flash_nitro] sf erase ${spi_nitro_img_bin_start} "\
659 "** FAILED **;"\
660 "exit;"\
661 "fi;"\
662 "if sf write ${loadaddr} ${spi_nitro_img_bin_start}" \
663 " ${fl_write_size}; then "\
664 "else "\
665 "echo [flash_nitro] sf write ${spi_nitro_bin_start} "\
666 "** FAILED **;"\
667 "exit;"\
668 "fi;"\
669 /* Mirror of Flash Nitro fw fit + configuration */ \
670 "if sf erase ${spi_nitro_img_bin_mirror_start} ${fl_write_size}; then "\
671 "else "\
672 "echo [flash_nitro] sf erase "\
673 "${spi_nitro_img_bin_mirror_start} "\
674 "** FAILED **;"\
675 "exit;"\
676 "fi;"\
677 "if sf write ${loadaddr} ${spi_nitro_img_bin_mirror_start}" \
678 " ${fl_write_size}; then "\
679 "else "\
680 "echo [flash_nitro] sf write "\
681 "${spi_nitro_img_bin_mirror_start} "\
682 "** FAILED **;"\
683 "exit;"\
684 "fi \0"
685
686#define QSPI_FLASH_NITRO_BSPD_CONFIG \
687 "flash_nitro_bspd_config="\
688 "run func_qspi_probe; "\
689 /* Flash BSPD configuration */ \
690 "if tftp ${loadaddr} ${tftp_dir}${nitro_bspd_cfg}; then "\
691 "setenv bspd_cfg_avialable 1; "\
692 "setenv errstr flash_nitro_bspd_config; "\
693 "run align_erase_blk_size;" \
694 "if sf erase ${spi_nitro_bspd_cfg_start} "\
695 "${fl_write_size}; then "\
696 "else "\
697 "echo [flash_nitro] sf erase "\
698 "${spi_nitro_bspd_cfg_start} "\
699 "** FAILED **;"\
700 "exit;"\
701 "fi;"\
702 "if sf write ${loadaddr} ${spi_nitro_bspd_cfg_start} "\
703 "${fl_write_size}; then "\
704 "else "\
705 "echo [flash_nitro] sf write "\
706 "${spi_nitro_bspd_cfg_start} "\
707 "** FAILED **;"\
708 "exit;"\
709 "fi;" \
710 /* Flash BSPD mirror configuration */ \
711 "if sf erase ${spi_nitro_bspd_mirror_cfg_start} "\
712 "${fl_write_size}; then "\
713 "else "\
714 "echo [flash_nitro] sf erase "\
715 "${spi_nitro_bspd_mirror_cfg_start} "\
716 "** FAILED **;"\
717 "exit;"\
718 "fi;"\
719 "if sf write ${loadaddr} ${spi_nitro_bspd_mirror_cfg_start} "\
720 "${fl_write_size}; then "\
721 "else "\
722 "echo [flash_nitro] sf write "\
723 "${spi_nitro_bspd_mirror_cfg_start} "\
724 "** FAILED **;"\
725 "exit;"\
726 "fi;" \
727 "else "\
728 "echo [flash_nitro] tftp ${tftp_dir}${nitro_bspd_cfg} "\
729 "** Skip flashing bspd config file **;"\
730 "fi \0"
731
732#define QSPI_FLASH \
733 "flash_qspi="\
734 "if run qspi_access_en; then "\
735 "else "\
736 "echo [flash_qspi] run qspi_access_en ** FAILED **;"\
737 "exit;"\
738 "fi;"\
739 "if run flash_fip; then "\
740 "else "\
741 "echo [flash_qspi] run flash_fip ** FAILED **;"\
742 "exit;"\
743 "fi;"\
744 "if run flash_nitro; then "\
745 "else "\
746 "echo [flash_qspi] run flash_nitro ** FAILED **;"\
747 "exit;"\
748 "fi \0"
749
750#define FLASH_IMAGES \
751 "flash_images=" \
752 "if run flash_qspi; then "\
753 "else "\
754 "echo [flash_images] run flash_qspi ** FAILED **;"\
755 "exit;"\
756 "fi;"\
757 "if run flash_mmc; then "\
758 "else "\
759 "echo [flash_images] run flash_mmc ** FAILED **;"\
760 "exit;"\
761 "fi \0"
762
Bharat Gooty208e79d2020-07-15 22:49:06 +0530763#define ARCH_ENV_SETTINGS \
764 CONSOLE_ARGS \
765 MAX_CPUS \
766 OS_LOG_LEVEL \
767 EXTRA_ARGS \
768 PCIE_ARGS \
769 ETH_ADDR \
770 RESERVED_MEM \
771 SETBOOTARGS \
772 UPDATEME_FLASH_PARAMS \
773 KERNEL_LOADADDR_CFG\
774 INITRD_ARGS \
775 INITRD_LOADADDR \
776 INITRD_IMAGE \
777 MMC_DEV \
778 EXEC_STATE \
779 EXT4RD_ARGS \
780 WDT_CNTRL \
781 ELOG_SETUP \
782 FIT_MMC_PARTITION \
783 QSPI_FLASH_NITRO_PARAMS \
784 QSPI_ACCESS_ENABLE \
785 FUNC_QSPI_PROBE \
786 NITRO_FW_IMAGES \
787 FASTBOOT_NITRO_SETUP \
788 FASTBOOT_SETUP \
789 CHECK_CHIMP_HS \
790 FASTBOOT_NITRO \
791 FIT_IMAGE \
792 BOOTCMD_MMC_FIT \
793 BOOTCMD_MMC_FITS \
794 USBDEV \
795 BOOTCMD_USB \
796 START_PCI \
797 BNXT_LOAD \
798 BOOTCMD_PXE \
Bharat Gootydbece712020-07-15 22:49:07 +0530799 FLASH_PENDING_RFS_IMGS \
800 TFTP_QSPI_PARAM \
801 MMC_FLASH_FIT_GPT \
802 MMC_FLASH_IMAGE_RSA \
803 MMC_FLASH_RECOVERY \
804 MMC_FLASH_ROOTFS \
805 MMC_FLASH \
806 FUNC_ALIGN_QSPI_ERASE_BLOCK_SIZE \
807 QSPI_FLASH_FIP \
808 QSPI_FLASH_NITRO \
809 QSPI_FLASH_NITRO_BSPD_CONFIG \
810 QSPI_FLASH \
811 FLASH_IMAGES
Bharat Gooty208e79d2020-07-15 22:49:06 +0530812
813#define CONFIG_EXTRA_ENV_SETTINGS \
814 ARCH_ENV_SETTINGS
815
Rayagonda Kokatanur1d8fa362020-07-15 22:48:55 +0530816#endif /* __BCM_NS3_H */