1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2014 O.S. Systems Software LTDA.
4  * Copyright (C) 2014 Kynetics LLC.
5  * Copyright (C) 2014 Revolution Robotics, Inc.
6  *
7  * Author: Otavio Salvador <otavio@ossystems.com.br>
8  *
9  * Configuration settings for the WaRP Board
10  */
11 
12 #ifndef __CONFIG_H
13 #define __CONFIG_H
14 
15 #include "mx6_common.h"
16 
17 /* Size of malloc() pool */
18 #define CONFIG_SYS_MALLOC_LEN		(35 * SZ_1M) /* Increase due to DFU */
19 
20 #define CONFIG_MXC_UART_BASE		UART1_IPS_BASE_ADDR
21 
22 /* MMC Configs */
23 #define CONFIG_SYS_FSL_ESDHC_ADDR	USDHC2_BASE_ADDR
24 #define CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE
25 
26 /* Watchdog */
27 
28 /* Physical Memory Map */
29 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
30 
31 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
32 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
33 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
34 
35 #define CONFIG_SYS_INIT_SP_OFFSET \
36 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
37 #define CONFIG_SYS_INIT_SP_ADDR \
38 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
39 
40 /* VDD voltage 1.65 - 1.95 */
41 #define CONFIG_SYS_SD_VOLTAGE		0x00000080
42 
43 /* USB Configs */
44 #ifdef CONFIG_CMD_USB
45 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
46 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
47 #define CONFIG_MXC_USB_FLAGS		0
48 #define CONFIG_USB_MAX_CONTROLLER_COUNT	1 /* Only OTG2 port enabled */
49 #endif
50 
51 #define CONFIG_USBD_HS
52 
53 #define CONFIG_SYS_DFU_DATA_BUF_SIZE SZ_16M
54 #define DFU_DEFAULT_POLL_TIMEOUT 300
55 
56 /* I2C Configs */
57 #define CONFIG_SYS_I2C
58 #define CONFIG_SYS_I2C_MXC
59 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
60 #define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
61 #define CONFIG_SYS_I2C_SPEED		  100000
62 
63 /* PMIC */
64 #define CONFIG_POWER
65 #define CONFIG_POWER_I2C
66 #define CONFIG_POWER_MAX77696
67 
68 #define CONFIG_EXTRA_ENV_SETTINGS \
69 	"script=boot.scr\0" \
70 	"image=zImage\0" \
71 	"console=ttymxc0\0" \
72 	"fdt_high=0xffffffff\0" \
73 	"initrd_high=0xffffffff\0" \
74 	"fdt_file=imx6sl-warp.dtb\0" \
75 	"fdt_addr=0x88000000\0" \
76 	"initrd_addr=0x83800000\0" \
77 	"boot_fdt=try\0" \
78 	"ip_dyn=yes\0" \
79 	"mmcdev=0\0" \
80 	"mmcpart=1\0" \
81 	"finduuid=part uuid mmc 0:2 uuid\0" \
82 	"dfu_alt_info=boot raw 0x2 0x400 mmcpart 1\0" \
83 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
84 		"root=PARTUUID=${uuid} rootwait rw\0" \
85 	"loadbootscript=" \
86 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
87 	"bootscript=echo Running bootscript from mmc ...; " \
88 		"source\0" \
89 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
90 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
91 	"mmcboot=echo Booting from mmc ...; " \
92 		"run finduuid; " \
93 		"run mmcargs; " \
94 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
95 			"if run loadfdt; then " \
96 				"bootz ${loadaddr} - ${fdt_addr}; " \
97 			"else " \
98 				"if test ${boot_fdt} = try; then " \
99 					"bootz; " \
100 				"else " \
101 					"echo WARN: Cannot load the DT; " \
102 				"fi; " \
103 			"fi; " \
104 		"else " \
105 			"bootz; " \
106 		"fi;\0" \
107 	"netargs=setenv bootargs console=${console},${baudrate} " \
108 		"root=/dev/nfs " \
109 	"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
110 		"netboot=echo Booting from net ...; " \
111 		"run netargs; " \
112 		"if test ${ip_dyn} = yes; then " \
113 			"setenv get_cmd dhcp; " \
114 		"else " \
115 			"setenv get_cmd tftp; " \
116 		"fi; " \
117 		"${get_cmd} ${image}; " \
118 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
119 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
120 				"bootz ${loadaddr} - ${fdt_addr}; " \
121 			"else " \
122 				"if test ${boot_fdt} = try; then " \
123 					"bootz; " \
124 				"else " \
125 					"echo WARN: Cannot load the DT; " \
126 				"fi; " \
127 			"fi; " \
128 		"else " \
129 			"bootz; " \
130 		"fi;\0"
131 
132 #define CONFIG_BOOTCOMMAND \
133 	   "mmc dev ${mmcdev};" \
134 	   "mmc dev ${mmcdev}; if mmc rescan; then " \
135 		   "if run loadbootscript; then " \
136 			   "run bootscript; " \
137 		   "else " \
138 			   "if run loadimage; then " \
139 				   "run mmcboot; " \
140 			   "else run netboot; " \
141 			   "fi; " \
142 		   "fi; " \
143 	   "else run netboot; fi"
144 
145 #endif				/* __CONFIG_H */
146