1
2
3
4
5
6
7
8
9#ifndef __CONFIG_ZYNQ_COMMON_H
10#define __CONFIG_ZYNQ_COMMON_H
11
12
13#ifndef CONFIG_CPU_FREQ_HZ
14# define CONFIG_CPU_FREQ_HZ 800000000
15#endif
16
17#define CONFIG_REMAKE_ELF
18
19
20#define CONFIG_SYS_L2CACHE_OFF
21#ifndef CONFIG_SYS_L2CACHE_OFF
22# define CONFIG_SYS_L2_PL310
23# define CONFIG_SYS_PL310_BASE 0xf8f02000
24#endif
25
26#define ZYNQ_SCUTIMER_BASEADDR 0xF8F00600
27#define CONFIG_SYS_TIMERBASE ZYNQ_SCUTIMER_BASEADDR
28#define CONFIG_SYS_TIMER_COUNTS_DOWN
29#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMERBASE + 0x4)
30
31
32
33#define CONFIG_SYS_BAUDRATE_TABLE \
34 {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
35
36#define CONFIG_ARM_DCC
37
38
39#if defined(CONFIG_ZYNQ_GEM)
40# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN
41# define CONFIG_BOOTP_MAY_FAIL
42#endif
43
44
45
46
47#ifdef CONFIG_MTD_NOR_FLASH
48# define CONFIG_SYS_FLASH_BASE 0xE2000000
49# define CONFIG_SYS_FLASH_SIZE (16 * 1024 * 1024)
50# define CONFIG_SYS_MAX_FLASH_BANKS 1
51# define CONFIG_SYS_MAX_FLASH_SECT 512
52# define CONFIG_SYS_FLASH_ERASE_TOUT 1000
53# define CONFIG_SYS_FLASH_WRITE_TOUT 5000
54# define CONFIG_FLASH_SHOW_PROGRESS 10
55# undef CONFIG_SYS_FLASH_EMPTY_INFO
56#endif
57
58#ifdef CONFIG_NAND_ZYNQ
59#define CONFIG_SYS_MAX_NAND_DEVICE 1
60#define CONFIG_SYS_NAND_ONFI_DETECTION
61#endif
62
63#ifdef CONFIG_USB_EHCI_ZYNQ
64# define CONFIG_EHCI_IS_TDI
65
66# define CONFIG_SYS_DFU_DATA_BUF_SIZE 0x600000
67# define DFU_DEFAULT_POLL_TIMEOUT 300
68# define CONFIG_THOR_RESET_OFF
69# define DFU_ALT_INFO_RAM \
70 "dfu_ram_info=" \
71 "setenv dfu_alt_info " \
72 "${kernel_image} ram 0x3000000 0x500000\\\\;" \
73 "${devicetree_image} ram 0x2A00000 0x20000\\\\;" \
74 "${ramdisk_image} ram 0x2000000 0x600000\0" \
75 "dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \
76 "thor_ram=run dfu_ram_info && thordown 0 ram 0\0"
77
78# if defined(CONFIG_MMC_SDHCI_ZYNQ)
79# define DFU_ALT_INFO_MMC \
80 "dfu_mmc_info=" \
81 "setenv dfu_alt_info " \
82 "${kernel_image} fat 0 1\\\\;" \
83 "${devicetree_image} fat 0 1\\\\;" \
84 "${ramdisk_image} fat 0 1\0" \
85 "dfu_mmc=run dfu_mmc_info && dfu 0 mmc 0\0" \
86 "thor_mmc=run dfu_mmc_info && thordown 0 mmc 0\0"
87
88# define DFU_ALT_INFO \
89 DFU_ALT_INFO_RAM \
90 DFU_ALT_INFO_MMC
91# else
92# define DFU_ALT_INFO \
93 DFU_ALT_INFO_RAM
94# endif
95#endif
96
97#if !defined(DFU_ALT_INFO)
98# define DFU_ALT_INFO
99#endif
100
101
102#define CONFIG_ENV_OVERWRITE
103
104
105
106
107#define CONFIG_SYS_LOAD_ADDR 0
108
109#ifdef CONFIG_SPL_BUILD
110#define BOOTENV
111#else
112
113#ifdef CONFIG_CMD_MMC
114#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
115#else
116#define BOOT_TARGET_DEVICES_MMC(func)
117#endif
118
119#ifdef CONFIG_CMD_USB
120#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
121#else
122#define BOOT_TARGET_DEVICES_USB(func)
123#endif
124
125#if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP)
126#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
127#else
128#define BOOT_TARGET_DEVICES_PXE(func)
129#endif
130
131#if defined(CONFIG_CMD_DHCP)
132#define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
133#else
134#define BOOT_TARGET_DEVICES_DHCP(func)
135#endif
136
137#if defined(CONFIG_ZYNQ_QSPI)
138# define BOOT_TARGET_DEVICES_QSPI(func) func(QSPI, qspi, na)
139#else
140# define BOOT_TARGET_DEVICES_QSPI(func)
141#endif
142
143#if defined(CONFIG_NAND_ZYNQ)
144# define BOOT_TARGET_DEVICES_NAND(func) func(NAND, nand, na)
145#else
146# define BOOT_TARGET_DEVICES_NAND(func)
147#endif
148
149#if defined(CONFIG_MTD_NOR_FLASH)
150# define BOOT_TARGET_DEVICES_NOR(func) func(NOR, nor, na)
151#else
152# define BOOT_TARGET_DEVICES_NOR(func)
153#endif
154
155#define BOOTENV_DEV_XILINX(devtypeu, devtypel, instance) \
156 "bootcmd_xilinx=run $modeboot\0"
157
158#define BOOTENV_DEV_NAME_XILINX(devtypeu, devtypel, instance) \
159 "xilinx "
160
161#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
162 "bootcmd_qspi=sf probe 0 0 0 && " \
163 "sf read $scriptaddr $script_offset_f $script_size_f && " \
164 "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
165
166#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
167 "qspi "
168
169#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
170 "bootcmd_nand=nand info && " \
171 "nand read $scriptaddr $script_offset_f $script_size_f && " \
172 "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
173
174#define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
175 "nand "
176
177#define BOOTENV_DEV_NOR(devtypeu, devtypel, instance) \
178 "bootcmd_nor=cp.b $scropt_offset_nor $scriptaddr $script_size_f && " \
179 "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
180
181#define BOOTENV_DEV_NAME_NOR(devtypeu, devtypel, instance) \
182 "nor "
183
184#define BOOT_TARGET_DEVICES(func) \
185 BOOT_TARGET_DEVICES_MMC(func) \
186 BOOT_TARGET_DEVICES_QSPI(func) \
187 BOOT_TARGET_DEVICES_NAND(func) \
188 BOOT_TARGET_DEVICES_NOR(func) \
189 BOOT_TARGET_DEVICES_USB(func) \
190 BOOT_TARGET_DEVICES_PXE(func) \
191 BOOT_TARGET_DEVICES_DHCP(func) \
192 func(XILINX, xilinx, na)
193
194#include <config_distro_bootcmd.h>
195#endif
196
197
198#ifndef CONFIG_EXTRA_ENV_SETTINGS
199#define CONFIG_EXTRA_ENV_SETTINGS \
200 "fit_image=fit.itb\0" \
201 "load_addr=0x2000000\0" \
202 "fit_size=0x800000\0" \
203 "flash_off=0x100000\0" \
204 "nor_flash_off=0xE2100000\0" \
205 "fdt_high=0x20000000\0" \
206 "initrd_high=0x20000000\0" \
207 "scriptaddr=0x20000\0" \
208 "script_offser_nor=0xE2FC0000\0" \
209 "script_offset_f=0xFC0000\0" \
210 "script_size_f=0x40000\0" \
211 "loadbootenv_addr=0x2000000\0" \
212 "fdt_addr_r=0x1f00000\0" \
213 "pxefile_addr_r=0x2000000\0" \
214 "kernel_addr_r=0x2000000\0" \
215 "scriptaddr=0x3000000\0" \
216 "ramdisk_addr_r=0x3100000\0" \
217 "bootenv=uEnv.txt\0" \
218 "bootenv_dev=mmc\0" \
219 "loadbootenv=load ${bootenv_dev} 0 ${loadbootenv_addr} ${bootenv}\0" \
220 "importbootenv=echo Importing environment from ${bootenv_dev} ...; " \
221 "env import -t ${loadbootenv_addr} $filesize\0" \
222 "bootenv_existence_test=test -e ${bootenv_dev} 0 /${bootenv}\0" \
223 "setbootenv=if env run bootenv_existence_test; then " \
224 "if env run loadbootenv; then " \
225 "env run importbootenv; " \
226 "fi; " \
227 "fi; \0" \
228 "sd_loadbootenv=setenv bootenv_dev mmc && " \
229 "run setbootenv \0" \
230 "usb_loadbootenv=setenv bootenv_dev usb && usb start && run setbootenv \0" \
231 "preboot=if test $modeboot = sdboot; then " \
232 "run sd_loadbootenv; " \
233 "echo Checking if uenvcmd is set ...; " \
234 "if test -n $uenvcmd; then " \
235 "echo Running uenvcmd ...; " \
236 "run uenvcmd; " \
237 "fi; " \
238 "fi; \0" \
239 "norboot=echo Copying FIT from NOR flash to RAM... && " \
240 "cp.b ${nor_flash_off} ${load_addr} ${fit_size} && " \
241 "bootm ${load_addr}\0" \
242 "sdboot=echo Copying FIT from SD to RAM... && " \
243 "load mmc 0 ${load_addr} ${fit_image} && " \
244 "bootm ${load_addr}\0" \
245 "jtagboot=echo TFTPing FIT to RAM... && " \
246 "tftpboot ${load_addr} ${fit_image} && " \
247 "bootm ${load_addr}\0" \
248 "usbboot=if usb start; then " \
249 "echo Copying FIT from USB to RAM... && " \
250 "load usb 0 ${load_addr} ${fit_image} && " \
251 "bootm ${load_addr}; fi\0" \
252 DFU_ALT_INFO \
253 BOOTENV
254#endif
255
256
257
258#define CONFIG_CLOCKS
259#define CONFIG_SYS_MAXARGS 32
260
261#define CONFIG_SYS_MEMTEST_START 0
262#define CONFIG_SYS_MEMTEST_END 0x1000
263
264#define CONFIG_SYS_INIT_RAM_ADDR 0xFFFF0000
265#define CONFIG_SYS_INIT_RAM_SIZE 0x1000
266#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \
267 CONFIG_SYS_INIT_RAM_SIZE - \
268 GENERATED_GBL_DATA_SIZE)
269
270
271
272#define CONFIG_SYS_BOOTM_LEN (60 * 1024 * 1024)
273
274
275#define CONFIG_SYS_MMC_MAX_DEVICE 1
276
277
278#ifdef CONFIG_MMC_SDHCI_ZYNQ
279#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
280#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
281#endif
282
283
284#define CONFIG_SYS_SPL_ARGS_ADDR 0x10000000
285
286#define CONFIG_SPL_FS_LOAD_ARGS_NAME "system.dtb"
287#define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage"
288
289
290#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0
291#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0
292#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0
293
294
295#ifdef CONFIG_ZYNQ_QSPI
296#define CONFIG_SYS_SPI_ARGS_OFFS 0x200000
297#define CONFIG_SYS_SPI_ARGS_SIZE 0x80000
298#define CONFIG_SYS_SPI_KERNEL_OFFS (CONFIG_SYS_SPI_ARGS_OFFS + \
299 CONFIG_SYS_SPI_ARGS_SIZE)
300#endif
301
302
303
304
305#define CONFIG_SPL_MAX_SIZE 0x30000
306
307
308#define CONFIG_SYS_SPL_MALLOC_START CONFIG_SPL_STACK_R_ADDR
309#define CONFIG_SYS_SPL_MALLOC_SIZE 0x2000000
310
311
312
313
314
315
316#define CONFIG_SPL_STACK 0xfffffe00
317
318
319#define CONFIG_SPL_BSS_START_ADDR 0x100000
320#define CONFIG_SPL_BSS_MAX_SIZE 0x100000
321
322#define CONFIG_SPL_LOAD_FIT_ADDRESS 0x10000000
323
324#define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
325
326#endif
327