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