1 /*
2  * Configuration for Xilinx ZynqMP
3  * (C) Copyright 2014 - 2015 Xilinx, Inc.
4  * Michal Simek <michal.simek@xilinx.com>
5  *
6  * Based on Configuration for Versatile Express
7  *
8  * SPDX-License-Identifier:	GPL-2.0+
9  */
10 
11 #ifndef __XILINX_ZYNQMP_H
12 #define __XILINX_ZYNQMP_H
13 
14 #define CONFIG_REMAKE_ELF
15 
16 /* #define CONFIG_ARMV8_SWITCH_TO_EL1 */
17 
18 #define CONFIG_SYS_NO_FLASH
19 
20 #define CONFIG_SYS_GENERIC_BOARD
21 
22 /* Generic Interrupt Controller Definitions */
23 #define CONFIG_GICV2
24 #define GICD_BASE	0xF9010000
25 #define GICC_BASE	0xF9020000
26 
27 /* Physical Memory Map */
28 #define CONFIG_NR_DRAM_BANKS		1
29 #define CONFIG_SYS_SDRAM_BASE		0
30 #define CONFIG_SYS_SDRAM_SIZE		0x40000000
31 
32 #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
33 #define CONFIG_SYS_MEMTEST_END		CONFIG_SYS_SDRAM_SIZE
34 
35 /* Have release address at the end of 256MB for now */
36 #define CPU_RELEASE_ADDR	0xFFFFFF0
37 
38 /* Cache Definitions */
39 #define CONFIG_SYS_CACHELINE_SIZE	64
40 
41 #define CONFIG_IDENT_STRING		" Xilinx ZynqMP"
42 
43 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x7fff0)
44 
45 /* Flat Device Tree Definitions */
46 #define CONFIG_OF_LIBFDT
47 
48 /* Generic Timer Definitions - setup in EL3. Setup by ATF for other cases */
49 #define COUNTER_FREQUENCY		4000000
50 
51 /* Size of malloc() pool */
52 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x2000000)
53 
54 /* Serial setup */
55 #if defined(CONFIG_ZYNQMP_DCC)
56 # define CONFIG_ARM_DCC
57 # define CONFIG_CPU_ARMV8
58 #else
59 # if defined(CONFIG_ZYNQ_SERIAL_UART0) || defined(CONFIG_ZYNQ_SERIAL_UART1)
60 #  define CONFIG_ZYNQ_SERIAL
61 # endif
62 #endif
63 
64 #define CONFIG_CONS_INDEX		0
65 #define CONFIG_BAUDRATE			115200
66 #define CONFIG_SYS_BAUDRATE_TABLE \
67 	{ 4800, 9600, 19200, 38400, 57600, 115200 }
68 
69 /* Command line configuration */
70 #define CONFIG_CMD_ENV
71 #define CONFIG_CMD_EXT2
72 #define CONFIG_CMD_EXT4
73 #define CONFIG_CMD_FAT
74 #define CONFIG_CMD_FS_GENERIC
75 #define CONFIG_DOS_PARTITION
76 #define CONFIG_CMD_ELF
77 #define CONFIG_MP
78 
79 #define CONFIG_CMD_MII
80 
81 /* BOOTP options */
82 #define CONFIG_BOOTP_BOOTFILESIZE
83 #define CONFIG_BOOTP_BOOTPATH
84 #define CONFIG_BOOTP_GATEWAY
85 #define CONFIG_BOOTP_HOSTNAME
86 #define CONFIG_BOOTP_MAY_FAIL
87 #define CONFIG_BOOTP_SERVERIP
88 
89 /* SPI */
90 #ifdef CONFIG_ZYNQ_SPI
91 # define CONFIG_SPI_FLASH_SST
92 # define CONFIG_CMD_SF
93 #endif
94 
95 #if defined(CONFIG_ZYNQ_SDHCI0) || defined(CONFIG_ZYNQ_SDHCI1)
96 # define CONFIG_MMC
97 # define CONFIG_GENERIC_MMC
98 # define CONFIG_SDHCI
99 # define CONFIG_ZYNQ_SDHCI
100 # define CONFIG_CMD_MMC
101 #endif
102 
103 #if defined(CONFIG_ZYNQ_SDHCI)
104 # define CONFIG_FAT_WRITE
105 # define CONFIG_CMD_EXT4_WRITE
106 #endif
107 
108 /* Miscellaneous configurable options */
109 #define CONFIG_SYS_LOAD_ADDR		0x8000000
110 
111 #if defined(CONFIG_ZYNQMP_USB)
112 #define CONFIG_USB_DWC3
113 #define CONFIG_USB_DWC3_GADGET
114 
115 #define CONFIG_USB_GADGET
116 #define CONFIG_USB_GADGET_DOWNLOAD
117 #define CONFIG_USB_GADGET_DUALSPEED
118 #define CONFIG_USB_GADGET_VBUS_DRAW	2
119 #define CONFIG_USBDOWNLOAD_GADGET
120 #define CONFIG_SYS_DFU_DATA_BUF_SIZE	0x1800000
121 #define DFU_DEFAULT_POLL_TIMEOUT	300
122 #define CONFIG_USB_FUNCTION_DFU
123 #define CONFIG_DFU_RAM
124 #define CONFIG_G_DNL_VENDOR_NUM		0x03FD
125 #define CONFIG_G_DNL_PRODUCT_NUM	0x0300
126 #define CONFIG_G_DNL_MANUFACTURER	"Xilinx"
127 #define CONFIG_USB_CABLE_CHECK
128 #define CONFIG_CMD_DFU
129 #define CONFIG_CMD_THOR_DOWNLOAD
130 #define CONFIG_USB_FUNCTION_THOR
131 #define CONFIG_THOR_RESET_OFF
132 #define DFU_ALT_INFO_RAM \
133 	"dfu_ram_info=" \
134 	"set dfu_alt_info " \
135 	"Image ram 0x200000 0x1800000\\\\;" \
136 	"system.dtb ram 0x7000000 0x40000\0" \
137 	"dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \
138 	"thor_ram=run dfu_ram_info && thordown 0 ram 0\0"
139 
140 #define DFU_ALT_INFO  \
141 		DFU_ALT_INFO_RAM
142 #endif
143 
144 #if !defined(DFU_ALT_INFO)
145 # define DFU_ALT_INFO
146 #endif
147 
148 /* Initial environment variables */
149 #define CONFIG_EXTRA_ENV_SETTINGS \
150 	"kernel_addr=0x80000\0" \
151 	"fdt_addr=0x7000000\0" \
152 	"fdt_high=0x10000000\0" \
153 	"sdboot=mmcinfo && load mmc 0:0 $fdt_addr system.dtb && " \
154 		"load mmc 0:0 $kernel_addr Image && booti $kernel_addr - $fdt_addr\0" \
155 	DFU_ALT_INFO
156 
157 #define CONFIG_BOOTARGS		"setenv bootargs console=ttyPS0,${baudrate} " \
158 				"earlycon=cdns,mmio,0xff000000,${baudrate}n8"
159 #define CONFIG_PREBOOT		"run bootargs"
160 #define CONFIG_BOOTCOMMAND	"run $modeboot"
161 #define CONFIG_BOOTDELAY	5
162 
163 #define CONFIG_BOARD_LATE_INIT
164 
165 /* Do not preserve environment */
166 #define CONFIG_ENV_IS_NOWHERE		1
167 #define CONFIG_ENV_SIZE			0x1000
168 
169 /* Monitor Command Prompt */
170 /* Console I/O Buffer Size */
171 #define CONFIG_SYS_CBSIZE		2048
172 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
173 					sizeof(CONFIG_SYS_PROMPT) + 16)
174 #define CONFIG_SYS_HUSH_PARSER
175 #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
176 #define CONFIG_SYS_LONGHELP
177 #define CONFIG_CMDLINE_EDITING
178 #define CONFIG_SYS_MAXARGS		64
179 
180 /* Ethernet driver */
181 #if defined(CONFIG_ZYNQ_GEM0) || defined(CONFIG_ZYNQ_GEM1) || \
182 	defined(CONFIG_ZYNQ_GEM2) || defined(CONFIG_ZYNQ_GEM3)
183 # define CONFIG_NET_MULTI
184 # define CONFIG_ZYNQ_GEM
185 # define CONFIG_MII
186 # define CONFIG_SYS_FAULT_ECHO_LINK_DOWN
187 # define CONFIG_PHYLIB
188 # define CONFIG_PHY_MARVELL
189 #endif
190 
191 /* I2C */
192 #if defined(CONFIG_SYS_I2C_ZYNQ)
193 # define CONFIG_CMD_I2C
194 # define CONFIG_SYS_I2C
195 # define CONFIG_SYS_I2C_ZYNQ_SPEED		100000
196 # define CONFIG_SYS_I2C_ZYNQ_SLAVE		0
197 #endif
198 
199 /* EEPROM */
200 #ifdef CONFIG_ZYNQMP_EEPROM
201 # define CONFIG_CMD_EEPROM
202 # define CONFIG_SYS_I2C_EEPROM_ADDR_LEN		2
203 # define CONFIG_SYS_I2C_EEPROM_ADDR		0x54
204 # define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS	4
205 # define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS	5
206 # define CONFIG_SYS_EEPROM_SIZE			(64 * 1024)
207 #endif
208 
209 #ifdef CONFIG_AHCI
210 #define CONFIG_LIBATA
211 #define CONFIG_SCSI_AHCI
212 #define CONFIG_SCSI_AHCI_PLAT
213 #define CONFIG_SYS_SCSI_MAX_SCSI_ID	1
214 #define CONFIG_SYS_SCSI_MAX_LUN		1
215 #define CONFIG_SYS_SCSI_MAX_DEVICE	(CONFIG_SYS_SCSI_MAX_SCSI_ID * \
216 					 CONFIG_SYS_SCSI_MAX_LUN)
217 #define CONFIG_CMD_SCSI
218 #endif
219 
220 #define CONFIG_FIT
221 #define CONFIG_FIT_VERBOSE       /* enable fit_format_{error,warning}() */
222 
223 #define CONFIG_SYS_BOOTM_LEN	(60 * 1024 * 1024)
224 
225 #define CONFIG_CMD_BOOTI
226 #define CONFIG_CMD_UNZIP
227 
228 #define CONFIG_BOARD_EARLY_INIT_R
229 #define CONFIG_CLOCKS
230 
231 #endif /* __XILINX_ZYNQMP_H */
232