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