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