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