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