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