bcm_ns3.h 21 KB

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