blob: 6574cf92e26ee1e5fa4c2465e4025952f1bae7bb [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
Jagannadha Sutradharudu Tekifef608a2014-01-09 01:48:07 +053014# define CONFIG_SYS_PL310_BASE 0xf8f02000
15#endif
16
Michal Simek40bcb862015-04-20 12:56:24 +020017#define ZYNQ_SCUTIMER_BASEADDR 0xF8F00600
18#define CONFIG_SYS_TIMERBASE ZYNQ_SCUTIMER_BASEADDR
19#define CONFIG_SYS_TIMER_COUNTS_DOWN
20#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMERBASE + 0x4)
21
Sughosh Ganuccb36462022-04-15 11:29:34 +053022/* GUIDs for capsule updatable firmware images */
23#define XILINX_BOOT_IMAGE_GUID \
24 EFI_GUID(0x1ba29a15, 0x9969, 0x40aa, 0xb4, 0x24, \
25 0xe8, 0x61, 0x21, 0x61, 0x86, 0x64)
26
27#define XILINX_UBOOT_IMAGE_GUID \
28 EFI_GUID(0x1a5178f0, 0x87d3, 0x4f36, 0xac, 0x63, \
29 0x3b, 0x31, 0xa2, 0x3b, 0xe3, 0x05)
30
Jagannadha Sutradharudu Teki4ecfc2f2014-01-09 01:48:06 +053031/* Serial drivers */
Michal Simekaf482d52012-09-28 09:56:37 +000032/* The following table includes the supported baudrates */
33#define CONFIG_SYS_BAUDRATE_TABLE \
34 {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
35
Michal Simekaf482d52012-09-28 09:56:37 +000036/* Ethernet driver */
Michal Simekaf482d52012-09-28 09:56:37 +000037
Jagannadha Sutradharudu Teki03c0b862014-01-09 01:48:20 +053038/* NOR */
Masahiro Yamada8cea9b52017-02-11 22:43:54 +090039#ifdef CONFIG_MTD_NOR_FLASH
Jagannadha Sutradharudu Teki03c0b862014-01-09 01:48:20 +053040# define CONFIG_FLASH_SHOW_PROGRESS 10
Jagannadha Sutradharudu Teki03c0b862014-01-09 01:48:20 +053041#endif
42
Siva Durga Prasad Paladugu42fcc182016-07-22 14:51:51 +053043#ifdef CONFIG_USB_EHCI_ZYNQ
Siva Durga Prasad Paladugue3b24742014-08-25 10:58:33 +053044# define DFU_DEFAULT_POLL_TIMEOUT 300
Michal Simek72cc9932016-04-07 18:55:11 +020045# define CONFIG_THOR_RESET_OFF
Siva Durga Prasad Paladugue3b24742014-08-25 10:58:33 +053046#endif
47
Michal Simekb22ece12016-03-18 23:43:39 +010048/* enable preboot to be loaded before CONFIG_BOOTDELAY */
Michal Simekb22ece12016-03-18 23:43:39 +010049
Alexander Graf605e5232017-07-03 13:41:35 +020050/* Boot configuration */
Alexander Graf605e5232017-07-03 13:41:35 +020051
Alexander Graf605e5232017-07-03 13:41:35 +020052#ifdef CONFIG_SPL_BUILD
53#define BOOTENV
54#else
Alexander Graf605e5232017-07-03 13:41:35 +020055
56#ifdef CONFIG_CMD_MMC
Michal Simek9541d0b2019-09-11 12:51:49 +020057#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
Alexander Graf605e5232017-07-03 13:41:35 +020058#else
59#define BOOT_TARGET_DEVICES_MMC(func)
60#endif
61
62#ifdef CONFIG_CMD_USB
Michal Simek786a7e02019-09-11 13:00:57 +020063#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1)
Alexander Graf605e5232017-07-03 13:41:35 +020064#else
65#define BOOT_TARGET_DEVICES_USB(func)
66#endif
67
Joe Hershberger8e8594f2018-04-13 15:26:40 -050068#if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP)
Alexander Graf605e5232017-07-03 13:41:35 +020069#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
70#else
71#define BOOT_TARGET_DEVICES_PXE(func)
72#endif
73
74#if defined(CONFIG_CMD_DHCP)
75#define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
76#else
77#define BOOT_TARGET_DEVICES_DHCP(func)
78#endif
79
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +053080#if defined(CONFIG_ZYNQ_QSPI)
81# define BOOT_TARGET_DEVICES_QSPI(func) func(QSPI, qspi, na)
82#else
83# define BOOT_TARGET_DEVICES_QSPI(func)
84#endif
85
86#if defined(CONFIG_NAND_ZYNQ)
87# define BOOT_TARGET_DEVICES_NAND(func) func(NAND, nand, na)
88#else
89# define BOOT_TARGET_DEVICES_NAND(func)
90#endif
91
92#if defined(CONFIG_MTD_NOR_FLASH)
93# define BOOT_TARGET_DEVICES_NOR(func) func(NOR, nor, na)
94#else
95# define BOOT_TARGET_DEVICES_NOR(func)
96#endif
97
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +053098#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
99 "bootcmd_qspi=sf probe 0 0 0 && " \
Michal Simek919469e2019-09-11 13:12:43 +0200100 "sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
Michal Simekf9647512020-04-20 09:17:53 +0200101 "echo QSPI: Trying to boot script at ${scriptaddr} && " \
102 "source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0"
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530103
104#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
105 "qspi "
106
107#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
108 "bootcmd_nand=nand info && " \
Michal Simek919469e2019-09-11 13:12:43 +0200109 "nand read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
Michal Simekf9647512020-04-20 09:17:53 +0200110 "echo NAND: Trying to boot script at ${scriptaddr} && " \
111 "source ${scriptaddr}; echo NAND: SCRIPT FAILED: continuing...;\0"
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530112
113#define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
114 "nand "
115
116#define BOOTENV_DEV_NOR(devtypeu, devtypel, instance) \
Michal Simek24c606a72019-09-11 13:16:33 +0200117 "script_offset_nor=0xE2FC0000\0" \
118 "bootcmd_nor=cp.b ${script_offset_nor} ${scriptaddr} ${script_size_f} && " \
Michal Simekf9647512020-04-20 09:17:53 +0200119 "echo NOR: Trying to boot script at ${scriptaddr} && " \
120 "source ${scriptaddr}; echo NOR: SCRIPT FAILED: continuing...;\0"
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530121
122#define BOOTENV_DEV_NAME_NOR(devtypeu, devtypel, instance) \
123 "nor "
124
T Karthik Reddy6c28c292019-11-13 21:13:44 -0700125#define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na)
126
127#define BOOTENV_DEV_JTAG(devtypeu, devtypel, instance) \
Michal Simekf9647512020-04-20 09:17:53 +0200128 "bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && " \
129 "source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;\0"
T Karthik Reddy6c28c292019-11-13 21:13:44 -0700130
131#define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \
132 "jtag "
133
T Karthik Reddy19088302021-03-30 23:24:58 -0600134#define BOOT_TARGET_DEVICES_USB_DFU(func) \
135 func(USB_DFU, usb_dfu, 0) func(USB_DFU, usb_dfu, 1)
136
137#define BOOTENV_DEV_USB_DFU(devtypeu, devtypel, instance) \
138 "bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \
139 "$scriptaddr $script_size_f && " \
140 "dfu " #instance " ram " #instance " 60 && " \
141 "echo DFU" #instance ": Trying to boot script at ${scriptaddr} && " \
142 "source ${scriptaddr}; " \
143 "echo DFU" #instance ": SCRIPT FAILED: continuing...;\0"
144
145#define BOOTENV_DEV_NAME_USB_DFU(devtypeu, devtypel, instance) \
146 ""
147
148#define BOOT_TARGET_DEVICES_USB_THOR(func) \
149 func(USB_THOR, usb_thor, 0) func(USB_THOR, usb_thor, 1)
150
151#define BOOTENV_DEV_USB_THOR(devtypeu, devtypel, instance) \
152 "bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \
153 "$scriptaddr $script_size_f && " \
154 "thordown " #instance " ram " #instance " && " \
155 "echo THOR" #instance ": Trying to boot script at ${scriptaddr} && " \
156 "source ${scriptaddr}; " \
157 "echo THOR" #instance ": SCRIPT FAILED: continuing...;\0"
158
159#define BOOTENV_DEV_NAME_USB_THOR(devtypeu, devtypel, instance) \
160 ""
161
Alexander Graf605e5232017-07-03 13:41:35 +0200162#define BOOT_TARGET_DEVICES(func) \
T Karthik Reddy6c28c292019-11-13 21:13:44 -0700163 BOOT_TARGET_DEVICES_JTAG(func) \
Alexander Graf605e5232017-07-03 13:41:35 +0200164 BOOT_TARGET_DEVICES_MMC(func) \
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530165 BOOT_TARGET_DEVICES_QSPI(func) \
166 BOOT_TARGET_DEVICES_NAND(func) \
167 BOOT_TARGET_DEVICES_NOR(func) \
T Karthik Reddy19088302021-03-30 23:24:58 -0600168 BOOT_TARGET_DEVICES_USB_DFU(func) \
169 BOOT_TARGET_DEVICES_USB_THOR(func) \
Alexander Graf605e5232017-07-03 13:41:35 +0200170 BOOT_TARGET_DEVICES_USB(func) \
171 BOOT_TARGET_DEVICES_PXE(func) \
Michal Simekdfaaaf42019-09-10 15:01:53 +0200172 BOOT_TARGET_DEVICES_DHCP(func)
Alexander Graf605e5232017-07-03 13:41:35 +0200173
174#include <config_distro_bootcmd.h>
175#endif /* CONFIG_SPL_BUILD */
176
Jagannadha Sutradharudu Tekia534a112014-01-09 01:48:22 +0530177/* Default environment */
Michal Simekc6262ef2016-02-13 11:50:03 +0100178#ifndef CONFIG_EXTRA_ENV_SETTINGS
Jagannadha Sutradharudu Tekia534a112014-01-09 01:48:22 +0530179#define CONFIG_EXTRA_ENV_SETTINGS \
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530180 "scriptaddr=0x20000\0" \
Siva Durga Prasad Paladugub4883f72019-01-25 17:06:05 +0530181 "script_size_f=0x40000\0" \
Alexander Graf605e5232017-07-03 13:41:35 +0200182 "fdt_addr_r=0x1f00000\0" \
183 "pxefile_addr_r=0x2000000\0" \
184 "kernel_addr_r=0x2000000\0" \
185 "scriptaddr=0x3000000\0" \
186 "ramdisk_addr_r=0x3100000\0" \
Michal Simekdfaaaf42019-09-10 15:01:53 +0200187 BOOTENV
Michal Simekc6262ef2016-02-13 11:50:03 +0100188#endif
Siva Durga Prasad Paladugu0ad27ca2014-02-20 10:28:27 +0530189
Jagannadha Sutradharudu Teki4817a192014-01-09 01:48:04 +0530190/* Miscellaneous configurable options */
Jagannadha Sutradharudu Teki4817a192014-01-09 01:48:04 +0530191
Michal Simek134244a2016-04-01 16:04:14 +0200192#define CONFIG_SYS_INIT_RAM_ADDR 0xFFFF0000
Siva Durga Prasad Paladugud74a59e2017-07-24 16:53:15 +0530193#define CONFIG_SYS_INIT_RAM_SIZE 0x2000
Jagannadha Sutradharudu Teki4ecfc2f2014-01-09 01:48:06 +0530194
Jagannadha Sutradharudu Teki4ecfc2f2014-01-09 01:48:06 +0530195
Michal Simekec789f52014-01-20 11:29:06 +0100196/* Extend size of kernel image for uncompression */
Michal Simekec789f52014-01-20 11:29:06 +0100197
Michal Simeke60148d2014-01-14 14:21:52 +0100198/* Address in RAM where the parameters must be copied by SPL. */
Michal Simeke60148d2014-01-14 14:21:52 +0100199
Michal Simeke60148d2014-01-14 14:21:52 +0100200/* Not using MMC raw mode - just for compilation purpose */
Michal Simeke60148d2014-01-14 14:21:52 +0100201
202/* qspi mode is working fine */
203#ifdef CONFIG_ZYNQ_QSPI
Siva Durga Prasad Paladugu40ea29b2015-09-14 12:59:08 +0530204#define CONFIG_SYS_SPI_ARGS_OFFS 0x200000
205#define CONFIG_SYS_SPI_ARGS_SIZE 0x80000
206#define CONFIG_SYS_SPI_KERNEL_OFFS (CONFIG_SYS_SPI_ARGS_OFFS + \
207 CONFIG_SYS_SPI_ARGS_SIZE)
Michal Simeke60148d2014-01-14 14:21:52 +0100208#endif
209
Michal Simeke60148d2014-01-14 14:21:52 +0100210/* SP location before relocation, must use scratch RAM */
Michal Simeke60148d2014-01-14 14:21:52 +0100211
212/* 3 * 64kB blocks of OCM - one is on the top because of bootrom */
Michal Simeke60148d2014-01-14 14:21:52 +0100213
Michal Simeke60148d2014-01-14 14:21:52 +0100214/* On the top of OCM space */
Michal Simeke60148d2014-01-14 14:21:52 +0100215
Michal Simek8f0af3f2015-11-23 16:27:38 +0100216/*
217 * SPL stack position - and stack goes down
218 * 0xfffffe00 is used for putting wfi loop.
219 * Set it up as limit for now.
220 */
Michal Simek8f0af3f2015-11-23 16:27:38 +0100221
Jagannadha Sutradharudu Teki20ddda02014-01-09 01:48:10 +0530222#endif /* __CONFIG_ZYNQ_COMMON_H */