1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2016 Timesys Corporation
4  * Copyright (C) 2016 Advantech Corporation
5  * Copyright (C) 2012 Freescale Semiconductor, Inc.
6  */
7 
8 #ifndef __ADVANTECH_DMSBA16_CONFIG_H
9 #define __ADVANTECH_DMSBA16_CONFIG_H
10 
11 #include <asm/arch/imx-regs.h>
12 #include <asm/mach-imx/gpio.h>
13 
14 #define CONFIG_BOARD_NAME	"Advantech DMS-BA16"
15 
16 #define CONFIG_MXC_UART_BASE	UART4_BASE
17 #define CONSOLE_DEV	"ttymxc3"
18 #define CONFIG_EXTRA_BOOTARGS	"panic=10"
19 
20 #define CONFIG_BOOT_DIR	""
21 #define CONFIG_LOADCMD "fatload"
22 #define CONFIG_RFSPART "2"
23 
24 #include "mx6_common.h"
25 #include <linux/sizes.h>
26 
27 #define CONFIG_CMDLINE_TAG
28 #define CONFIG_SETUP_MEMORY_TAGS
29 #define CONFIG_INITRD_TAG
30 #define CONFIG_REVISION_TAG
31 #define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
32 
33 /* SATA Configs */
34 #define CONFIG_SYS_SATA_MAX_DEVICE	1
35 #define CONFIG_DWC_AHSATA_PORT_ID	0
36 #define CONFIG_DWC_AHSATA_BASE_ADDR	SATA_ARB_BASE_ADDR
37 #define CONFIG_LBA48
38 
39 /* MMC Configs */
40 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
41 
42 /* USB Configs */
43 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
44 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
45 #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
46 #define CONFIG_MXC_USB_FLAGS	0
47 
48 #define CONFIG_USBD_HS
49 
50 /* Networking Configs */
51 #define CONFIG_FEC_MXC
52 #define IMX_FEC_BASE			ENET_BASE_ADDR
53 #define CONFIG_FEC_XCV_TYPE		RGMII
54 #define CONFIG_ETHPRIME		"FEC"
55 #define CONFIG_FEC_MXC_PHYADDR		4
56 
57 /* Serial Flash */
58 
59 #define CONFIG_LOADADDR	0x12000000
60 
61 #define CONFIG_EXTRA_ENV_SETTINGS \
62 	"script=boot.scr\0" \
63 	"image=" CONFIG_BOOT_DIR "/uImage\0" \
64 	"uboot=u-boot.imx\0" \
65 	"fdt_file=" CONFIG_BOOT_DIR "/" CONFIG_DEFAULT_FDT_FILE "\0" \
66 	"fdt_addr=0x18000000\0" \
67 	"boot_fdt=yes\0" \
68 	"ip_dyn=yes\0" \
69 	"console=" CONSOLE_DEV "\0" \
70 	"fdt_high=0xffffffff\0"	  \
71 	"initrd_high=0xffffffff\0" \
72 	"sddev=0\0" \
73 	"emmcdev=1\0" \
74 	"partnum=1\0" \
75 	"loadcmd=" CONFIG_LOADCMD "\0" \
76 	"rfspart=" CONFIG_RFSPART "\0" \
77 	"update_sd_firmware=" \
78 		"if test ${ip_dyn} = yes; then " \
79 			"setenv get_cmd dhcp; " \
80 		"else " \
81 			"setenv get_cmd tftp; " \
82 		"fi; " \
83 		"if mmc dev ${mmcdev}; then "	\
84 			"if ${get_cmd} ${update_sd_firmware_filename}; then " \
85 				"setexpr fw_sz ${filesize} / 0x200; " \
86 				"setexpr fw_sz ${fw_sz} + 1; "	\
87 				"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
88 			"fi; "	\
89 		"fi\0" \
90 	"update_sf_uboot=" \
91 		"if tftp $loadaddr $uboot; then " \
92 			"sf probe; " \
93 			"sf erase 0 0xC0000; " \
94 			"sf write $loadaddr 0x400 $filesize; " \
95 			"echo 'U-Boot upgraded. Please reset'; " \
96 		"fi\0" \
97 	"setargs=setenv bootargs console=${console},${baudrate} " \
98 		"root=/dev/${rootdev} rw rootwait " CONFIG_EXTRA_BOOTARGS "\0" \
99 	"loadbootscript=" \
100 		"${loadcmd} ${dev} ${devnum}:${partnum} ${loadaddr} ${script};\0" \
101 	"bootscript=echo Running bootscript from ${dev}:${devnum}:${partnum};" \
102 		" source\0" \
103 	"loadimage=" \
104 		"${loadcmd} ${dev} ${devnum}:${partnum} ${loadaddr} ${image}\0" \
105 	"loadfdt=${loadcmd} ${dev} ${devnum}:${partnum} ${fdt_addr} ${fdt_file}\0" \
106 	"tryboot=" \
107 		"if run loadbootscript; then " \
108 			"run bootscript; " \
109 		"else " \
110 			"if run loadimage; then " \
111 				"run doboot; " \
112 			"fi; " \
113 		"fi;\0" \
114 	"doboot=echo Booting from ${dev}:${devnum}:${partnum} ...; " \
115 		"run setargs; " \
116 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
117 			"if run loadfdt; then " \
118 				"bootm ${loadaddr} - ${fdt_addr}; " \
119 			"else " \
120 				"if test ${boot_fdt} = try; then " \
121 					"bootm; " \
122 				"else " \
123 					"echo WARN: Cannot load the DT; " \
124 				"fi; " \
125 			"fi; " \
126 		"else " \
127 			"bootm; " \
128 		"fi;\0" \
129 	"netargs=setenv bootargs console=${console},${baudrate} " \
130 		"root=/dev/nfs " \
131 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
132 	"netboot=echo Booting from net ...; " \
133 		"run netargs; " \
134 		"if test ${ip_dyn} = yes; then " \
135 			"setenv get_cmd dhcp; " \
136 		"else " \
137 			"setenv get_cmd tftp; " \
138 		"fi; " \
139 		"${get_cmd} ${image}; " \
140 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
141 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
142 				"bootm ${loadaddr} - ${fdt_addr}; " \
143 			"else " \
144 				"if test ${boot_fdt} = try; then " \
145 					"bootm; " \
146 				"else " \
147 					"echo WARN: Cannot load the DT; " \
148 				"fi; " \
149 			"fi; " \
150 		"else " \
151 			"bootm; " \
152 		"fi;\0" \
153 
154 #define CONFIG_BOOTCOMMAND \
155 	"usb start; " \
156 	"setenv dev usb; " \
157 	"setenv devnum 0; " \
158 	"setenv rootdev sda${rfspart}; " \
159 	"run tryboot; " \
160 	\
161 	"setenv dev mmc; " \
162 	"setenv rootdev mmcblk0p${rfspart}; " \
163 	\
164 	"setenv devnum ${sddev}; " \
165 	"if mmc dev ${devnum}; then " \
166 		"run tryboot; " \
167 	"fi; " \
168 	\
169 	"setenv devnum ${emmcdev}; " \
170 	"setenv rootdev mmcblk${emmcdev}p${rfspart}; " \
171 	"if mmc dev ${devnum}; then " \
172 		"run tryboot; " \
173 	"fi; " \
174 	\
175 	"bmode usb; " \
176 
177 #define CONFIG_ARP_TIMEOUT     200UL
178 
179 /* Miscellaneous configurable options */
180 
181 #define CONFIG_SYS_LOAD_ADDR           CONFIG_LOADADDR
182 
183 /* Physical Memory Map */
184 #define PHYS_SDRAM                     MMDC0_ARB_BASE_ADDR
185 
186 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM
187 #define CONFIG_SYS_INIT_RAM_ADDR       IRAM_BASE_ADDR
188 #define CONFIG_SYS_INIT_RAM_SIZE       IRAM_SIZE
189 
190 #define CONFIG_SYS_INIT_SP_OFFSET \
191 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
192 #define CONFIG_SYS_INIT_SP_ADDR \
193 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
194 
195 /* FLASH and environment organization */
196 
197 #define CONFIG_SYS_FSL_USDHC_NUM        3
198 
199 /* Framebuffer */
200 #define CONFIG_VIDEO_LOGO
201 #define CONFIG_VIDEO_BMP_LOGO
202 #define CONFIG_IMX_HDMI
203 #define CONFIG_IMX_VIDEO_SKIP
204 
205 #define CONFIG_IMX6_PWM_PER_CLK         66000000
206 
207 #ifdef CONFIG_CMD_PCI
208 #define CONFIG_PCI_SCAN_SHOW
209 #define CONFIG_PCIE_IMX
210 #define CONFIG_PCIE_IMX_PERST_GPIO      IMX_GPIO_NR(7, 12)
211 #define CONFIG_PCIE_IMX_POWER_GPIO      IMX_GPIO_NR(1, 5)
212 #endif
213 
214 /* I2C Configs */
215 #define CONFIG_SYS_I2C
216 #define CONFIG_SYS_I2C_MXC
217 #define CONFIG_SYS_I2C_SPEED            100000
218 #define CONFIG_SYS_I2C_MXC_I2C1
219 #define CONFIG_SYS_I2C_MXC_I2C2
220 #define CONFIG_SYS_I2C_MXC_I2C3
221 
222 #endif	/* __ADVANTECH_DMSBA16_CONFIG_H */
223