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