imx6: aristainetos: enable HAB 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 #define CONFIG_MXC_UART_BASE    UART2_BASE
17 #define CONSOLE_DEV     "ttymxc1"
18
19 #define CONFIG_FEC_XCV_TYPE             RGMII
20
21 /* Framebuffer */
22 #define CONFIG_SYS_LDB_CLOCK    28341000
23 #define CONFIG_LG4573
24
25 #include "mx6_common.h"
26
27 #define CONFIG_MACH_TYPE        4501
28 #define CONFIG_MMCROOT          "/dev/mmcblk0p1"
29
30 /* MMC Configs */
31 #define CONFIG_SYS_FSL_ESDHC_ADDR      USDHC1_BASE_ADDR
32
33 #define IMX_FEC_BASE                    ENET_BASE_ADDR
34 #define CONFIG_ETHPRIME                 "FEC"
35 #define CONFIG_FEC_MXC_PHYADDR          0
36
37 #define CONFIG_SYS_SPI_ST_ENABLE_WP_PIN
38
39 #ifdef CONFIG_IMX_HAB
40 #define HAB_EXTRA_SETTINGS \
41         "hab_check_addr=" \
42                 "if hab_auth_img ${check_addr} ${filesize} ; then " \
43                         "true;" \
44                 "else " \
45                         "echo \"HAB checks ${hab_check_filetype} " \
46                         "failed!\"; " \
47                         "false; " \
48                 "fi;\0" \
49         "hab_check_file_fit=" \
50                 "if env exists enable_hab_check && test " \
51                         "${enable_hab_check} -eq 1 ; then " \
52                         "setenv hab_check_filetype \"FIT file on SD card " \
53                         "or eMMC\";" \
54                         "env set check_addr ${fit_addr_r};" \
55                         "run hab_check_addr;" \
56                 "else " \
57                         "true; "\
58                 "fi;\0" \
59         "hab_check_file_bootscript=" \
60                 "if env exists enable_hab_check && test " \
61                         "${enable_hab_check} -eq 1 ; then " \
62                         "setenv hab_check_filetype \"Bootscript file\";" \
63                         "env set check_addr ${loadaddr};" \
64                         "run hab_check_addr;" \
65                 "else " \
66                         "true; "\
67                 "fi;\0" \
68         "hab_check_flash_fit=" \
69                 "if env exists enable_hab_check && test " \
70                         "${enable_hab_check} -eq 1 ; then " \
71                         "setenv hab_check_filetype \"FIT files on flash\";" \
72                         "env set check_addr ${fit_addr_r};" \
73                         "run hab_check_addr;" \
74                 "else " \
75                         "true; "\
76                 "fi;\0" \
77         "enable_hab_check=1\0"
78 #else
79 #define HAB_EXTRA_SETTINGS \
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 #define CONFIG_EXTRA_ENV_BOARD_SETTINGS \
90         "dead=led led_red on\0" \
91         "mtdids=nand0=gpmi-nand,nor0=spi3.1\0" \
92         "mtdparts=mtdparts=spi3.1:832k(u-boot),64k(env),64k(env-red)," \
93                 "-(ubi-nor);gpmi-nand:-(ubi)\0" \
94         "addmisc=setenv bootargs ${bootargs} net.ifnames=0 consoleblank=0 " \
95                 "bootmode=${bootmode} mmcpart=${mmcpart}\0" \
96         "mainboot=echo Booting from SD-card ...; " \
97                 "run mainargs addmtd addmisc;" \
98                 "if test -n ${addmiscM}; then run addmiscM;fi;" \
99                 "if test -n ${addmiscC}; then run addmiscC;fi;" \
100                 "if test -n ${addmiscD}; then run addmiscD;fi;" \
101                 "run boot_board_type;" \
102                 "bootm ${fit_addr_r}\0" \
103         "mainargs=setenv bootargs console=${console},${baudrate} " \
104                 "root=${mmcroot}\0" \
105         "main_load_fit=ext4load mmc ${mmcdev}:${mmcpart} ${fit_addr_r} " \
106                 "${fit_file}\0" \
107         "rescue_load_fit=ext4load mmc ${mmcdev}:${mmcrescuepart} " \
108                 "${fit_addr_r} ${rescue_fit_file}\0"
109
110 #define CONFIG_EXTRA_ENV_SETTINGS \
111         "disable_giga=yes\0" \
112         "usb_pgood_delay=2000\0" \
113         "nor_bootdelay=-2\0" \
114         "script=u-boot.scr\0" \
115         "fit_file=/boot/system.itb\0" \
116         "rescue_fit_file=/boot/rescue.itb\0" \
117         "loadaddr=0x12000000\0" \
118         "fit_addr_r=0x14000000\0" \
119         "uboot=/boot/u-boot.imx\0" \
120         "uboot_sz=d0000\0" \
121         "panel=lb07wv8\0" \
122         "splashpos=m,m\0" \
123         "console=" CONSOLE_DEV "\0" \
124         "fdt_high=0xffffffff\0"   \
125         "initrd_high=0xffffffff\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 addmisc addmiscM addmiscC addmiscD;" \
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         "mmcrescuepart=3\0" \
153         "mmcdev=0\0" \
154         "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
155         "mmcargs=setenv bootargs console=${console},${baudrate} " \
156                 "root=${mmcroot}\0" \
157         "mmcboot=echo Booting from mmc ...; " \
158                 "run mmcargs addmtd addmisc;" \
159                 "if test -n ${addmiscM}; then run addmiscM;fi;" \
160                 "if test -n ${addmiscC}; then run addmiscC;fi;" \
161                 "if test -n ${addmiscD}; then run addmiscD;fi;" \
162                 "run boot_board_type;" \
163                 "bootm ${fit_addr_r}\0" \
164         "mmc_load_fit=ext4load mmc ${mmcdev}:${mmcpart} ${fit_addr_r} " \
165                 "${fit_file}\0" \
166         "mmc_load_uboot=ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
167                 "${uboot}\0" \
168         "mmc_rescue_load_fit=ext4load mmc ${mmcdev}:${mmcrescuepart} " \
169                 "${fit_addr_r} ${rescue_fit_file}\0" \
170         "mmc_upd_uboot=mw.b ${loadaddr} 0xff ${uboot_sz};" \
171                 "setexpr cmp_buf ${loadaddr} + ${uboot_sz};" \
172                 "setexpr uboot_maxsize ${uboot_sz} - 400;" \
173                 "mw.b ${cmp_buf} 0x00 ${uboot_sz};" \
174                 "run mmc_load_uboot;sf probe;sf erase 0 ${uboot_sz};" \
175                 "sf write ${loadaddr} 400 ${filesize};" \
176                 "sf read ${cmp_buf} 400 ${uboot_sz};" \
177                 "cmp.b ${loadaddr} ${cmp_buf} ${uboot_maxsize}\0" \
178         "rescueargs=setenv bootargs console=${console},${baudrate} " \
179                 "root=/dev/ram rw\0 " \
180         "rescueboot=echo Booting rescue system ...; " \
181                 "run rescueargs addmtd addmisc;" \
182                 "if test -n ${rescue_reason}; then run rescue_reason;fi;" \
183                 "if test -n ${addmiscM}; then run addmiscM;fi;" \
184                 "if test -n ${addmiscC}; then run addmiscC;fi;" \
185                 "if test -n ${addmiscD}; then run addmiscD;fi;" \
186                 "run boot_board_type;" \
187                 "if bootm ${fit_addr_r}; then ; " \
188                 "else " \
189                         "run dead; " \
190                 "fi; \0" \
191         "r_reason_syserr=setenv rescue_reason setenv bootargs " \
192                 "\\\\${bootargs} " \
193         "rescueReason=18\0 " \
194         "usb_load_fit=ext4load usb 0 ${fit_addr_r} ${fit_file}\0" \
195         "usb_load_fitf=fatload usb 0 ${fit_addr_r} ${fit_file}\0" \
196         "usb_load_rescuefit=ext4load usb 0 ${fit_addr_r} " \
197                 "${rescue_fit_file}\0" \
198         "usb_load_rescuefitf=fatload usb 0 ${fit_addr_r} " \
199                 "${rescue_fit_file}\0" \
200         "usbroot=/dev/sda1 rootwait rw\0" \
201         "usbboot=echo Booting from usb-stick ...; " \
202                 "run usbargs addmtd addmisc;" \
203                 "if test -n ${addmiscM}; then run addmiscM;fi;" \
204                 "if test -n ${addmiscC}; then run addmiscC;fi;" \
205                 "if test -n ${addmiscD}; then run addmiscD;fi;" \
206                 "run boot_board_type;" \
207                 "bootm ${fit_addr_r}\0" \
208         "usbargs=setenv bootargs console=${console},${baudrate} " \
209                 "root=${usbroot}\0" \
210         "mmc_rescue_boot=" \
211                 "run r_reason_syserr;" \
212                 "if run mmc_rescue_load_fit hab_check_file_fit; then " \
213                         "run rescueboot; " \
214                 "else " \
215                         "run dead; " \
216                         "echo RESCUE SYSTEM FROM SD-CARD BOOT FAILURE;" \
217                 "fi;\0" \
218         "main_rescue_boot=" \
219                 "if run main_load_fit hab_check_flash_fit; then " \
220                         "if run mainboot; then ; " \
221                         "else " \
222                                 "run r_reason_syserr;" \
223                                 "if run rescue_load_fit hab_check_file_fit;" \
224                                         "then run rescueboot; " \
225                                 "else " \
226                                         "run dead; " \
227                                         "echo RESCUE SYSTEM BOOT FAILURE;" \
228                                 "fi; " \
229                         "fi; " \
230                 "else " \
231                         "run r_reason_syserr;" \
232                         "if run rescue_load_fit hab_check_file_fit; then " \
233                                 "run rescueboot; " \
234                         "else " \
235                                 "run dead; " \
236                                 "echo RESCUE SYSTEM BOOT FAILURE;" \
237                         "fi; " \
238                 "fi;\0" \
239         "usb_mmc_rescue_boot=" \
240                 "usb start;" \
241                 "if usb storage; then " \
242                         "if run loadbootscriptUSB " \
243                                 "hab_check_file_bootscript;" \
244                                 "then run bootscriptUSB; " \
245                         "fi; " \
246                         "if run loadbootscriptUSBf " \
247                                 "hab_check_file_bootscript;" \
248                                 "then run bootscriptUSB; " \
249                         "fi; " \
250                         "if run usb_load_fit hab_check_file_fit; then " \
251                                 "run usbboot; " \
252                         "fi; " \
253                         "if run usb_load_fitf hab_check_file_fit; then " \
254                                 "run usbboot; " \
255                         "fi; "\
256                         "if run usb_load_rescuefit hab_check_file_fit;" \
257                                 "then run r_reason_syserr rescueboot;" \
258                         "fi; " \
259                         "if run usb_load_rescuefitf hab_check_file_fit;" \
260                                 "then run r_reason_syserr rescueboot;" \
261                         "fi; " \
262                         "run mmc_rescue_boot;" \
263                 "fi; "\
264                 "run mmc_rescue_boot;\0" \
265         "rescue_xload_boot=" \
266                 "run r_reason_syserr;" \
267                 "if test ${bootmode} -ne 0 ; then " \
268                         "mmc dev ${mmcdev};" \
269                         "if mmc rescan; then " \
270                                 "if run mmc_rescue_load_fit " \
271                                         "hab_check_file_fit; then " \
272                                         "run rescueboot; " \
273                                 "else " \
274                                         "usb start;" \
275                                         "if usb storage; then " \
276                                                 "if run usb_load_rescuefit " \
277                                                         "hab_check_file_fit;"\
278                                                         "then " \
279                                                         "run rescueboot;" \
280                                                 "fi; " \
281                                                 "if run usb_load_rescuefitf "\
282                                                         "hab_check_file_fit;"\
283                                                         "then " \
284                                                         "run rescueboot;" \
285                                                 "fi; " \
286                                         "fi;" \
287                                 "fi;" \
288                                 "run dead; " \
289                                 "echo RESCUE SYSTEM ON SD OR " \
290                                         "USB BOOT FAILURE;" \
291                         "else " \
292                                 "usb start;" \
293                                 "if usb storage; then " \
294                                         "if run usb_load_rescuefit " \
295                                                 "hab_check_file_fit; then " \
296                                                 "run rescueboot;" \
297                                         "fi; " \
298                                         "if run usb_load_rescuefitf " \
299                                                 "hab_check_file_fit; then " \
300                                                 "run rescueboot;" \
301                                         "fi; " \
302                                 "fi;" \
303                                 "run dead; " \
304                                 "echo RESCUE SYSTEM ON USB BOOT FAILURE;" \
305                         "fi; " \
306                 "else "\
307                         "if run rescue_load_fit hab_check_file_fit; then " \
308                                 "run rescueboot; " \
309                         "else " \
310                                 "run dead; " \
311                                 "echo RESCUE SYSTEM ON BOARD BOOT FAILURE;" \
312                         "fi; " \
313                 "fi;\0" \
314         "ari_boot=if test ${bootmode} -ne 0 ; then " \
315                 "mmc dev ${mmcdev};" \
316                 "if mmc rescan; then " \
317                         "if run loadbootscript hab_check_file_bootscript;" \
318                                 "then run bootscript; " \
319                         "fi; " \
320                         "if run mmc_load_fit hab_check_file_fit; then " \
321                                 "if run mmcboot; then ; " \
322                                 "else " \
323                                         "run mmc_rescue_boot;" \
324                                 "fi; " \
325                         "else " \
326                                 "run usb_mmc_rescue_boot;" \
327                         "fi; " \
328                 "else " \
329                         "run usb_mmc_rescue_boot;" \
330                 "fi; " \
331         "else "\
332                 "run main_rescue_boot;" \
333         "fi; \0"\
334         HAB_EXTRA_SETTINGS \
335         CONFIG_EXTRA_ENV_BOARD_SETTINGS
336
337 #define CONFIG_ARP_TIMEOUT              200UL
338
339 #define CONFIG_SYS_MEMTEST_START        PHYS_SDRAM
340 #define CONFIG_SYS_MEMTEST_END          (CONFIG_SYS_MEMTEST_START + 0x100000)
341 #define CONFIG_SYS_MEMTEST_SCRATCH      0x10800000
342
343 /* Physical Memory Map */
344 #define PHYS_SDRAM                      MMDC0_ARB_BASE_ADDR
345
346 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM
347 #define CONFIG_SYS_INIT_RAM_ADDR        IRAM_BASE_ADDR
348 #define CONFIG_SYS_INIT_RAM_SIZE        IRAM_SIZE
349
350 #define CONFIG_SYS_INIT_SP_OFFSET \
351         (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
352 #define CONFIG_SYS_INIT_SP_ADDR \
353         (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
354
355 #define CONFIG_SYS_FSL_USDHC_NUM        2
356
357 /* NAND stuff */
358 #define CONFIG_SYS_MAX_NAND_DEVICE      1
359 #define CONFIG_SYS_NAND_BASE            0x40000000
360 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
361 #define CONFIG_SYS_NAND_ONFI_DETECTION
362
363 /* DMA stuff, needed for GPMI/MXS NAND support */
364
365 /* USB Configs */
366 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET        /* For OTG port */
367 #define CONFIG_MXC_USB_PORTSC   (PORT_PTS_UTMI | PORT_PTS_PTW)
368 #define CONFIG_MXC_USB_FLAGS    0
369
370 /* UBI support */
371
372 /* Framebuffer */
373 /* check this console not needed, after test remove it */
374 #define CONFIG_SPLASH_SCREEN
375 #define CONFIG_SPLASH_SCREEN_ALIGN
376 #define CONFIG_IMX_VIDEO_SKIP
377 #define CONFIG_VIDEO_LOGO
378 #define CONFIG_VIDEO_BMP_LOGO
379 #define CONFIG_BMP_16BPP
380 #define CONFIG_VIDEO_BMP_RLE8
381
382 #define CONFIG_IMX6_PWM_PER_CLK 66000000
383
384 #endif                         /* __ARISTAINETOS2_CONFIG_H */