Merge branch '2019-11-20-env-migration'
[platform/kernel/u-boot.git] / include / configs / colibri_imx7.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2016-2018 Toradex AG
4  *
5  * Configuration settings for the Colibri iMX7 module.
6  *
7  * based on mx7dsabresd.h:
8  * Copyright (C) 2015 Freescale Semiconductor, Inc.
9  */
10
11 #ifndef __COLIBRI_IMX7_CONFIG_H
12 #define __COLIBRI_IMX7_CONFIG_H
13
14 #include "mx7_common.h"
15
16 /* Size of malloc() pool */
17 #define CONFIG_SYS_MALLOC_LEN           (32 * SZ_1M)
18
19 /* Network */
20 #define CONFIG_FEC_MXC
21 #define CONFIG_FEC_XCV_TYPE             RMII
22 #define CONFIG_ETHPRIME                 "FEC"
23 #define CONFIG_FEC_MXC_PHYADDR          0
24
25 #define CONFIG_TFTP_TSIZE
26
27 /* ENET1 */
28 #define IMX_FEC_BASE                    ENET_IPS_BASE_ADDR
29
30 /* MMC Config*/
31 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
32 #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
33 #define CONFIG_SYS_FSL_USDHC_NUM        1
34 #elif CONFIG_TARGET_COLIBRI_IMX7_EMMC
35 #define CONFIG_SYS_FSL_USDHC_NUM        2
36 #endif
37
38 /* I2C configs */
39 #define CONFIG_SYS_I2C_MXC
40 #define CONFIG_SYS_I2C_SPEED            100000
41
42 #define CONFIG_IPADDR                   192.168.10.2
43 #define CONFIG_NETMASK                  255.255.255.0
44 #define CONFIG_SERVERIP                 192.168.10.1
45
46 #ifndef PARTS_DEFAULT
47 /* Define the default GPT table for eMMC */
48 #define PARTS_DEFAULT \
49         /* Android partitions */ \
50         "partitions_android=" \
51         "uuid_disk=${uuid_gpt_disk};" \
52         "name=boot,start=1M,size=32M,uuid=${uuid_gpt_boot};" \
53         "name=environment,size=4M,uuid=${uuid_gpt_environment};" \
54         "name=recovery,size=16M,uuid=${uuid_gpt_recovery};" \
55         "name=system,size=1536M,uuid=${uuid_gpt_system};" \
56         "name=cache,size=512M,uuid=${uuid_gpt_cache};" \
57         "name=device,size=8M,uuid=${uuid_gpt_device};" \
58         "name=misc,size=4M,uuid=${uuid_gpt_misc};" \
59         "name=datafooter,size=2M,uuid=${uuid_gpt_datafooter};" \
60         "name=metadata,size=2M,uuid=${uuid_gpt_metadata};" \
61         "name=persistdata,size=2M,uuid=${uuid_gpt_persistdata};" \
62         "name=userdata,size=128M,uuid=${uuid_gpt_userdata};" \
63         "name=fbmisc,size=-,uuid=${uuid_gpt_fbmisc}\0"
64 #endif /* PARTS_DEFAULT */
65
66 #define EMMC_ANDROID_BOOTCMD \
67         "android_args=androidboot.storage_type=emmc\0" \
68         PARTS_DEFAULT \
69         "android_fdt_addr=0x83700000\0" \
70         "android_mmc_dev=0\0" \
71         "m4binary=rpmsg_imu_freertos.elf\0" \
72         "androidboot=ext4load mmc 0:a ${loadaddr} media/0/${m4binary}; "\
73                 "bootaux ${loadaddr}; " \
74                 "setenv loadaddr 0x88000000; " \
75                 "setenv bootm_boot_mode sec;" \
76                 "setenv bootargs androidboot.serialno=${serial#} " \
77                         "$android_args; " \
78                 "part start mmc ${android_mmc_dev} boot boot_start; " \
79                 "part size mmc ${android_mmc_dev} boot boot_size; " \
80                 "mmc read ${loadaddr} ${boot_start} ${boot_size}; " \
81                 "part start mmc ${android_mmc_dev} environment env_start; " \
82                 "part size mmc ${android_mmc_dev} environment env_size; " \
83                 "mmc read ${android_fdt_addr} ${env_start} ${env_size}; " \
84                 "bootm ${loadaddr} ${loadaddr} ${android_fdt_addr}\0 "
85
86 #define EMMC_BOOTCMD \
87         "set_emmcargs=setenv emmcargs ip=off root=PARTUUID=${uuid} ro " \
88                 "rootfstype=ext4 rootwait\0" \
89         "emmcboot=run setup; run emmcfinduuid; run set_emmcargs; " \
90                 "setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \
91                 "${vidargs}; echo Booting from internal eMMC chip...; " \
92                 "run m4boot && " \
93                 "load mmc ${emmcdev}:${emmcbootpart} ${fdt_addr_r} " \
94                 "${soc}-colibri-emmc-${fdt_board}.dtb && " \
95                 "load mmc ${emmcdev}:${emmcbootpart} ${kernel_addr_r} " \
96                 "${boot_file} && run fdt_fixup && " \
97                 "bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
98         "emmcbootpart=1\0" \
99         "emmcdev=0\0" \
100         "emmcfinduuid=part uuid mmc ${emmcdev}:${emmcrootpart} uuid\0" \
101         "emmcrootpart=2\0"
102
103 #define MEM_LAYOUT_ENV_SETTINGS \
104         "bootm_size=0x10000000\0" \
105         "fdt_addr_r=0x82000000\0" \
106         "fdt_high=0xffffffff\0" \
107         "initrd_high=0xffffffff\0" \
108         "kernel_addr_r=0x81000000\0" \
109         "ramdisk_addr_r=0x82100000\0" \
110         "scriptaddr=0x82500000\0"
111
112 #define NFS_BOOTCMD \
113         "nfsargs=ip=:::::eth0: root=/dev/nfs\0" \
114         "nfsboot=run setup; " \
115                 "setenv bootargs ${defargs} ${nfsargs} " \
116                 "${setupargs} ${vidargs}; echo Booting from NFS...;" \
117                 "dhcp ${kernel_addr_r} && " \
118                 "tftp ${fdt_addr_r} ${soc}-colibri${variant}-${fdt_board}.dtb && " \
119                 "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
120
121 #define UBI_BOOTCMD     \
122         "ubiargs=ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs " \
123                 "ubi.fm_autoconvert=1\0" \
124         "ubiboot=run setup; " \
125                 "setenv bootargs ${defargs} ${ubiargs} " \
126                 "${setupargs} ${vidargs}; echo Booting from NAND...; " \
127                 "ubi part ubi && run m4boot && " \
128                 "ubi read ${kernel_addr_r} kernel && " \
129                 "ubi read ${fdt_addr_r} dtb && " \
130                 "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
131
132 #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
133 #define CONFIG_BOOTCOMMAND "run ubiboot ; echo ; echo ubiboot failed ; " \
134         "setenv fdtfile ${soc}-colibri-${fdt_board}.dtb && run distro_bootcmd;"
135 #define MODULE_EXTRA_ENV_SETTINGS \
136         "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
137         UBI_BOOTCMD
138 #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
139 #define CONFIG_BOOTCOMMAND \
140         "setenv fdtfile ${soc}-colibri-emmc-${fdt_board}.dtb && run distro_bootcmd;"
141 #define MODULE_EXTRA_ENV_SETTINGS \
142         "variant=-emmc\0" \
143         EMMC_BOOTCMD \
144         EMMC_ANDROID_BOOTCMD
145 #endif
146
147 #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
148 #define BOOT_TARGET_DEVICES(func) \
149         func(MMC, mmc, 0) \
150         func(USB, usb, 0) \
151         func(DHCP, dhcp, na)
152 #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
153 #define BOOT_TARGET_DEVICES(func) \
154         func(MMC, mmc, 0) \
155         func(MMC, mmc, 1) \
156         func(USB, usb, 0) \
157         func(DHCP, dhcp, na)
158 #endif
159 #include <config_distro_bootcmd.h>
160
161 #define CONFIG_EXTRA_ENV_SETTINGS \
162         BOOTENV \
163         MEM_LAYOUT_ENV_SETTINGS \
164         NFS_BOOTCMD \
165         MODULE_EXTRA_ENV_SETTINGS \
166         "boot_file=zImage\0" \
167         "console=ttymxc0\0" \
168         "defargs=\0" \
169         "fdt_board=eval-v3\0" \
170         "fdt_fixup=;\0" \
171         "m4boot=;\0" \
172         "ip_dyn=yes\0" \
173         "kernel_file=zImage\0" \
174         "setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
175                 "00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
176                 "${board}/flash_eth.img && source ${loadaddr}\0" \
177         "setsdupdate=mmc rescan && setenv interface mmc && " \
178                 "fatload ${interface} 0:1 ${loadaddr} " \
179                 "${board}/flash_blk.img && source ${loadaddr}\0" \
180         "setup=setenv setupargs " \
181                 "console=tty1 console=${console}" \
182                 ",${baudrate}n8 ${memargs} consoleblank=0\0" \
183         "setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \
184         "setusbupdate=usb start && setenv interface usb && " \
185                 "fatload ${interface} 0:1 ${loadaddr} " \
186                 "${board}/flash_blk.img && source ${loadaddr}\0" \
187         "splashpos=m,m\0" \
188         "videomode=video=ctfb:x:640,y:480,depth:18,pclk:39722,le:48,ri:16,up:33,lo:10,hs:96,vs:2,sync:0,vmode:0\0" \
189         "updlevel=2\0"
190
191 /* Miscellaneous configurable options */
192
193 #define CONFIG_SYS_MEMTEST_START        0x80000000
194 #define CONFIG_SYS_MEMTEST_END          (CONFIG_SYS_MEMTEST_START + 0x0c000000)
195
196 #define CONFIG_SYS_LOAD_ADDR            CONFIG_LOADADDR
197 #define CONFIG_SYS_HZ                   1000
198
199 /* Physical Memory Map */
200 #define PHYS_SDRAM                      MMDC0_ARB_BASE_ADDR
201
202 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM
203 #define CONFIG_SYS_INIT_RAM_ADDR        IRAM_BASE_ADDR
204 #define CONFIG_SYS_INIT_RAM_SIZE        IRAM_SIZE
205
206 #define CONFIG_SYS_INIT_SP_OFFSET \
207         (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
208 #define CONFIG_SYS_INIT_SP_ADDR \
209         (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
210
211 /* environment organization */
212
213 #if defined(CONFIG_ENV_IS_IN_MMC)
214 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
215 #define CONFIG_SYS_MMC_ENV_DEV          0
216 #define CONFIG_SYS_MMC_ENV_PART         1
217 #endif
218
219 #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
220 /* NAND stuff */
221 #define CONFIG_SYS_MAX_NAND_DEVICE      1
222 #define CONFIG_SYS_NAND_BASE            0x40000000
223 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
224 #define CONFIG_SYS_NAND_ONFI_DETECTION
225 #define CONFIG_SYS_NAND_MX7_GPMI_62_ECC_BYTES
226 #endif
227
228 /* USB Configs */
229 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
230
231 #define CONFIG_MXC_USB_PORTSC           (PORT_PTS_UTMI | PORT_PTS_PTW)
232 #define CONFIG_MXC_USB_FLAGS            0
233 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
234
235 #define CONFIG_IMX_THERMAL
236
237 #define CONFIG_USBD_HS
238
239 /* USB Device Firmware Update support */
240 #define CONFIG_SYS_DFU_DATA_BUF_SIZE    SZ_16M
241 #define DFU_DEFAULT_POLL_TIMEOUT        300
242
243 #if defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
244 #define CONFIG_VIDEO_MXS
245 #define CONFIG_VIDEO_LOGO
246 #define CONFIG_SPLASH_SCREEN
247 #define CONFIG_SPLASH_SCREEN_ALIGN
248 #define CONFIG_BMP_16BPP
249 #define CONFIG_VIDEO_BMP_RLE8
250 #define CONFIG_VIDEO_BMP_LOGO
251 #endif
252
253 #endif