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