ARM: configs: Add da850evm_nand to boot from NAND
[oweals/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 /*#define CONFIG_DBG_MONITOR*/
17 #define PHYS_SDRAM_SIZE                 SZ_1G
18
19 /* Size of malloc() pool */
20 #define CONFIG_SYS_MALLOC_LEN           (32 * SZ_1M)
21
22 /* Network */
23 #define CONFIG_FEC_MXC
24 #define CONFIG_FEC_XCV_TYPE             RMII
25 #define CONFIG_ETHPRIME                 "FEC"
26 #define CONFIG_FEC_MXC_PHYADDR          0
27
28 #define CONFIG_IP_DEFRAG
29 #define CONFIG_TFTP_BLOCKSIZE           16352
30 #define CONFIG_TFTP_TSIZE
31
32 /* ENET1 */
33 #define IMX_FEC_BASE                    ENET_IPS_BASE_ADDR
34
35 /* MMC Config*/
36 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
37 #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
38 #define CONFIG_SYS_FSL_USDHC_NUM        1
39 #elif CONFIG_TARGET_COLIBRI_IMX7_EMMC
40 #define CONFIG_SYS_FSL_USDHC_NUM        2
41
42 #define CONFIG_SUPPORT_EMMC_BOOT
43 #endif
44
45 #undef CONFIG_BOOTM_PLAN9
46 #undef CONFIG_BOOTM_RTEMS
47
48 /* I2C configs */
49 #define CONFIG_SYS_I2C_MXC
50 #define CONFIG_SYS_I2C_SPEED            100000
51
52 #define CONFIG_IPADDR                   192.168.10.2
53 #define CONFIG_NETMASK                  255.255.255.0
54 #define CONFIG_SERVERIP                 192.168.10.1
55
56 #define EMMC_BOOTCMD \
57         "emmcargs=ip=off root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait\0" \
58         "emmcboot=run setup; " \
59                 "setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \
60                 "${vidargs}; echo Booting from internal eMMC chip...; " \
61                 "run m4boot && " \
62                 "load mmc 0:1 ${fdt_addr_r} ${soc}-colibri-emmc-${fdt_board}.dtb && " \
63                 "load mmc 0:1 ${kernel_addr_r} ${boot_file} && " \
64                 "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0"
65
66 #define MEM_LAYOUT_ENV_SETTINGS \
67         "bootm_size=0x10000000\0" \
68         "fdt_addr_r=0x82000000\0" \
69         "fdt_high=0xffffffff\0" \
70         "initrd_high=0xffffffff\0" \
71         "kernel_addr_r=0x81000000\0" \
72         "ramdisk_addr_r=0x82100000\0"
73
74 #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
75 #define SD_BOOTCMD \
76         "sdargs=root=/dev/mmcblk0p2 ro rootwait\0" \
77         "sdboot=run setup; setenv bootargs ${defargs} ${sdargs} " \
78         "${setupargs} ${vidargs}; echo Booting from MMC/SD card...; " \
79         "run m4boot && " \
80         "load mmc 0:1 ${kernel_addr_r} ${kernel_file} && " \
81         "load mmc 0:1 ${fdt_addr_r} ${soc}-colibri-${fdt_board}.dtb && " \
82         "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0"
83 #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
84 #define SD_BOOTCMD \
85         "sdargs=root=/dev/mmcblk1p2 ro rootwait\0" \
86         "sdboot=run setup; setenv bootargs ${defargs} ${sdargs} " \
87         "${setupargs} ${vidargs}; echo Booting from MMC/SD card...; " \
88         "run m4boot && " \
89         "load mmc 1:1 ${kernel_addr_r} ${kernel_file} && " \
90         "load mmc 1:1 ${fdt_addr_r} ${soc}-colibri-${fdt_board}.dtb && " \
91         "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0"
92 #endif
93
94
95 #define NFS_BOOTCMD \
96         "nfsargs=ip=:::::eth0: root=/dev/nfs\0" \
97         "nfsboot=run setup; " \
98                 "setenv bootargs ${defargs} ${nfsargs} " \
99                 "${setupargs} ${vidargs}; echo Booting from NFS...;" \
100                 "dhcp ${kernel_addr_r} && " \
101                 "tftp ${fdt_addr_r} ${soc}-colibri${variant}-${fdt_board}.dtb && " \
102                 "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
103
104 #define UBI_BOOTCMD     \
105         "ubiargs=ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs " \
106                 "ubi.fm_autoconvert=1\0" \
107         "ubiboot=run setup; " \
108                 "setenv bootargs ${defargs} ${ubiargs} " \
109                 "${setupargs} ${vidargs}; echo Booting from NAND...; " \
110                 "ubi part ubi && run m4boot && " \
111                 "ubi read ${kernel_addr_r} kernel && " \
112                 "ubi read ${fdt_addr_r} dtb && " \
113                 "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
114
115 #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
116 #define CONFIG_BOOTCOMMAND "run emmcboot ; echo ; echo emmcboot failed ; " \
117         "setenv fdtfile ${soc}-colibri-${fdt_board}.dtb && run distro_bootcmd;"
118 #define MODULE_EXTRA_ENV_SETTINGS \
119         "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
120         UBI_BOOTCMD
121 #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
122 #define CONFIG_BOOTCOMMAND "run ubiboot ; echo ; echo ubiboot failed ; " \
123         "setenv fdtfile ${soc}-colibri-emmc-${fdt_board}.dtb && run distro_bootcmd;"
124 #define MODULE_EXTRA_ENV_SETTINGS \
125         "variant=-emmc\0" \
126         EMMC_BOOTCMD
127 #endif
128
129 #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
130 #define BOOT_TARGET_DEVICES(func) \
131         func(MMC, mmc, 0) \
132         func(USB, usb, 0) \
133         func(DHCP, dhcp, na)
134 #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
135 #define BOOT_TARGET_DEVICES(func) \
136         func(MMC, mmc, 0) \
137         func(MMC, mmc, 1) \
138         func(USB, usb, 0) \
139         func(DHCP, dhcp, na)
140 #endif
141 #include <config_distro_bootcmd.h>
142
143 #define CONFIG_EXTRA_ENV_SETTINGS \
144         BOOTENV \
145         MEM_LAYOUT_ENV_SETTINGS \
146         NFS_BOOTCMD \
147         SD_BOOTCMD \
148         MODULE_EXTRA_ENV_SETTINGS \
149         "console=ttymxc0\0" \
150         "defargs=\0" \
151         "fdt_board=eval-v3\0" \
152         "fdt_fixup=;\0" \
153         "m4boot=;\0" \
154         "ip_dyn=yes\0" \
155         "kernel_file=zImage\0" \
156         "setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
157                 "00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
158                 "${board}/flash_eth.img && source ${loadaddr}\0" \
159         "setsdupdate=mmc rescan && setenv interface mmc && " \
160                 "fatload ${interface} 0:1 ${loadaddr} " \
161                 "${board}/flash_blk.img && source ${loadaddr}\0" \
162         "setup=setenv setupargs " \
163                 "console=tty1 console=${console}" \
164                 ",${baudrate}n8 ${memargs} consoleblank=0\0" \
165         "setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \
166         "setusbupdate=usb start && setenv interface usb && " \
167                 "fatload ${interface} 0:1 ${loadaddr} " \
168                 "${board}/flash_blk.img && source ${loadaddr}\0" \
169         "splashpos=m,m\0" \
170         "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" \
171         "updlevel=2\0"
172
173 /* Miscellaneous configurable options */
174
175 #define CONFIG_SYS_MEMTEST_START        0x80000000
176 #define CONFIG_SYS_MEMTEST_END          (CONFIG_SYS_MEMTEST_START + 0x0c000000)
177
178 #define CONFIG_SYS_LOAD_ADDR            CONFIG_LOADADDR
179 #define CONFIG_SYS_HZ                   1000
180
181 /* Physical Memory Map */
182 #define PHYS_SDRAM                      MMDC0_ARB_BASE_ADDR
183
184 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM
185 #define CONFIG_SYS_INIT_RAM_ADDR        IRAM_BASE_ADDR
186 #define CONFIG_SYS_INIT_RAM_SIZE        IRAM_SIZE
187
188 #define CONFIG_SYS_INIT_SP_OFFSET \
189         (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
190 #define CONFIG_SYS_INIT_SP_ADDR \
191         (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
192
193 /* environment organization */
194
195 #if defined(CONFIG_ENV_IS_IN_MMC)
196 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
197 #define CONFIG_ENV_SIZE                 (8 * 1024)
198 #define CONFIG_ENV_OFFSET               (-CONFIG_ENV_SIZE + \
199                                          CONFIG_TDX_CFG_BLOCK_OFFSET)
200 #define CONFIG_SYS_MMC_ENV_DEV          0
201 #define CONFIG_SYS_MMC_ENV_PART         1
202 #elif defined(CONFIG_ENV_IS_IN_NAND)
203 #define CONFIG_ENV_SECT_SIZE            (128 * 1024)
204 #define CONFIG_ENV_OFFSET               (28 * CONFIG_ENV_SECT_SIZE)
205 #define CONFIG_ENV_SIZE                 CONFIG_ENV_SECT_SIZE
206 #endif
207
208 #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
209 /* NAND stuff */
210 #define CONFIG_SYS_MAX_NAND_DEVICE      1
211 #define CONFIG_SYS_NAND_BASE            0x40000000
212 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
213 #define CONFIG_SYS_NAND_ONFI_DETECTION
214 #define CONFIG_SYS_NAND_MX7_GPMI_62_ECC_BYTES
215 #endif
216
217 /* USB Configs */
218 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
219
220 #define CONFIG_MXC_USB_PORTSC           (PORT_PTS_UTMI | PORT_PTS_PTW)
221 #define CONFIG_MXC_USB_FLAGS            0
222 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
223
224 #define CONFIG_IMX_THERMAL
225
226 #define CONFIG_USBD_HS
227
228 /* USB Device Firmware Update support */
229 #define CONFIG_SYS_DFU_DATA_BUF_SIZE    SZ_16M
230 #define DFU_DEFAULT_POLL_TIMEOUT        300
231
232 #ifdef CONFIG_VIDEO
233 #define CONFIG_VIDEO_MXS
234 #define CONFIG_VIDEO_LOGO
235 #define CONFIG_SPLASH_SCREEN
236 #define CONFIG_SPLASH_SCREEN_ALIGN
237 #define CONFIG_BMP_16BPP
238 #define CONFIG_VIDEO_BMP_RLE8
239 #define CONFIG_VIDEO_BMP_LOGO
240 #endif
241
242 #endif