xref: /openbmc/u-boot/include/configs/tqma6.h (revision e3963c09)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2013, 2014, 2017 Markus Niebel <Markus.Niebel@tq-group.com>
4  *
5  * Configuration settings for the TQ Systems TQMa6<Q,D,DL,S> module.
6  */
7 
8 #ifndef __CONFIG_H
9 #define __CONFIG_H
10 
11 #include <linux/kconfig.h>
12 /* SPL */
13 /* #if defined(CONFIG_SPL_BUILD) */
14 /* common IMX6 SPL configuration */
15 #include "imx6_spl.h"
16 
17 /* #endif */
18 
19 /* place code in last 4 MiB of RAM */
20 
21 #include "mx6_common.h"
22 
23 #if defined(CONFIG_TQMA6S)
24 #define PHYS_SDRAM_SIZE			(512u * SZ_1M)
25 #elif defined(CONFIG_TQMA6DL)
26 #define PHYS_SDRAM_SIZE			(SZ_1G)
27 #elif defined(CONFIG_TQMA6Q)
28 #define PHYS_SDRAM_SIZE			(SZ_1G)
29 #endif
30 
31 #define CONFIG_MXC_UART
32 
33 /* SPI Flash */
34 
35 #define TQMA6_SPI_FLASH_SECTOR_SIZE	SZ_64K
36 
37 #define CONFIG_SF_DEFAULT_BUS	0
38 #define CONFIG_SF_DEFAULT_CS	0
39 #define CONFIG_SF_DEFAULT_SPEED	50000000
40 #define CONFIG_SF_DEFAULT_MODE	(SPI_MODE_0)
41 
42 /* I2C Configs */
43 #define CONFIG_SYS_I2C
44 #define CONFIG_SYS_I2C_MXC
45 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
46 #define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
47 #define CONFIG_SYS_I2C_MXC_I2C3		/* enable I2C bus 3 */
48 #define CONFIG_I2C_MULTI_BUS
49 #define CONFIG_SYS_I2C_SPEED		100000
50 
51 /* I2C EEPROM (M24C64) */
52 #define CONFIG_SYS_I2C_EEPROM_ADDR			0x50
53 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN			2
54 #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_BITS		5 /* 32 Bytes */
55 #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_DELAY_MS	20
56 
57 #define CONFIG_POWER
58 #define CONFIG_POWER_I2C
59 #define CONFIG_POWER_PFUZE100
60 #define CONFIG_POWER_PFUZE100_I2C_ADDR	0x08
61 #define TQMA6_PFUZE100_I2C_BUS		2
62 
63 /* MMC Configs */
64 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
65 
66 /* USB Configs */
67 #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
68 #define CONFIG_USB_MAX_CONTROLLER_COUNT	2
69 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET	/* For OTG port */
70 
71 #define CONFIG_FEC_MXC
72 #define IMX_FEC_BASE			ENET_BASE_ADDR
73 
74 #define CONFIG_ARP_TIMEOUT		200UL
75 
76 #define CONFIG_ENV_SIZE			(SZ_8K)
77 /* Size of malloc() pool */
78 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 2 * SZ_1M)
79 
80 #if defined(CONFIG_TQMA6X_MMC_BOOT)
81 
82 #define TQMA6_UBOOT_OFFSET		SZ_1K
83 #define TQMA6_UBOOT_SECTOR_START	0x2
84 #define TQMA6_UBOOT_SECTOR_COUNT	0x7fe
85 
86 #define CONFIG_ENV_OFFSET		SZ_1M
87 #define CONFIG_SYS_MMC_ENV_DEV		0
88 
89 #define TQMA6_FDT_OFFSET		(2 * SZ_1M)
90 #define TQMA6_FDT_SECTOR_START		0x1000
91 #define TQMA6_FDT_SECTOR_COUNT		0x800
92 
93 #define TQMA6_KERNEL_SECTOR_START	0x2000
94 #define TQMA6_KERNEL_SECTOR_COUNT	0x2000
95 
96 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS                                       \
97 	"uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0"                \
98 	"uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0"                 \
99 	"fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0"                    \
100 	"fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0"                     \
101 	"kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0"              \
102 	"kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0"               \
103 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0"                       \
104 	"loadimage=mmc dev ${mmcdev}; "                                        \
105 		"mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0"       \
106 	"loadfdt=mmc dev ${mmcdev}; "                                          \
107 		"mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0"             \
108 	"update_uboot=if tftp ${uboot}; then "                                 \
109 		"if itest ${filesize} > 0; then "                              \
110 			"mmc dev ${mmcdev}; mmc rescan; "                      \
111 			"setexpr blkc ${filesize} + 0x1ff; "                   \
112 			"setexpr blkc ${blkc} / 0x200; "                       \
113 			"if itest ${blkc} <= ${uboot_size}; then "             \
114 				"mmc write ${loadaddr} ${uboot_start} "        \
115 					"${blkc}; "                            \
116 			"fi; "                                                 \
117 		"fi; fi; "                                                     \
118 		"setenv filesize; setenv blkc \0"                              \
119 	"update_kernel=run kernel_name; "                                      \
120 		"if tftp ${kernel}; then "                                     \
121 			"if itest ${filesize} > 0; then "                      \
122 				"mmc dev ${mmcdev}; mmc rescan; "              \
123 				"setexpr blkc ${filesize} + 0x1ff; "           \
124 				"setexpr blkc ${blkc} / 0x200; "               \
125 				"if itest ${blkc} <= ${kernel_size}; then "    \
126 					"mmc write ${loadaddr} "               \
127 						"${kernel_start} ${blkc}; "    \
128 				"fi; "                                         \
129 			"fi; "                                                 \
130 		"fi; "                                                         \
131 		"setenv filesize; setenv blkc \0"                              \
132 	"update_fdt=if tftp ${fdt_file}; then "                                \
133 		"if itest ${filesize} > 0; then "                              \
134 			"mmc dev ${mmcdev}; mmc rescan; "                      \
135 			"setexpr blkc ${filesize} + 0x1ff; "                   \
136 			"setexpr blkc ${blkc} / 0x200; "                       \
137 			"if itest ${blkc} <= ${fdt_size}; then "               \
138 				"mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
139 			"fi; "                                                 \
140 		"fi; fi; "                                                     \
141 		"setenv filesize; setenv blkc \0"                              \
142 
143 #define CONFIG_BOOTCOMMAND \
144 	"run mmcboot; run netboot; run panicboot"
145 
146 #elif defined(CONFIG_TQMA6X_SPI_BOOT)
147 
148 #define TQMA6_UBOOT_OFFSET		0x400
149 #define TQMA6_UBOOT_SECTOR_START	0x0
150 /* max u-boot size: 512k */
151 #define TQMA6_UBOOT_SECTOR_SIZE		TQMA6_SPI_FLASH_SECTOR_SIZE
152 #define TQMA6_UBOOT_SECTOR_COUNT	0x8
153 #define TQMA6_UBOOT_SIZE		(TQMA6_UBOOT_SECTOR_SIZE * \
154 					 TQMA6_UBOOT_SECTOR_COUNT)
155 
156 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
157 #define CONFIG_ENV_OFFSET		(TQMA6_UBOOT_SIZE)
158 #define CONFIG_ENV_SECT_SIZE		TQMA6_SPI_FLASH_SECTOR_SIZE
159 #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + \
160 					 CONFIG_ENV_SECT_SIZE)
161 
162 #define CONFIG_ENV_SPI_BUS		(CONFIG_SF_DEFAULT_BUS)
163 #define CONFIG_ENV_SPI_CS		(CONFIG_SF_DEFAULT_CS)
164 #define CONFIG_ENV_SPI_MAX_HZ		(CONFIG_SF_DEFAULT_SPEED)
165 #define CONFIG_ENV_SPI_MODE		(CONFIG_SF_DEFAULT_MODE)
166 
167 #define TQMA6_FDT_OFFSET		(CONFIG_ENV_OFFSET_REDUND + \
168 					 CONFIG_ENV_SECT_SIZE)
169 #define TQMA6_FDT_SECT_SIZE		(TQMA6_SPI_FLASH_SECTOR_SIZE)
170 
171 #define TQMA6_FDT_SECTOR_START		0x0a /* 8 Sector u-boot, 2 Sector env */
172 #define TQMA6_FDT_SECTOR_COUNT		0x01
173 
174 #define TQMA6_KERNEL_SECTOR_START	0x10
175 #define TQMA6_KERNEL_SECTOR_COUNT	0x60
176 
177 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS                                       \
178 	"mmcblkdev=0\0"                                                        \
179 	"uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0"                     \
180 	"uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0"              \
181 	"fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0"                    \
182 	"fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0"                  \
183 	"kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0"              \
184 	"kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0"            \
185 	"update_uboot=if tftp ${uboot}; then "                                 \
186 		"if itest ${filesize} > 0; then "                              \
187 			"setexpr blkc ${filesize} + "                          \
188 				__stringify(TQMA6_UBOOT_OFFSET) "; "           \
189 			"setexpr size ${uboot_sectors} * "                     \
190 				__stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "   \
191 			"if itest ${blkc} <= ${size}; then "                   \
192 				"sf probe; "                                   \
193 				"sf erase 0 ${size}; "                         \
194 				"sf write ${loadaddr} ${uboot_offset} "        \
195 					"${filesize}; "                        \
196 			"fi; "                                                 \
197 		"fi; fi; "                                                     \
198 		"setenv filesize 0; setenv blkc; setenv size \0"               \
199 	"update_kernel=run kernel_name; if tftp ${kernel}; then "              \
200 		"if itest ${filesize} > 0; then "                              \
201 			"setexpr size ${kernel_sectors} * "                    \
202 				__stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "   \
203 			"setexpr offset ${kernel_start} * "                    \
204 				__stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "   \
205 			"if itest ${filesize} <= ${size}; then "               \
206 				"sf probe; "                                   \
207 				"sf erase ${offset} ${size}; "                 \
208 				"sf write ${loadaddr} ${offset} "              \
209 					"${filesize}; "                        \
210 			"fi; "                                                 \
211 		"fi; fi; "                                                     \
212 		"setenv filesize 0; setenv size ; setenv offset\0"             \
213 	"update_fdt=if tftp ${fdt_file}; then "                                \
214 		"if itest ${filesize} > 0; then "                              \
215 			"setexpr size ${fdt_sectors} * "                       \
216 				__stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "   \
217 			"setexpr offset ${fdt_start} * "                       \
218 				__stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "   \
219 			"if itest ${filesize} <= ${size}; then "               \
220 				"sf probe; "                                   \
221 				"sf erase ${offset} ${size}; "                 \
222 				"sf write ${loadaddr} ${offset} "              \
223 					"${filesize}; "                        \
224 			"fi; "                                                 \
225 		"fi; fi; "                                                     \
226 		"setenv filesize 0; setenv size ; setenv offset\0"             \
227 	"loadimage=sf probe; "                                                 \
228 		"setexpr size ${kernel_sectors} * "                            \
229 			__stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "           \
230 		"setexpr offset ${kernel_start} * "                            \
231 			__stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "           \
232 		"sf read ${loadaddr} ${offset} ${size}; "                      \
233 		"setenv size ; setenv offset\0"                                \
234 	"loadfdt=sf probe; "                                                   \
235 		"setexpr size ${fdt_sectors} * "                               \
236 			__stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "           \
237 		"setexpr offset ${fdt_start} * "                               \
238 			__stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; "           \
239 		"sf read ${fdt_addr} ${offset} ${size}; "                      \
240 		"setenv size ; setenv offset\0"                                \
241 
242 #define CONFIG_BOOTCOMMAND                                                     \
243 	"sf probe; run mmcboot; run netboot; run panicboot"                    \
244 
245 #else
246 
247 #error "need to define boot source"
248 
249 #endif
250 
251 /* 128 MiB offset as in ARM related docu for linux suggested */
252 #define TQMA6_FDT_ADDRESS		0x18000000
253 
254 /* set to a resonable value, changeable by user */
255 #define TQMA6_CMA_SIZE                 160M
256 
257 #define CONFIG_EXTRA_ENV_SETTINGS                                              \
258 	"board=tqma6\0"                                                        \
259 	"uimage=uImage\0"                                                      \
260 	"zimage=zImage\0"                                                      \
261 	"boot_type=bootz\0"                                                    \
262 	"kernel_name=if test \"${boot_type}\" != bootz; then "                 \
263 		"setenv kernel ${uimage}; "                                    \
264 		"else setenv kernel ${zimage}; fi\0"                           \
265 	"uboot=u-boot.imx\0"                                                   \
266 	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0"                               \
267 	"fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0"                          \
268 	"console=" CONSOLE_DEV "\0"                                            \
269 	"cma_size="__stringify(TQMA6_CMA_SIZE)"\0"                             \
270 	"fdt_high=0xffffffff\0"                                                \
271 	"initrd_high=0xffffffff\0"                                             \
272 	"rootfsmode=ro\0"                                                      \
273 	"addcma=setenv bootargs ${bootargs} cma=${cma_size}\0"                 \
274 	"addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0"  \
275 	"addfb=setenv bootargs ${bootargs} "                                   \
276 		"imx-fbdev.legacyfb_depth=32 consoleblank=0\0"                 \
277 	"mmcpart=2\0"                                                          \
278 	"mmcblkdev=0\0"                                                        \
279 	"mmcargs=run addmmc addtty addfb addcma\0"                             \
280 	"addmmc=setenv bootargs ${bootargs} "                                  \
281 		"root=/dev/mmcblk${mmcblkdev}p${mmcpart} ${rootfsmode} "       \
282 		"rootwait\0"                                                   \
283 	"mmcboot=echo Booting from mmc ...; "                                  \
284 		"setenv bootargs; "                                            \
285 		"run mmcargs; "                                                \
286 		"run loadimage; "                                              \
287 		"if run loadfdt; then "                                        \
288 			"echo boot device tree kernel ...; "                   \
289 			"${boot_type} ${loadaddr} - ${fdt_addr}; "             \
290 		"else "                                                        \
291 			"${boot_type}; "                                       \
292 		"fi;\0"                                                        \
293 		"setenv bootargs \0"                                           \
294 	"netdev=eth0\0"                                                        \
295 	"rootpath=/srv/nfs/tqma6\0"                                            \
296 	"ipmode=static\0"                                                      \
297 	"netargs=run addnfs addip addtty addfb addcma\0"                       \
298 	"addnfs=setenv bootargs ${bootargs} "                                  \
299 		"root=/dev/nfs rw "                                            \
300 		"nfsroot=${serverip}:${rootpath},v3,tcp;\0"                    \
301 	"addip_static=setenv bootargs ${bootargs} "                            \
302 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:"            \
303 		"${hostname}:${netdev}:off\0"                                  \
304 	"addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0"                  \
305 	"addip=if test \"${ipmode}\" != static; then "                         \
306 		"run addip_dynamic; else run addip_static; fi\0"               \
307 	"set_getcmd=if test \"${ipmode}\" != static; then "                    \
308 		"setenv getcmd dhcp; setenv autoload yes; "                    \
309 		"else setenv getcmd tftp; setenv autoload no; fi\0"            \
310 	"netboot=echo Booting from net ...; "                                  \
311 		"run kernel_name; "                                            \
312 		"run set_getcmd; "                                             \
313 		"setenv bootargs; "                                            \
314 		"run netargs; "                                                \
315 		"if ${getcmd} ${kernel}; then "                                \
316 			"if ${getcmd} ${fdt_addr} ${fdt_file}; then "          \
317 				"${boot_type} ${loadaddr} - ${fdt_addr}; "     \
318 			"fi; "                                                 \
319 		"fi; "                                                         \
320 		"echo ... failed\0"                                            \
321 	"panicboot=echo No boot device !!! reset\0"                            \
322 	TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS                                      \
323 
324 /* Physical Memory Map */
325 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
326 
327 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
328 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
329 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
330 
331 #define CONFIG_SYS_INIT_SP_OFFSET \
332 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
333 #define CONFIG_SYS_INIT_SP_ADDR \
334 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
335 
336 /*
337  * All the defines above are for the TQMa6 SoM
338  *
339  * Now include the baseboard specific configuration
340  */
341 #ifdef CONFIG_MBA6
342 #include "tqma6_mba6.h"
343 #elif CONFIG_WRU4
344 #include "tqma6_wru4.h"
345 #else
346 #error "No baseboard for the TQMa6 defined!"
347 #endif
348 
349 /* Support at least the sensor on TQMa6 SOM */
350 
351 #endif /* __CONFIG_H */
352