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