bcm_ns3.h 21 KB

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