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