aristainetos2.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2015
  4. * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  5. *
  6. * Based on:
  7. * Copyright (C) 2012 Freescale Semiconductor, Inc.
  8. *
  9. * Configuration settings for the Freescale i.MX6DL aristainetos2 board.
  10. */
  11. #ifndef __ARISTAINETOS2_CONFIG_H
  12. #define __ARISTAINETOS2_CONFIG_H
  13. #define CONFIG_HOSTNAME "aristainetos2"
  14. #if (CONFIG_SYS_BOARD_VERSION == 5)
  15. #define CONFIG_MXC_UART_BASE UART2_BASE
  16. #define CONSOLE_DEV "ttymxc1"
  17. #elif (CONFIG_SYS_BOARD_VERSION == 6)
  18. #define CONFIG_MXC_UART_BASE UART1_BASE
  19. #define CONSOLE_DEV "ttymxc0"
  20. #endif
  21. #define CONFIG_FEC_XCV_TYPE RGMII
  22. /* Framebuffer */
  23. #define CONFIG_SYS_LDB_CLOCK 28341000
  24. #include "mx6_common.h"
  25. #define CONFIG_MACH_TYPE 4501
  26. #define CONFIG_MMCROOT "/dev/mmcblk0p1"
  27. /* MMC Configs */
  28. #define CONFIG_SYS_FSL_ESDHC_ADDR USDHC1_BASE_ADDR
  29. #define IMX_FEC_BASE ENET_BASE_ADDR
  30. #define CONFIG_ETHPRIME "FEC"
  31. #define CONFIG_FEC_MXC_PHYADDR 0
  32. #define CONFIG_SYS_SPI_ST_ENABLE_WP_PIN
  33. #ifdef CONFIG_IMX_HAB
  34. #define HAB_EXTRA_SETTINGS \
  35. "hab_check_addr=" \
  36. "if hab_auth_img ${check_addr} ${filesize} ; then " \
  37. "true;" \
  38. "else " \
  39. "echo \"HAB checks ${hab_check_filetype} " \
  40. "failed!\"; " \
  41. "false; " \
  42. "fi;\0" \
  43. "hab_check_file_fit=" \
  44. "if env exists enable_hab_check && test " \
  45. "${enable_hab_check} -eq 1 ; then " \
  46. "setenv hab_check_filetype \"FIT file on SD card " \
  47. "or eMMC\";" \
  48. "env set check_addr ${fit_addr_r};" \
  49. "run hab_check_addr;" \
  50. "else " \
  51. "true; "\
  52. "fi;\0" \
  53. "hab_check_file_bootscript=" \
  54. "if env exists enable_hab_check && test " \
  55. "${enable_hab_check} -eq 1 ; then " \
  56. "setenv hab_check_filetype \"Bootscript file\";" \
  57. "env set check_addr ${loadaddr};" \
  58. "run hab_check_addr;" \
  59. "else " \
  60. "true; "\
  61. "fi;\0" \
  62. "hab_check_flash_fit=" \
  63. "if env exists enable_hab_check && test " \
  64. "${enable_hab_check} -eq 1 ; then " \
  65. "setenv hab_check_filetype \"FIT files on flash\";" \
  66. "env set check_addr ${fit_addr_r};" \
  67. "run hab_check_addr;" \
  68. "else " \
  69. "true; "\
  70. "fi;\0" \
  71. "enable_hab_check=1\0"
  72. #else
  73. #define HAB_EXTRA_SETTINGS \
  74. "hab_check_addr=echo HAB check addr always returns " \
  75. "true;true\0" \
  76. "hab_check_file_fit=echo HAB check FIT file always returns " \
  77. "true;true\0" \
  78. "hab_check_flash_fit=echo HAB check flash FIT always returns " \
  79. "true;true\0" \
  80. "hab_check_file_bootscript=echo HAB check bootscript always " \
  81. "returns true;true\0" \
  82. "enable_hab_check=0\0"
  83. #endif
  84. #if (CONFIG_SYS_BOARD_VERSION == 5)
  85. #define CONFIG_EXTRA_ENV_BOARD_SETTINGS \
  86. "dead=while true; do; " \
  87. "led led_red on; sleep 1;" \
  88. "led led_red off; sleep 1;" \
  89. "done\0"
  90. #elif (CONFIG_SYS_BOARD_VERSION == 6)
  91. #define CONFIG_EXTRA_ENV_BOARD_SETTINGS \
  92. "dead=while true; do; " \
  93. "led led_red on; led led_red2 on; sleep 1;" \
  94. "led led_red off; led led_red2 off;; sleep 1;" \
  95. "done\0"
  96. #endif
  97. #define CONFIG_EXTRA_ENV_SETTINGS \
  98. "disable_giga=yes\0" \
  99. "usb_pgood_delay=2000\0" \
  100. "nor_bootdelay=-2\0" \
  101. "script=u-boot.scr\0" \
  102. "loadaddr=0x12000000\0" \
  103. "fit_addr_r=0x14000000\0" \
  104. "uboot_sz=d0000\0" \
  105. "panel=lb07wv8\0" \
  106. "splashpos=m,m\0" \
  107. "console=" CONSOLE_DEV "\0" \
  108. "emmcroot=/dev/mmcblk1p1 rootwait rw\0" \
  109. "mtdids=nor0=spi0.0\0" \
  110. "mtdparts=mtdparts=spi0.0:832k(u-boot),64k(env),64k(env-red)," \
  111. "-(ubi-nor)\0" \
  112. "mk_fitfile_path=setenv fit_file /${sysnum}/system.itb\0" \
  113. "mk_rescue_fitfile_path=setenv rescue_fit_file /${rescue_sysnum}/system.itb\0" \
  114. "mk_uboot_path=setenv uboot /${sysnum}/u-boot.imx\0" \
  115. "mk_pubkey_path=setenv pubkey /${sysnum}/PCR.pem\0" \
  116. "mk_rescue_pubkey_path=setenv pubkey /${rescue_sysnum}/PCR.pem\0" \
  117. "addmisc=setenv bootargs ${bootargs} net.ifnames=0 consoleblank=0 " \
  118. "bootmode=${bootmode} rng_core.default_quality=1000 " \
  119. "mmcpart=${mmcpart} emmcpart=${emmcpart} sysnum=${sysnum}\0" \
  120. "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
  121. "boot_board_type=bootm ${fit_addr_r}#${board_type}\0" \
  122. "get_env=mw ${loadaddr} 0 0x20000;" \
  123. "mmc rescan;" \
  124. "ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} env.txt;" \
  125. "env import -t ${loadaddr}\0" \
  126. "default_env=gpio set wp_spi_nor.gpio-hog;" \
  127. "sf probe;" \
  128. "sf protect unlock 0 0x1000000;" \
  129. "mw ${loadaddr} 0 0x20000;" \
  130. "env export -t ${loadaddr} serial# ethaddr " \
  131. "board_type panel;" \
  132. "env default -a;" \
  133. "env import -t ${loadaddr}\0" \
  134. "loadbootscript=" \
  135. "ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
  136. "${script};\0" \
  137. "loadbootscriptUSB=" \
  138. "ext4load usb 0 ${loadaddr} ${script};\0" \
  139. "loadbootscriptUSBf=" \
  140. "fatload usb 0 ${loadaddr} ${script};\0" \
  141. "bootscriptUSB=echo Running bootscript from usb-stick ...; " \
  142. "source \0" \
  143. "bootscript=echo Running bootscript from mmc ...; " \
  144. "source \0" \
  145. "mmcpart=1\0" \
  146. "mmcdev=0\0" \
  147. "emmcpart=1\0" \
  148. "emmcdev=1\0" \
  149. "sysnum=1\0" \
  150. "rescue_sysnum=0\0" \
  151. "rreason=18\0" \
  152. "mainboot=echo Booting from eMMC ...; " \
  153. "run mainargs addmtd addmisc;" \
  154. "run boot_board_type;" \
  155. "bootm ${fit_addr_r}\0" \
  156. "mainargs=setenv bootargs console=${console},${baudrate} " \
  157. "root=${emmcroot} rootfstype=ext4\0 " \
  158. "main_load_fit=run mk_fitfile_path; " \
  159. "ext4load mmc ${emmcdev}:${emmcpart} ${fit_addr_r} " \
  160. "${fit_file}; " \
  161. "imi ${fit_addr_r}\0 " \
  162. "rescue_load_fit=run mk_rescue_fitfile_path; " \
  163. "ext4load mmc ${emmcdev}:${emmcpart} ${fit_addr_r} " \
  164. "${rescue_fit_file}; " \
  165. "imi ${fit_addr_r}\0" \
  166. "main_load_pubkey=run mk_pubkey_path; " \
  167. "setenv hab_check_filetype \"PCR.pem\";" \
  168. "env set check_addr ${loadaddr};" \
  169. "ext4load mmc ${emmcdev}:${emmcpart} ${loadaddr} " \
  170. "${pubkey}\0" \
  171. "rescue_load_pubkey=run mk_rescue_pubkey_path; " \
  172. "setenv hab_check_filetype \"PCR.pem\";" \
  173. "env set check_addr ${loadaddr};" \
  174. "ext4load mmc ${emmcdev}:${emmcpart} ${loadaddr} " \
  175. "${pubkey}\0" \
  176. "mainRargs=setenv bootargs console=${console},${baudrate} " \
  177. "rescue_sysnum=${rescue_sysnum} root=${emmcroot} rootfstype=ext4\0" \
  178. "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
  179. "mmcargs=setenv bootargs console=${console},${baudrate} " \
  180. "root=${mmcroot}\0" \
  181. "mmcRargs=setenv bootargs console=${console},${baudrate} " \
  182. "rescue_sysnum=${rescue_sysnum} root=${mmcroot}\0" \
  183. "mmcboot=echo Booting from mmc ...; " \
  184. "run mmcargs addmtd addmisc;" \
  185. "run boot_board_type;" \
  186. "bootm ${fit_addr_r}\0" \
  187. "mmc_load_fit=run mk_fitfile_path; " \
  188. "ext4load mmc ${mmcdev}:${mmcpart} ${fit_addr_r} " \
  189. "${fit_file}\0" \
  190. "imi ${fit_addr_r}\0" \
  191. "mmc_rescue_load_fit=run mk_rescue_fitfile_path; " \
  192. "ext4load mmc ${mmcdev}:${mmcpart} " \
  193. "${fit_addr_r} ${rescue_fit_file}\0" \
  194. "imi ${fit_addr_r}\0" \
  195. "mmc_load_uboot=run mk_uboot_path; " \
  196. "ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
  197. "${uboot}\0" \
  198. "mmc_upd_uboot=mw.b ${loadaddr} 0xff ${uboot_sz};" \
  199. "setexpr cmp_buf ${loadaddr} + ${uboot_sz};" \
  200. "setexpr uboot_maxsize ${uboot_sz} - 400;" \
  201. "mw.b ${cmp_buf} 0x00 ${uboot_sz};" \
  202. "run mmc_load_uboot;sf probe;sf erase 0 ${uboot_sz};" \
  203. "sf write ${loadaddr} 400 ${filesize};" \
  204. "sf read ${cmp_buf} 400 ${uboot_sz};" \
  205. "cmp.b ${loadaddr} ${cmp_buf} ${uboot_maxsize}\0" \
  206. "mmc_load_pubkey=run mk_pubkey_path; " \
  207. "setenv hab_check_filetype \"PCR.pem\";" \
  208. "env set check_addr ${loadaddr};" \
  209. "ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
  210. "${pubkey}\0" \
  211. "mmc_rescue_load_pubkey=run mk_rescue_pubkey_path; " \
  212. "setenv hab_check_filetype \"PCR.pem\";" \
  213. "env set check_addr ${loadaddr};" \
  214. "ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
  215. "${pubkey}\0" \
  216. "rescueboot=echo Booting rescue system ...; " \
  217. "run addmtd addmisc;" \
  218. "if test -n ${rescue_reason}; then run rescue_reason;fi;" \
  219. "run boot_board_type;" \
  220. "if bootm ${fit_addr_r}; then ; " \
  221. "else " \
  222. "run dead; " \
  223. "fi; \0" \
  224. "r_reason_syserr=setenv rescue_reason setenv bootargs " \
  225. "\\\\${bootargs} " \
  226. "rescueReason=$rreason\0 " \
  227. "usb_load_fit=run mk_fitfile_path; " \
  228. "ext4load usb 0 ${fit_addr_r} ${fit_file}\0" \
  229. "usb_load_fitf=run mk_fitfile_path; " \
  230. "fatload usb 0 ${fit_addr_r} ${fit_file}\0" \
  231. "usb_load_rescuefit=run mk_rescue_fitfile_path; " \
  232. "ext4load usb 0 ${fit_addr_r} " \
  233. "${rescue_fit_file}\0" \
  234. "usb_load_rescuefitf=run mk_rescue_fitfile_path; " \
  235. "fatload usb 0 ${fit_addr_r} " \
  236. "${rescue_fit_file}\0" \
  237. "usb_load_pubkey=run mk_pubkey_path; " \
  238. "setenv hab_check_filetype \"PCR.pem\";" \
  239. "env set check_addr ${loadaddr};" \
  240. "ext4load usb 0 ${loadaddr} ${pubkey}\0" \
  241. "usb_rescue_load_pubkey=run mk_rescue_pubkey_path; " \
  242. "setenv hab_check_filetype \"PCR.pem\";" \
  243. "env set check_addr ${loadaddr};" \
  244. "ext4load usb 0 ${loadaddr} ${pubkey}\0" \
  245. "usb_load_pubkeyf=run mk_pubkey_path; " \
  246. "setenv hab_check_filetype \"PCR.pem\";" \
  247. "env set check_addr ${loadaddr};" \
  248. "fatload usb 0 ${loadaddr} ${pubkey}\0" \
  249. "usb_rescue_load_pubkeyf=run mk_rescue_pubkey_path; " \
  250. "setenv hab_check_filetype \"PCR.pem\";" \
  251. "env set check_addr ${loadaddr};" \
  252. "fatload usb 0 ${loadaddr} ${pubkey}\0" \
  253. "usbroot=/dev/sda1 rootwait rw\0" \
  254. "usbboot=echo Booting from usb-stick ...; " \
  255. "run usbargs addmtd addmisc;" \
  256. "run boot_board_type;" \
  257. "bootm ${fit_addr_r}\0" \
  258. "usbargs=setenv bootargs console=${console},${baudrate} " \
  259. "root=${usbroot}\0" \
  260. "usbRargs=setenv bootargs console=${console},${baudrate} " \
  261. "rescue_sysnum=${rescue_sysnum} root=${usbroot} rw\0 " \
  262. "mmc_rescue_boot=" \
  263. "run r_reason_syserr;" \
  264. "if run mmc_rescue_load_pubkey hab_check_addr " \
  265. "mmc_rescue_load_fit hab_check_file_fit; then " \
  266. "run mmcRargs; run rescueboot; " \
  267. "else " \
  268. "echo RESCUE SYSTEM FROM SD-CARD BOOT FAILURE;" \
  269. "run dead; " \
  270. "fi;\0" \
  271. "main_rescue_boot=" \
  272. "if run main_load_pubkey hab_check_addr " \
  273. "main_load_fit hab_check_flash_fit; then " \
  274. "if run mainboot; then ; " \
  275. "else " \
  276. "run r_reason_syserr;" \
  277. "if run rescue_load_pubkey hab_check_addr " \
  278. "rescue_load_fit hab_check_file_fit; then " \
  279. "run mainRargs; run rescueboot; " \
  280. "else " \
  281. "echo RESCUE SYSTEM BOOT FAILURE;" \
  282. "run dead; " \
  283. "fi; " \
  284. "fi; " \
  285. "else " \
  286. "run r_reason_syserr;" \
  287. "if run rescue_load_pubkey hab_check_addr " \
  288. "rescue_load_fit hab_check_file_fit; then " \
  289. "run mainRargs; run rescueboot; " \
  290. "else " \
  291. "echo RESCUE SYSTEM BOOT FAILURE;" \
  292. "run dead; " \
  293. "fi; " \
  294. "fi;\0" \
  295. "usb_mmc_rescue_boot=" \
  296. "usb start;" \
  297. "if usb storage; then " \
  298. "if run loadbootscriptUSB " \
  299. "hab_check_file_bootscript;" \
  300. "then run bootscriptUSB; " \
  301. "fi; " \
  302. "if run loadbootscriptUSBf " \
  303. "hab_check_file_bootscript;" \
  304. "then run bootscriptUSB; " \
  305. "fi; " \
  306. "if run usb_load_pubkey hab_check_addr " \
  307. "usb_load_fit hab_check_file_fit; then " \
  308. "run usbboot; " \
  309. "fi; " \
  310. "if run usb_load_pubkeyf hab_check_addr " \
  311. "usb_load_fitf hab_check_file_fit; then " \
  312. "run usbboot; " \
  313. "fi; "\
  314. "if run usb_rescue_load_pubkey hab_check_addr " \
  315. "usb_load_rescuefit hab_check_file_fit; then " \
  316. "run r_reason_syserr usbRargs; run rescueboot;" \
  317. "fi; " \
  318. "if run usb_rescue_load_pubkeyf hab_check_addr " \
  319. "usb_load_rescuefitf hab_check_file_fit; then " \
  320. "run r_reason_syserr usbRargs; run rescueboot;" \
  321. "fi; " \
  322. "run mmc_rescue_boot;" \
  323. "fi; "\
  324. "run mmc_rescue_boot;\0" \
  325. "rescue_xload_boot=" \
  326. "run r_reason_syserr;" \
  327. "if test ${bootmode} -ne 0 ; then " \
  328. "mmc dev ${mmcdev};" \
  329. "if mmc rescan; then " \
  330. "if run mmc_rescue_load_pubkey " \
  331. "hab_check_addr " \
  332. "mmc_rescue_load_fit " \
  333. "hab_check_file_fit; then " \
  334. "run mmcRargs; run rescueboot; " \
  335. "else " \
  336. "usb start;" \
  337. "if usb storage; then " \
  338. "if run usb_rescue_load_pubkey " \
  339. "hab_check_addr " \
  340. "usb_load_rescuefit " \
  341. "hab_check_file_fit; then " \
  342. "run usbRargs; run rescueboot;" \
  343. "fi; " \
  344. "if run usb_rescue_load_pubkeyf " \
  345. "hab_check_addr " \
  346. "usb_load_rescuefitf " \
  347. "hab_check_file_fit; then " \
  348. "run usbRargs; run rescueboot;" \
  349. "fi; " \
  350. "fi;" \
  351. "fi;" \
  352. "echo RESCUE SYSTEM ON SD OR " \
  353. "USB BOOT FAILURE;" \
  354. "run dead; " \
  355. "else " \
  356. "usb start;" \
  357. "if usb storage; then " \
  358. "if run usb_rescue_load_pubkey " \
  359. "hab_check_addr " \
  360. "usb_load_rescuefit " \
  361. "hab_check_file_fit; then " \
  362. "run usbRargs; run rescueboot;" \
  363. "fi; " \
  364. "if run usb_rescue_load_pubkeyf " \
  365. "hab_check_addr " \
  366. "usb_load_rescuefitf " \
  367. "hab_check_file_fit; then " \
  368. "run usbRargs; run rescueboot;" \
  369. "fi; " \
  370. "fi;" \
  371. "echo RESCUE SYSTEM ON USB BOOT FAILURE;" \
  372. "run dead; " \
  373. "fi; " \
  374. "else "\
  375. "if run rescue_load_pubkey hab_check_addr " \
  376. "rescue_load_fit hab_check_file_fit; then " \
  377. "run mainRargs; run rescueboot; " \
  378. "else " \
  379. "echo RESCUE SYSTEM ON BOARD BOOT FAILURE;" \
  380. "run dead; " \
  381. "fi; " \
  382. "fi;\0" \
  383. "ari_boot=if test ${bootmode} -ne 0 ; then " \
  384. "mmc dev ${mmcdev};" \
  385. "if mmc rescan; then " \
  386. "if run loadbootscript hab_check_file_bootscript;" \
  387. "then run bootscript; " \
  388. "fi; " \
  389. "if run mmc_load_pubkey hab_check_addr " \
  390. "mmc_load_fit hab_check_file_fit; then " \
  391. "if run mmcboot; then ; " \
  392. "else " \
  393. "run mmc_rescue_boot;" \
  394. "fi; " \
  395. "else " \
  396. "run usb_mmc_rescue_boot;" \
  397. "fi; " \
  398. "else " \
  399. "run usb_mmc_rescue_boot;" \
  400. "fi; " \
  401. "else "\
  402. "run main_rescue_boot;" \
  403. "fi; \0"\
  404. HAB_EXTRA_SETTINGS \
  405. CONFIG_EXTRA_ENV_BOARD_SETTINGS
  406. #define CONFIG_ARP_TIMEOUT 200UL
  407. /* Physical Memory Map */
  408. #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
  409. #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
  410. #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
  411. #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
  412. #define CONFIG_SYS_INIT_SP_OFFSET \
  413. (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
  414. #define CONFIG_SYS_INIT_SP_ADDR \
  415. (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
  416. #define CONFIG_SYS_FSL_USDHC_NUM 2
  417. /* DMA stuff, needed for GPMI/MXS NAND support */
  418. /* USB Configs */
  419. #define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
  420. #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
  421. #define CONFIG_MXC_USB_FLAGS 0
  422. /* UBI support */
  423. /* Framebuffer */
  424. /* check this console not needed, after test remove it */
  425. #define CONFIG_IMX_VIDEO_SKIP
  426. #define CONFIG_VIDEO_LOGO
  427. #define CONFIG_VIDEO_BMP_LOGO
  428. #define CONFIG_IMX6_PWM_PER_CLK 66000000
  429. #define CONFIG_ENV_FLAGS_LIST_STATIC "ethaddr:mw,serial#:sw,board_type:sw," \
  430. "sysnum:dw,panel:sw,ipaddr:iw,serverip:iw"
  431. #endif /* __ARISTAINETOS2_CONFIG_H */