Merge tag 'v2021.10-rc5' into next
[platform/kernel/u-boot.git] / include / configs / warp7.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2016 NXP Semiconductors
4  *
5  * Configuration settings for the i.MX7S Warp board.
6  */
7
8 #ifndef __WARP7_CONFIG_H
9 #define __WARP7_CONFIG_H
10
11 #include "mx7_common.h"
12 #include <imximage.h>
13
14 #define PHYS_SDRAM_SIZE                 SZ_512M
15
16 /* MMC Config*/
17 #define CONFIG_SYS_FSL_ESDHC_ADDR       USDHC3_BASE_ADDR
18 #define CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE
19 #define CONFIG_SYS_MMC_IMG_LOAD_PART    1
20
21 #define CONFIG_DFU_ENV_SETTINGS \
22         "dfu_alt_info=boot raw 0x2 0x1000 mmcpart 1\0" \
23
24 /* When booting with FIT specify the node entry containing boot.scr */
25 #if defined(CONFIG_FIT)
26 #define BOOT_SCR_STRING "source ${bootscriptaddr}:${bootscr_fitimage_name}\0"
27 #else
28 #define BOOT_SCR_STRING "source ${bootscriptaddr}\0"
29 #endif
30
31 #ifndef CONFIG_OPTEE_LOAD_ADDR
32 #define CONFIG_OPTEE_LOAD_ADDR 0
33 #endif
34
35 #define CONFIG_EXTRA_ENV_SETTINGS \
36         CONFIG_DFU_ENV_SETTINGS \
37         "script=boot.scr\0" \
38         "bootscr_fitimage_name=bootscr\0" \
39         "script_signed=boot.scr.imx-signed\0" \
40         "bootscriptaddr=0x83200000\0" \
41         "image=zImage\0" \
42         "console=ttymxc0\0" \
43         "ethact=usb_ether\0" \
44         "fdt_high=0xffffffff\0" \
45         "initrd_high=0xffffffff\0" \
46         "fdt_file=imx7s-warp.dtb\0" \
47         "fdt_addr=" __stringify(CONFIG_SYS_FDT_ADDR)"\0" \
48         "fdtovaddr=0x83100000\0" \
49         "optee_addr=" __stringify(CONFIG_OPTEE_LOAD_ADDR)"\0" \
50         "boot_fdt=try\0" \
51         "ip_dyn=yes\0" \
52         "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
53         "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
54         "rootpart=" __stringify(CONFIG_WARP7_ROOT_PART) "\0" \
55         "finduuid=part uuid mmc 0:${rootpart} uuid\0" \
56         "mmcargs=setenv bootargs console=${console},${baudrate} " \
57                 "root=PARTUUID=${uuid} rootwait rw\0" \
58         "ivt_offset=" __stringify(BOOTROM_IVT_HDR_OFFSET)"\0"\
59         "warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \
60         "do_bootscript_hab=" \
61                 "if test ${hab_enabled} -eq 1; then " \
62                         "setexpr hab_ivt_addr ${bootscriptaddr} - ${ivt_offset}; " \
63                         "setenv script ${script_signed}; " \
64                         "load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} ${script}; " \
65                         "run warp7_auth_or_fail; " \
66                         "run bootscript; "\
67                 "fi;\0" \
68         "loadbootscript=" \
69                 "load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} ${script};\0" \
70         "bootscript=echo Running bootscript from mmc ...; " \
71                 BOOT_SCR_STRING \
72         "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
73         "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
74         "mmcboot=echo Booting from mmc ...; " \
75                 "run finduuid; " \
76                 "run mmcargs; " \
77                 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
78                         "if run loadfdt; then " \
79                                 "bootz ${loadaddr} - ${fdt_addr}; " \
80                         "else " \
81                                 "if test ${boot_fdt} = try; then " \
82                                         "bootz; " \
83                                 "else " \
84                                         "echo WARN: Cannot load the DT; " \
85                                 "fi; " \
86                         "fi; " \
87                 "else " \
88                         "bootz; " \
89                 "fi;\0" \
90
91 #define CONFIG_BOOTCOMMAND \
92            "mmc dev ${mmcdev};" \
93            "mmc dev ${mmcdev}; if mmc rescan; then " \
94                    "run do_bootscript_hab;" \
95                    "if run loadbootscript; then " \
96                            "run bootscript; " \
97                    "else " \
98                            "if run loadimage; then " \
99                                    "run mmcboot; " \
100                            "fi; " \
101                    "fi; " \
102            "fi"
103
104 #define CONFIG_SYS_HZ                   1000
105
106 /* Physical Memory Map */
107 #define PHYS_SDRAM                      MMDC0_ARB_BASE_ADDR
108
109 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM
110 #define CONFIG_SYS_INIT_RAM_ADDR        IRAM_BASE_ADDR
111 #define CONFIG_SYS_INIT_RAM_SIZE        IRAM_SIZE
112
113 #define CONFIG_SYS_INIT_SP_OFFSET \
114         (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
115 #define CONFIG_SYS_INIT_SP_ADDR \
116         (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
117
118 /*
119  * Environment starts at CONFIG_ENV_OFFSET= 0xC0000 = 768k = 768*1024 = 786432
120  *
121  * Detect overlap between U-Boot image and environment area in build-time
122  *
123  * CONFIG_BOARD_SIZE_LIMIT = CONFIG_ENV_OFFSET - u-boot.imx offset
124  * CONFIG_BOARD_SIZE_LIMIT = 768k - 1k = 767k = 785408
125  *
126  * Currently CONFIG_BOARD_SIZE_LIMIT does not handle expressions, so
127  * write the direct value here
128  */
129 #define CONFIG_BOARD_SIZE_LIMIT         785408
130
131 /* environment organization */
132
133 #define CONFIG_SYS_FSL_USDHC_NUM        1
134
135
136 #define CONFIG_MXC_USB_PORTSC           (PORT_PTS_UTMI | PORT_PTS_PTW)
137
138 #define CONFIG_USBD_HS
139
140 /* USB Device Firmware Update support */
141 #define DFU_DEFAULT_POLL_TIMEOUT        300
142
143 #define CONFIG_USBNET_DEV_ADDR          "de:ad:be:af:00:01"
144
145 /* Environment variable name to represent HAB enable state */
146 #define HAB_ENABLED_ENVNAME             "hab_enabled"
147
148 #endif