1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2018-2019 Toradex AG
4  *
5  * Configuration settings for the Colibri iMX6ULL module.
6  *
7  * based on colibri_imx7.h
8  */
9 
10 #ifndef __COLIBRI_IMX6ULL_CONFIG_H
11 #define __COLIBRI_IMX6ULL_CONFIG_H
12 
13 #include "mx6_common.h"
14 #define CONFIG_IOMUX_LPSR
15 
16 #define PHYS_SDRAM_SIZE			SZ_512M
17 
18 /* Size of malloc() pool */
19 #define CONFIG_SYS_MALLOC_LEN		(32 * SZ_1M)
20 
21 /* Network */
22 #define CONFIG_TFTP_TSIZE
23 
24 /* ENET1 */
25 #define IMX_FEC_BASE			ENET2_BASE_ADDR
26 
27 /* MMC Config */
28 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
29 #define CONFIG_SYS_FSL_USDHC_NUM	1
30 
31 /* I2C configs */
32 #define CONFIG_SYS_I2C_SPEED		100000
33 
34 #define CONFIG_IPADDR			192.168.10.2
35 #define CONFIG_NETMASK			255.255.255.0
36 #define CONFIG_SERVERIP			192.168.10.1
37 
38 #define MEM_LAYOUT_ENV_SETTINGS \
39 	"bootm_size=0x10000000\0" \
40 	"fdt_addr_r=0x82100000\0" \
41 	"kernel_addr_r=0x81000000\0" \
42 	"pxefile_addr_r=0x87100000\0" \
43 	"ramdisk_addr_r=0x82200000\0" \
44 	"scriptaddr=0x87000000\0"
45 
46 #define UBOOT_UPDATE \
47 	"update_uboot=nand erase.part u-boot1 && " \
48 		"nand write ${loadaddr} u-boot1 ${filesize} && " \
49 		"nand erase.part u-boot2 && " \
50 		"nand write ${loadaddr} u-boot2 ${filesize}\0"
51 
52 #define NFS_BOOTCMD \
53 	"nfsargs=ip=:::::eth0: root=/dev/nfs\0" \
54 	"nfsboot=run setup; " \
55 		"setenv bootargs ${defargs} ${nfsargs} " \
56 		"${setupargs} ${vidargs}; echo Booting from NFS...;" \
57 		"dhcp ${kernel_addr_r} && " \
58 		"tftp ${fdt_addr_r} ${fdtfile} && " \
59 		"run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
60 
61 #define UBI_BOOTCMD \
62 	"ubiargs=ubi.mtd=ubi root=ubi0:rootfs rw rootfstype=ubifs " \
63 		"ubi.fm_autoconvert=1\0" \
64 	"ubiboot=run setup; " \
65 		"setenv bootargs ${defargs} ${ubiargs} " \
66 		"${setupargs} ${vidargs}; echo Booting from NAND...; " \
67 		"ubi part ubi &&" \
68 		"ubi read ${kernel_addr_r} kernel && " \
69 		"ubi read ${fdt_addr_r} dtb && " \
70 		"run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
71 
72 /* Run Distro Boot script if ubiboot fails */
73 #define CONFIG_BOOTCOMMAND "run ubiboot || run distro_bootcmd;"
74 
75 #define BOOT_TARGET_DEVICES(func) \
76 	func(MMC, mmc, 0) \
77 	func(USB, usb, 0) \
78 	func(DHCP, dhcp, na)
79 #include <config_distro_bootcmd.h>
80 
81 #define DFU_ALT_NAND_INFO "imx6ull-bcb part 0,1;u-boot1 part 0,2;u-boot2 part 0,3;u-boot-env part 0,4;ubi partubi 0,5"
82 
83 #define CONFIG_EXTRA_ENV_SETTINGS \
84 	BOOTENV \
85 	MEM_LAYOUT_ENV_SETTINGS \
86 	NFS_BOOTCMD \
87 	UBI_BOOTCMD \
88 	UBOOT_UPDATE \
89 	"bootubipart=ubi\0" \
90 	"console=ttymxc0\0" \
91 	"defargs=user_debug=30\0" \
92 	"dfu_alt_info=" DFU_ALT_NAND_INFO "\0" \
93 	"fdt_board=eval-v3\0" \
94 	"fdt_fixup=;\0" \
95 	"ip_dyn=yes\0" \
96 	"kernel_file=zImage\0" \
97 	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
98 	"setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
99 		"00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
100 		"${board}/flash_eth.img && source ${loadaddr}\0" \
101 	"setsdupdate=mmc rescan && setenv interface mmc && " \
102 		"fatload ${interface} 0:1 ${loadaddr} " \
103 		"${board}/flash_blk.img && source ${loadaddr}\0" \
104 	"setup=setenv setupargs " \
105 		"console=tty1 console=${console}" \
106 		",${baudrate}n8 ${memargs} consoleblank=0\0" \
107 	"setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \
108 	"setusbupdate=usb start && setenv interface usb && " \
109 		"fatload ${interface} 0:1 ${loadaddr} " \
110 		"${board}/flash_blk.img && source ${loadaddr}\0" \
111 	"splashpos=m,m\0" \
112 	"splashimage=" __stringify(CONFIG_LOADADDR) "\0" \
113 	"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" \
114 	"vidargs=video=mxsfb:640x480M-16@60"
115 
116 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
117 
118 /* Physical Memory Map */
119 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
120 
121 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
122 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
123 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
124 
125 #define CONFIG_SYS_INIT_SP_OFFSET \
126 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
127 #define CONFIG_SYS_INIT_SP_ADDR \
128 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
129 
130 /* NAND stuff */
131 #define CONFIG_SYS_MAX_NAND_DEVICE	1
132 /* used to initialize CONFIG_SYS_NAND_BASE_LIST which is unused */
133 #define CONFIG_SYS_NAND_BASE		-1
134 #define CONFIG_SYS_NAND_ONFI_DETECTION
135 
136 /* USB Configs */
137 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
138 
139 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
140 #define CONFIG_MXC_USB_FLAGS		0
141 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
142 
143 #define CONFIG_USBD_HS
144 
145 /* USB Device Firmware Update support */
146 #define CONFIG_SYS_DFU_DATA_BUF_SIZE	SZ_16M
147 #define DFU_DEFAULT_POLL_TIMEOUT	300
148 
149 #if defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
150 #define CONFIG_VIDEO_MXS
151 #define MXS_LCDIF_BASE MX6UL_LCDIF1_BASE_ADDR
152 #define CONFIG_VIDEO_LOGO
153 #define CONFIG_VIDEO_BMP_LOGO
154 #endif
155 
156 #endif /* __COLIBRI_IMX6ULL_CONFIG_H */
157