blob: 553bb1b45b69baa4852d2149a9fbad7d53bf587e [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Michal Simekf22651c2012-09-28 09:56:37 +00002/*
3 * (C) Copyright 2012 Michal Simek <monstr@monstr.eu>
Michal Simek3e1b61d2018-01-17 07:37:47 +01004 * (C) Copyright 2013 - 2018 Xilinx, Inc.
Jagannadha Sutradharudu Teki06fe8da2014-01-09 01:48:10 +05305 *
6 * Common configuration options for all Zynq boards.
Michal Simekf22651c2012-09-28 09:56:37 +00007 */
8
Jagannadha Sutradharudu Teki06fe8da2014-01-09 01:48:10 +05309#ifndef __CONFIG_ZYNQ_COMMON_H
10#define __CONFIG_ZYNQ_COMMON_H
Michal Simekf22651c2012-09-28 09:56:37 +000011
Jagannadha Sutradharudu Teki8cfac502014-01-09 01:48:07 +053012/* Cache options */
Jagannadha Sutradharudu Teki8cfac502014-01-09 01:48:07 +053013#ifndef CONFIG_SYS_L2CACHE_OFF
Tom Rini65cc0e22022-11-16 13:10:41 -050014# define CFG_SYS_PL310_BASE 0xf8f02000
Jagannadha Sutradharudu Teki8cfac502014-01-09 01:48:07 +053015#endif
16
Michal Simeka2ec7fb2015-04-20 12:56:24 +020017#define ZYNQ_SCUTIMER_BASEADDR 0xF8F00600
Tom Rini65cc0e22022-11-16 13:10:41 -050018#define CFG_SYS_TIMERBASE ZYNQ_SCUTIMER_BASEADDR
19#define CFG_SYS_TIMER_COUNTER (CFG_SYS_TIMERBASE + 0x4)
Michal Simeka2ec7fb2015-04-20 12:56:24 +020020
Sughosh Ganu741ef862022-04-15 11:29:34 +053021/* 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)
25
26#define XILINX_UBOOT_IMAGE_GUID \
27 EFI_GUID(0x1a5178f0, 0x87d3, 0x4f36, 0xac, 0x63, \
28 0x3b, 0x31, 0xa2, 0x3b, 0xe3, 0x05)
29
Jagannadha Sutradharudu Teki53e49f72014-01-09 01:48:06 +053030/* Serial drivers */
Michal Simekf22651c2012-09-28 09:56:37 +000031/* The following table includes the supported baudrates */
Tom Rini65cc0e22022-11-16 13:10:41 -050032#define CFG_SYS_BAUDRATE_TABLE \
Michal Simekf22651c2012-09-28 09:56:37 +000033 {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
34
Michal Simekf22651c2012-09-28 09:56:37 +000035/* Ethernet driver */
Michal Simekf22651c2012-09-28 09:56:37 +000036
Jagannadha Sutradharudu Tekife5eddb2014-01-09 01:48:20 +053037/* NOR */
Jagannadha Sutradharudu Tekife5eddb2014-01-09 01:48:20 +053038
Siva Durga Prasad Paladugu2cdc7782016-07-22 14:51:51 +053039#ifdef CONFIG_USB_EHCI_ZYNQ
Siva Durga Prasad Paladugu87f3dbd2014-08-25 10:58:33 +053040# define DFU_DEFAULT_POLL_TIMEOUT 300
Siva Durga Prasad Paladuguc6024c82014-02-20 10:28:27 +053041#endif
42
Michal Simek4d1ed9c2016-03-18 23:43:39 +010043/* enable preboot to be loaded before CONFIG_BOOTDELAY */
Michal Simek4d1ed9c2016-03-18 23:43:39 +010044
Alexander Graf61d8eeb2017-07-03 13:41:35 +020045/* Boot configuration */
Alexander Graf61d8eeb2017-07-03 13:41:35 +020046
Alexander Graf61d8eeb2017-07-03 13:41:35 +020047#ifdef CONFIG_SPL_BUILD
48#define BOOTENV
49#else
Alexander Graf61d8eeb2017-07-03 13:41:35 +020050
51#ifdef CONFIG_CMD_MMC
Michal Simek7712fb12019-09-11 12:51:49 +020052#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
Alexander Graf61d8eeb2017-07-03 13:41:35 +020053#else
54#define BOOT_TARGET_DEVICES_MMC(func)
55#endif
56
57#ifdef CONFIG_CMD_USB
Michal Simek559e5a62019-09-11 13:00:57 +020058#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1)
Alexander Graf61d8eeb2017-07-03 13:41:35 +020059#else
60#define BOOT_TARGET_DEVICES_USB(func)
61#endif
62
Joe Hershberger86271b32018-04-13 15:26:40 -050063#if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP)
Alexander Graf61d8eeb2017-07-03 13:41:35 +020064#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
65#else
66#define BOOT_TARGET_DEVICES_PXE(func)
67#endif
68
69#if defined(CONFIG_CMD_DHCP)
70#define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
71#else
72#define BOOT_TARGET_DEVICES_DHCP(func)
73#endif
74
Siva Durga Prasad Paladugu90e97ab2019-01-25 17:06:05 +053075#if defined(CONFIG_ZYNQ_QSPI)
76# define BOOT_TARGET_DEVICES_QSPI(func) func(QSPI, qspi, na)
77#else
78# define BOOT_TARGET_DEVICES_QSPI(func)
79#endif
80
81#if defined(CONFIG_NAND_ZYNQ)
82# define BOOT_TARGET_DEVICES_NAND(func) func(NAND, nand, na)
83#else
84# define BOOT_TARGET_DEVICES_NAND(func)
85#endif
86
87#if defined(CONFIG_MTD_NOR_FLASH)
88# define BOOT_TARGET_DEVICES_NOR(func) func(NOR, nor, na)
89#else
90# define BOOT_TARGET_DEVICES_NOR(func)
91#endif
92
Siva Durga Prasad Paladugu90e97ab2019-01-25 17:06:05 +053093#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
94 "bootcmd_qspi=sf probe 0 0 0 && " \
Michal Simeka542a932019-09-11 13:12:43 +020095 "sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
Michal Simek19d13042020-04-20 09:17:53 +020096 "echo QSPI: Trying to boot script at ${scriptaddr} && " \
97 "source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0"
Siva Durga Prasad Paladugu90e97ab2019-01-25 17:06:05 +053098
99#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
100 "qspi "
101
102#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
103 "bootcmd_nand=nand info && " \
Michal Simeka542a932019-09-11 13:12:43 +0200104 "nand read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
Michal Simek19d13042020-04-20 09:17:53 +0200105 "echo NAND: Trying to boot script at ${scriptaddr} && " \
106 "source ${scriptaddr}; echo NAND: SCRIPT FAILED: continuing...;\0"
Siva Durga Prasad Paladugu90e97ab2019-01-25 17:06:05 +0530107
108#define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
109 "nand "
110
111#define BOOTENV_DEV_NOR(devtypeu, devtypel, instance) \
Michal Simek90b9fcb2019-09-11 13:16:33 +0200112 "script_offset_nor=0xE2FC0000\0" \
113 "bootcmd_nor=cp.b ${script_offset_nor} ${scriptaddr} ${script_size_f} && " \
Michal Simek19d13042020-04-20 09:17:53 +0200114 "echo NOR: Trying to boot script at ${scriptaddr} && " \
115 "source ${scriptaddr}; echo NOR: SCRIPT FAILED: continuing...;\0"
Siva Durga Prasad Paladugu90e97ab2019-01-25 17:06:05 +0530116
117#define BOOTENV_DEV_NAME_NOR(devtypeu, devtypel, instance) \
118 "nor "
119
T Karthik Reddyc352f1e2019-11-13 21:13:44 -0700120#define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na)
121
122#define BOOTENV_DEV_JTAG(devtypeu, devtypel, instance) \
Michal Simek19d13042020-04-20 09:17:53 +0200123 "bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && " \
124 "source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;\0"
T Karthik Reddyc352f1e2019-11-13 21:13:44 -0700125
126#define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \
127 "jtag "
128
T Karthik Reddyb8126ab2021-03-30 23:24:58 -0600129#define BOOT_TARGET_DEVICES_USB_DFU(func) \
130 func(USB_DFU, usb_dfu, 0) func(USB_DFU, usb_dfu, 1)
131
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"
139
140#define BOOTENV_DEV_NAME_USB_DFU(devtypeu, devtypel, instance) \
141 ""
142
143#define BOOT_TARGET_DEVICES_USB_THOR(func) \
144 func(USB_THOR, usb_thor, 0) func(USB_THOR, usb_thor, 1)
145
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"
153
154#define BOOTENV_DEV_NAME_USB_THOR(devtypeu, devtypel, instance) \
155 ""
156
Alexander Graf61d8eeb2017-07-03 13:41:35 +0200157#define BOOT_TARGET_DEVICES(func) \
T Karthik Reddyc352f1e2019-11-13 21:13:44 -0700158 BOOT_TARGET_DEVICES_JTAG(func) \
Alexander Graf61d8eeb2017-07-03 13:41:35 +0200159 BOOT_TARGET_DEVICES_MMC(func) \
Siva Durga Prasad Paladugu90e97ab2019-01-25 17:06:05 +0530160 BOOT_TARGET_DEVICES_QSPI(func) \
161 BOOT_TARGET_DEVICES_NAND(func) \
162 BOOT_TARGET_DEVICES_NOR(func) \
T Karthik Reddyb8126ab2021-03-30 23:24:58 -0600163 BOOT_TARGET_DEVICES_USB_DFU(func) \
164 BOOT_TARGET_DEVICES_USB_THOR(func) \
Alexander Graf61d8eeb2017-07-03 13:41:35 +0200165 BOOT_TARGET_DEVICES_USB(func) \
166 BOOT_TARGET_DEVICES_PXE(func) \
Michal Simek83a0e802019-09-10 15:01:53 +0200167 BOOT_TARGET_DEVICES_DHCP(func)
Alexander Graf61d8eeb2017-07-03 13:41:35 +0200168
169#include <config_distro_bootcmd.h>
170#endif /* CONFIG_SPL_BUILD */
171
Jagannadha Sutradharudu Tekie83f61a2014-01-09 01:48:22 +0530172/* Default environment */
Tom Rini0613c362022-12-04 10:03:50 -0500173#ifndef CFG_EXTRA_ENV_SETTINGS
174#define CFG_EXTRA_ENV_SETTINGS \
Siva Durga Prasad Paladugu90e97ab2019-01-25 17:06:05 +0530175 "script_size_f=0x40000\0" \
Alexander Graf61d8eeb2017-07-03 13:41:35 +0200176 "fdt_addr_r=0x1f00000\0" \
177 "pxefile_addr_r=0x2000000\0" \
178 "kernel_addr_r=0x2000000\0" \
Alexander Graf61d8eeb2017-07-03 13:41:35 +0200179 "ramdisk_addr_r=0x3100000\0" \
Michal Simek83a0e802019-09-10 15:01:53 +0200180 BOOTENV
Michal Simekb7b3efe2016-02-13 11:50:03 +0100181#endif
Siva Durga Prasad Paladuguc6024c82014-02-20 10:28:27 +0530182
Jagannadha Sutradharudu Teki36e0e192014-01-09 01:48:04 +0530183/* Miscellaneous configurable options */
Jagannadha Sutradharudu Teki36e0e192014-01-09 01:48:04 +0530184
Tom Rini65cc0e22022-11-16 13:10:41 -0500185#define CFG_SYS_INIT_RAM_ADDR 0xFFFF0000
186#define CFG_SYS_INIT_RAM_SIZE 0x2000
Jagannadha Sutradharudu Teki53e49f72014-01-09 01:48:06 +0530187
Jagannadha Sutradharudu Teki53e49f72014-01-09 01:48:06 +0530188
Michal Simekae9f4892014-01-20 11:29:06 +0100189/* Extend size of kernel image for uncompression */
Michal Simekae9f4892014-01-20 11:29:06 +0100190
Michal Simekd7e269c2014-01-14 14:21:52 +0100191/* Address in RAM where the parameters must be copied by SPL. */
Michal Simekd7e269c2014-01-14 14:21:52 +0100192
Michal Simekd7e269c2014-01-14 14:21:52 +0100193/* Not using MMC raw mode - just for compilation purpose */
Michal Simekd7e269c2014-01-14 14:21:52 +0100194
195/* qspi mode is working fine */
196#ifdef CONFIG_ZYNQ_QSPI
Tom Rini65cc0e22022-11-16 13:10:41 -0500197#define CFG_SYS_SPI_ARGS_OFFS 0x200000
198#define CFG_SYS_SPI_ARGS_SIZE 0x80000
199#define CFG_SYS_SPI_KERNEL_OFFS (CFG_SYS_SPI_ARGS_OFFS + \
200 CFG_SYS_SPI_ARGS_SIZE)
Michal Simekd7e269c2014-01-14 14:21:52 +0100201#endif
202
Michal Simekd7e269c2014-01-14 14:21:52 +0100203/* SP location before relocation, must use scratch RAM */
Michal Simekd7e269c2014-01-14 14:21:52 +0100204
205/* 3 * 64kB blocks of OCM - one is on the top because of bootrom */
Michal Simekd7e269c2014-01-14 14:21:52 +0100206
Michal Simekd7e269c2014-01-14 14:21:52 +0100207/* On the top of OCM space */
Michal Simekd7e269c2014-01-14 14:21:52 +0100208
Michal Simek83b64642015-11-23 16:27:38 +0100209/*
210 * SPL stack position - and stack goes down
211 * 0xfffffe00 is used for putting wfi loop.
212 * Set it up as limit for now.
213 */
Michal Simek83b64642015-11-23 16:27:38 +0100214
Jagannadha Sutradharudu Teki06fe8da2014-01-09 01:48:10 +0530215#endif /* __CONFIG_ZYNQ_COMMON_H */