blob: b8c142fed37b88f752cc45ce0fe6f767d965c9b4 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Michal Simekaf482d52012-09-28 09:56:37 +00002/*
3 * (C) Copyright 2012 Michal Simek <monstr@monstr.eu>
Michal Simek98d0f1f2018-01-17 07:37:47 +01004 * (C) Copyright 2013 - 2018 Xilinx, Inc.
Jagannadha Sutradharudu Teki20ddda02014-01-09 01:48:10 +05305 *
6 * Common configuration options for all Zynq boards.
Michal Simekaf482d52012-09-28 09:56:37 +00007 */
8
Jagannadha Sutradharudu Teki20ddda02014-01-09 01:48:10 +05309#ifndef __CONFIG_ZYNQ_COMMON_H
10#define __CONFIG_ZYNQ_COMMON_H
Michal Simekaf482d52012-09-28 09:56:37 +000011
Jagannadha Sutradharudu Tekifef608a2014-01-09 01:48:07 +053012/* Cache options */
Jagannadha Sutradharudu Tekifef608a2014-01-09 01:48:07 +053013#ifndef CONFIG_SYS_L2CACHE_OFF
Tom Rini6a5dccc2022-11-16 13:10:41 -050014# define CFG_SYS_PL310_BASE 0xf8f02000
Jagannadha Sutradharudu Tekifef608a2014-01-09 01:48:07 +053015#endif
16
Michal Simek40bcb862015-04-20 12:56:24 +020017#define ZYNQ_SCUTIMER_BASEADDR 0xF8F00600
Tom Rini6a5dccc2022-11-16 13:10:41 -050018#define CFG_SYS_TIMERBASE ZYNQ_SCUTIMER_BASEADDR
19#define CFG_SYS_TIMER_COUNTER (CFG_SYS_TIMERBASE + 0x4)
Michal Simek40bcb862015-04-20 12:56:24 +020020
Sughosh Ganuccb36462022-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 Teki4ecfc2f2014-01-09 01:48:06 +053030/* Serial drivers */
Michal Simekaf482d52012-09-28 09:56:37 +000031/* The following table includes the supported baudrates */
Tom Rini6a5dccc2022-11-16 13:10:41 -050032#define CFG_SYS_BAUDRATE_TABLE \
Michal Simekaf482d52012-09-28 09:56:37 +000033 {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
34
Michal Simekaf482d52012-09-28 09:56:37 +000035/* Ethernet driver */
Michal Simekaf482d52012-09-28 09:56:37 +000036
Jagannadha Sutradharudu Teki03c0b862014-01-09 01:48:20 +053037/* NOR */
Masahiro Yamada8cea9b52017-02-11 22:43:54 +090038#ifdef CONFIG_MTD_NOR_FLASH
Jagannadha Sutradharudu Teki03c0b862014-01-09 01:48:20 +053039# define CONFIG_FLASH_SHOW_PROGRESS 10
Jagannadha Sutradharudu Teki03c0b862014-01-09 01:48:20 +053040#endif
41
Siva Durga Prasad Paladugu42fcc182016-07-22 14:51:51 +053042#ifdef CONFIG_USB_EHCI_ZYNQ
Siva Durga Prasad Paladugue3b24742014-08-25 10:58:33 +053043# define DFU_DEFAULT_POLL_TIMEOUT 300
Michal Simek72cc9932016-04-07 18:55:11 +020044# define CONFIG_THOR_RESET_OFF
Siva Durga Prasad Paladugue3b24742014-08-25 10:58:33 +053045#endif
46
Michal Simekb22ece12016-03-18 23:43:39 +010047/* enable preboot to be loaded before CONFIG_BOOTDELAY */
Michal Simekb22ece12016-03-18 23:43:39 +010048
Alexander Graf605e5232017-07-03 13:41:35 +020049/* Boot configuration */
Alexander Graf605e5232017-07-03 13:41:35 +020050
Alexander Graf605e5232017-07-03 13:41:35 +020051#ifdef CONFIG_SPL_BUILD
52#define BOOTENV
53#else
Alexander Graf605e5232017-07-03 13:41:35 +020054
55#ifdef CONFIG_CMD_MMC
Michal Simek9541d0b2019-09-11 12:51:49 +020056#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
Alexander Graf605e5232017-07-03 13:41:35 +020057#else
58#define BOOT_TARGET_DEVICES_MMC(func)
59#endif
60
61#ifdef CONFIG_CMD_USB
Michal Simek786a7e02019-09-11 13:00:57 +020062#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1)
Alexander Graf605e5232017-07-03 13:41:35 +020063#else
64#define BOOT_TARGET_DEVICES_USB(func)
65#endif
66
Joe Hershberger8e8594f2018-04-13 15:26:40 -050067#if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP)
Alexander Graf605e5232017-07-03 13:41:35 +020068#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
69#else
70#define BOOT_TARGET_DEVICES_PXE(func)
71#endif
72
73#if defined(CONFIG_CMD_DHCP)
74#define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
75#else
76#define BOOT_TARGET_DEVICES_DHCP(func)
77#endif
78
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +053079#if defined(CONFIG_ZYNQ_QSPI)
80# define BOOT_TARGET_DEVICES_QSPI(func) func(QSPI, qspi, na)
81#else
82# define BOOT_TARGET_DEVICES_QSPI(func)
83#endif
84
85#if defined(CONFIG_NAND_ZYNQ)
86# define BOOT_TARGET_DEVICES_NAND(func) func(NAND, nand, na)
87#else
88# define BOOT_TARGET_DEVICES_NAND(func)
89#endif
90
91#if defined(CONFIG_MTD_NOR_FLASH)
92# define BOOT_TARGET_DEVICES_NOR(func) func(NOR, nor, na)
93#else
94# define BOOT_TARGET_DEVICES_NOR(func)
95#endif
96
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +053097#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
98 "bootcmd_qspi=sf probe 0 0 0 && " \
Michal Simek919469e2019-09-11 13:12:43 +020099 "sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
Michal Simekf9647512020-04-20 09:17:53 +0200100 "echo QSPI: Trying to boot script at ${scriptaddr} && " \
101 "source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0"
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530102
103#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
104 "qspi "
105
106#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
107 "bootcmd_nand=nand info && " \
Michal Simek919469e2019-09-11 13:12:43 +0200108 "nand read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
Michal Simekf9647512020-04-20 09:17:53 +0200109 "echo NAND: Trying to boot script at ${scriptaddr} && " \
110 "source ${scriptaddr}; echo NAND: SCRIPT FAILED: continuing...;\0"
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530111
112#define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
113 "nand "
114
115#define BOOTENV_DEV_NOR(devtypeu, devtypel, instance) \
Michal Simek24c606a72019-09-11 13:16:33 +0200116 "script_offset_nor=0xE2FC0000\0" \
117 "bootcmd_nor=cp.b ${script_offset_nor} ${scriptaddr} ${script_size_f} && " \
Michal Simekf9647512020-04-20 09:17:53 +0200118 "echo NOR: Trying to boot script at ${scriptaddr} && " \
119 "source ${scriptaddr}; echo NOR: SCRIPT FAILED: continuing...;\0"
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530120
121#define BOOTENV_DEV_NAME_NOR(devtypeu, devtypel, instance) \
122 "nor "
123
T Karthik Reddy6c28c292019-11-13 21:13:44 -0700124#define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na)
125
126#define BOOTENV_DEV_JTAG(devtypeu, devtypel, instance) \
Michal Simekf9647512020-04-20 09:17:53 +0200127 "bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && " \
128 "source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;\0"
T Karthik Reddy6c28c292019-11-13 21:13:44 -0700129
130#define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \
131 "jtag "
132
T Karthik Reddy19088302021-03-30 23:24:58 -0600133#define BOOT_TARGET_DEVICES_USB_DFU(func) \
134 func(USB_DFU, usb_dfu, 0) func(USB_DFU, usb_dfu, 1)
135
136#define BOOTENV_DEV_USB_DFU(devtypeu, devtypel, instance) \
137 "bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \
138 "$scriptaddr $script_size_f && " \
139 "dfu " #instance " ram " #instance " 60 && " \
140 "echo DFU" #instance ": Trying to boot script at ${scriptaddr} && " \
141 "source ${scriptaddr}; " \
142 "echo DFU" #instance ": SCRIPT FAILED: continuing...;\0"
143
144#define BOOTENV_DEV_NAME_USB_DFU(devtypeu, devtypel, instance) \
145 ""
146
147#define BOOT_TARGET_DEVICES_USB_THOR(func) \
148 func(USB_THOR, usb_thor, 0) func(USB_THOR, usb_thor, 1)
149
150#define BOOTENV_DEV_USB_THOR(devtypeu, devtypel, instance) \
151 "bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \
152 "$scriptaddr $script_size_f && " \
153 "thordown " #instance " ram " #instance " && " \
154 "echo THOR" #instance ": Trying to boot script at ${scriptaddr} && " \
155 "source ${scriptaddr}; " \
156 "echo THOR" #instance ": SCRIPT FAILED: continuing...;\0"
157
158#define BOOTENV_DEV_NAME_USB_THOR(devtypeu, devtypel, instance) \
159 ""
160
Alexander Graf605e5232017-07-03 13:41:35 +0200161#define BOOT_TARGET_DEVICES(func) \
T Karthik Reddy6c28c292019-11-13 21:13:44 -0700162 BOOT_TARGET_DEVICES_JTAG(func) \
Alexander Graf605e5232017-07-03 13:41:35 +0200163 BOOT_TARGET_DEVICES_MMC(func) \
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530164 BOOT_TARGET_DEVICES_QSPI(func) \
165 BOOT_TARGET_DEVICES_NAND(func) \
166 BOOT_TARGET_DEVICES_NOR(func) \
T Karthik Reddy19088302021-03-30 23:24:58 -0600167 BOOT_TARGET_DEVICES_USB_DFU(func) \
168 BOOT_TARGET_DEVICES_USB_THOR(func) \
Alexander Graf605e5232017-07-03 13:41:35 +0200169 BOOT_TARGET_DEVICES_USB(func) \
170 BOOT_TARGET_DEVICES_PXE(func) \
Michal Simekdfaaaf42019-09-10 15:01:53 +0200171 BOOT_TARGET_DEVICES_DHCP(func)
Alexander Graf605e5232017-07-03 13:41:35 +0200172
173#include <config_distro_bootcmd.h>
174#endif /* CONFIG_SPL_BUILD */
175
Jagannadha Sutradharudu Tekia534a112014-01-09 01:48:22 +0530176/* Default environment */
Michal Simekc6262ef2016-02-13 11:50:03 +0100177#ifndef CONFIG_EXTRA_ENV_SETTINGS
Jagannadha Sutradharudu Tekia534a112014-01-09 01:48:22 +0530178#define CONFIG_EXTRA_ENV_SETTINGS \
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530179 "scriptaddr=0x20000\0" \
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530180 "script_size_f=0x40000\0" \
Alexander Graf605e5232017-07-03 13:41:35 +0200181 "fdt_addr_r=0x1f00000\0" \
182 "pxefile_addr_r=0x2000000\0" \
183 "kernel_addr_r=0x2000000\0" \
184 "scriptaddr=0x3000000\0" \
185 "ramdisk_addr_r=0x3100000\0" \
Michal Simekdfaaaf42019-09-10 15:01:53 +0200186 BOOTENV
Michal Simekc6262ef2016-02-13 11:50:03 +0100187#endif
Siva Durga Prasad Paladugu0ad27ca2014-02-20 10:28:27 +0530188
Jagannadha Sutradharudu Teki4817a192014-01-09 01:48:04 +0530189/* Miscellaneous configurable options */
Jagannadha Sutradharudu Teki4817a192014-01-09 01:48:04 +0530190
Tom Rini6a5dccc2022-11-16 13:10:41 -0500191#define CFG_SYS_INIT_RAM_ADDR 0xFFFF0000
192#define CFG_SYS_INIT_RAM_SIZE 0x2000
Jagannadha Sutradharudu Teki4ecfc2f2014-01-09 01:48:06 +0530193
Jagannadha Sutradharudu Teki4ecfc2f2014-01-09 01:48:06 +0530194
Michal Simekec789f52014-01-20 11:29:06 +0100195/* Extend size of kernel image for uncompression */
Michal Simekec789f52014-01-20 11:29:06 +0100196
Michal Simeke60148d2014-01-14 14:21:52 +0100197/* Address in RAM where the parameters must be copied by SPL. */
Michal Simeke60148d2014-01-14 14:21:52 +0100198
Michal Simeke60148d2014-01-14 14:21:52 +0100199/* Not using MMC raw mode - just for compilation purpose */
Michal Simeke60148d2014-01-14 14:21:52 +0100200
201/* qspi mode is working fine */
202#ifdef CONFIG_ZYNQ_QSPI
Tom Rini6a5dccc2022-11-16 13:10:41 -0500203#define CFG_SYS_SPI_ARGS_OFFS 0x200000
204#define CFG_SYS_SPI_ARGS_SIZE 0x80000
205#define CFG_SYS_SPI_KERNEL_OFFS (CFG_SYS_SPI_ARGS_OFFS + \
206 CFG_SYS_SPI_ARGS_SIZE)
Michal Simeke60148d2014-01-14 14:21:52 +0100207#endif
208
Michal Simeke60148d2014-01-14 14:21:52 +0100209/* SP location before relocation, must use scratch RAM */
Michal Simeke60148d2014-01-14 14:21:52 +0100210
211/* 3 * 64kB blocks of OCM - one is on the top because of bootrom */
Michal Simeke60148d2014-01-14 14:21:52 +0100212
Michal Simeke60148d2014-01-14 14:21:52 +0100213/* On the top of OCM space */
Michal Simeke60148d2014-01-14 14:21:52 +0100214
Michal Simek8f0af3f2015-11-23 16:27:38 +0100215/*
216 * SPL stack position - and stack goes down
217 * 0xfffffe00 is used for putting wfi loop.
218 * Set it up as limit for now.
219 */
Michal Simek8f0af3f2015-11-23 16:27:38 +0100220
Jagannadha Sutradharudu Teki20ddda02014-01-09 01:48:10 +0530221#endif /* __CONFIG_ZYNQ_COMMON_H */