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