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