1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * (C) Copyright 2012 Michal Simek <monstr@monstr.eu>
4 * (C) Copyright 2013 - 2018 Xilinx, Inc.
6 * Common configuration options for all Zynq boards.
9 #ifndef __CONFIG_ZYNQ_COMMON_H
10 #define __CONFIG_ZYNQ_COMMON_H
13 #ifndef CONFIG_SYS_L2CACHE_OFF
14 # define CFG_SYS_PL310_BASE 0xf8f02000
17 #define ZYNQ_SCUTIMER_BASEADDR 0xF8F00600
18 #define CFG_SYS_TIMERBASE ZYNQ_SCUTIMER_BASEADDR
19 #define CFG_SYS_TIMER_COUNTER (CFG_SYS_TIMERBASE + 0x4)
21 /* GUIDs for capsule updatable firmware images */
22 #define XILINX_BOOT_IMAGE_GUID \
23 EFI_GUID(0x1ba29a15, 0x9969, 0x40aa, 0xb4, 0x24, \
24 0xe8, 0x61, 0x21, 0x61, 0x86, 0x64)
26 #define XILINX_UBOOT_IMAGE_GUID \
27 EFI_GUID(0x1a5178f0, 0x87d3, 0x4f36, 0xac, 0x63, \
28 0x3b, 0x31, 0xa2, 0x3b, 0xe3, 0x05)
31 /* The following table includes the supported baudrates */
32 #define CFG_SYS_BAUDRATE_TABLE \
33 {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
39 #ifdef CONFIG_USB_EHCI_ZYNQ
40 # define DFU_DEFAULT_POLL_TIMEOUT 300
43 /* enable preboot to be loaded before CONFIG_BOOTDELAY */
45 /* Boot configuration */
47 #ifdef CONFIG_XPL_BUILD
52 #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
54 #define BOOT_TARGET_DEVICES_MMC(func)
58 #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1)
60 #define BOOT_TARGET_DEVICES_USB(func)
63 #if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP)
64 #define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
66 #define BOOT_TARGET_DEVICES_PXE(func)
69 #if defined(CONFIG_CMD_DHCP)
70 #define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
72 #define BOOT_TARGET_DEVICES_DHCP(func)
75 #if defined(CONFIG_ZYNQ_QSPI)
76 # define BOOT_TARGET_DEVICES_QSPI(func) func(QSPI, qspi, na)
78 # define BOOT_TARGET_DEVICES_QSPI(func)
81 #if defined(CONFIG_NAND_ZYNQ)
82 # define BOOT_TARGET_DEVICES_NAND(func) func(NAND, nand, na)
84 # define BOOT_TARGET_DEVICES_NAND(func)
87 #if defined(CONFIG_MTD_NOR_FLASH)
88 # define BOOT_TARGET_DEVICES_NOR(func) func(NOR, nor, na)
90 # define BOOT_TARGET_DEVICES_NOR(func)
93 #define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
94 "bootcmd_qspi=sf probe 0 0 0 && " \
95 "sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
96 "echo QSPI: Trying to boot script at ${scriptaddr} && " \
97 "source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0"
99 #define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
102 #define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
103 "bootcmd_nand=nand info && " \
104 "nand read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
105 "echo NAND: Trying to boot script at ${scriptaddr} && " \
106 "source ${scriptaddr}; echo NAND: SCRIPT FAILED: continuing...;\0"
108 #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
111 #define BOOTENV_DEV_NOR(devtypeu, devtypel, instance) \
112 "script_offset_nor=0xE2FC0000\0" \
113 "bootcmd_nor=cp.b ${script_offset_nor} ${scriptaddr} ${script_size_f} && " \
114 "echo NOR: Trying to boot script at ${scriptaddr} && " \
115 "source ${scriptaddr}; echo NOR: SCRIPT FAILED: continuing...;\0"
117 #define BOOTENV_DEV_NAME_NOR(devtypeu, devtypel, instance) \
120 #define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na)
122 #define BOOTENV_DEV_JTAG(devtypeu, devtypel, instance) \
123 "bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && " \
124 "source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;\0"
126 #define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \
129 #define BOOT_TARGET_DEVICES_USB_DFU(func) \
130 func(USB_DFU, usb_dfu, 0) func(USB_DFU, usb_dfu, 1)
132 #define BOOTENV_DEV_USB_DFU(devtypeu, devtypel, instance) \
133 "bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \
134 "$scriptaddr $script_size_f && " \
135 "dfu " #instance " ram " #instance " 60 && " \
136 "echo DFU" #instance ": Trying to boot script at ${scriptaddr} && " \
137 "source ${scriptaddr}; " \
138 "echo DFU" #instance ": SCRIPT FAILED: continuing...;\0"
140 #define BOOTENV_DEV_NAME_USB_DFU(devtypeu, devtypel, instance) \
143 #define BOOT_TARGET_DEVICES_USB_THOR(func) \
144 func(USB_THOR, usb_thor, 0) func(USB_THOR, usb_thor, 1)
146 #define BOOTENV_DEV_USB_THOR(devtypeu, devtypel, instance) \
147 "bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \
148 "$scriptaddr $script_size_f && " \
149 "thordown " #instance " ram " #instance " && " \
150 "echo THOR" #instance ": Trying to boot script at ${scriptaddr} && " \
151 "source ${scriptaddr}; " \
152 "echo THOR" #instance ": SCRIPT FAILED: continuing...;\0"
154 #define BOOTENV_DEV_NAME_USB_THOR(devtypeu, devtypel, instance) \
157 #define BOOT_TARGET_DEVICES(func) \
158 BOOT_TARGET_DEVICES_JTAG(func) \
159 BOOT_TARGET_DEVICES_MMC(func) \
160 BOOT_TARGET_DEVICES_QSPI(func) \
161 BOOT_TARGET_DEVICES_NAND(func) \
162 BOOT_TARGET_DEVICES_NOR(func) \
163 BOOT_TARGET_DEVICES_USB_DFU(func) \
164 BOOT_TARGET_DEVICES_USB_THOR(func) \
165 BOOT_TARGET_DEVICES_USB(func) \
166 BOOT_TARGET_DEVICES_PXE(func) \
167 BOOT_TARGET_DEVICES_DHCP(func)
169 #include <config_distro_bootcmd.h>
170 #endif /* CONFIG_XPL_BUILD */
172 /* Default environment */
173 #ifndef CFG_EXTRA_ENV_SETTINGS
174 #define CFG_EXTRA_ENV_SETTINGS \
175 "script_size_f=0x40000\0" \
176 "fdt_addr_r=0x1f00000\0" \
177 "pxefile_addr_r=0x2000000\0" \
178 "kernel_addr_r=0x2000000\0" \
179 "ramdisk_addr_r=0x3100000\0" \
183 /* Miscellaneous configurable options */
185 #define CFG_SYS_INIT_RAM_ADDR 0xFFFF0000
186 #define CFG_SYS_INIT_RAM_SIZE 0x2000
188 /* Extend size of kernel image for uncompression */
190 /* Address in RAM where the parameters must be copied by SPL. */
192 /* Not using MMC raw mode - just for compilation purpose */
194 /* qspi mode is working fine */
195 #ifdef CONFIG_ZYNQ_QSPI
196 #define CFG_SYS_SPI_ARGS_OFFS 0x200000
197 #define CFG_SYS_SPI_ARGS_SIZE 0x80000
198 #define CFG_SYS_SPI_KERNEL_OFFS (CFG_SYS_SPI_ARGS_OFFS + \
199 CFG_SYS_SPI_ARGS_SIZE)
202 /* SP location before relocation, must use scratch RAM */
204 /* 3 * 64kB blocks of OCM - one is on the top because of bootrom */
206 /* On the top of OCM space */
209 * SPL stack position - and stack goes down
210 * 0xfffffe00 is used for putting wfi loop.
211 * Set it up as limit for now.
214 #endif /* __CONFIG_ZYNQ_COMMON_H */