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