Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Michal Simek | af482d5 | 2012-09-28 09:56:37 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2012 Michal Simek <monstr@monstr.eu> |
Michal Simek | 98d0f1f | 2018-01-17 07:37:47 +0100 | [diff] [blame] | 4 | * (C) Copyright 2013 - 2018 Xilinx, Inc. |
Jagannadha Sutradharudu Teki | 20ddda0 | 2014-01-09 01:48:10 +0530 | [diff] [blame] | 5 | * |
| 6 | * Common configuration options for all Zynq boards. |
Michal Simek | af482d5 | 2012-09-28 09:56:37 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
Jagannadha Sutradharudu Teki | 20ddda0 | 2014-01-09 01:48:10 +0530 | [diff] [blame] | 9 | #ifndef __CONFIG_ZYNQ_COMMON_H |
| 10 | #define __CONFIG_ZYNQ_COMMON_H |
Michal Simek | af482d5 | 2012-09-28 09:56:37 +0000 | [diff] [blame] | 11 | |
Jagannadha Sutradharudu Teki | fef608a | 2014-01-09 01:48:07 +0530 | [diff] [blame] | 12 | /* Cache options */ |
Jagannadha Sutradharudu Teki | fef608a | 2014-01-09 01:48:07 +0530 | [diff] [blame] | 13 | #ifndef CONFIG_SYS_L2CACHE_OFF |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 14 | # define CFG_SYS_PL310_BASE 0xf8f02000 |
Jagannadha Sutradharudu Teki | fef608a | 2014-01-09 01:48:07 +0530 | [diff] [blame] | 15 | #endif |
| 16 | |
Michal Simek | 40bcb86 | 2015-04-20 12:56:24 +0200 | [diff] [blame] | 17 | #define ZYNQ_SCUTIMER_BASEADDR 0xF8F00600 |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 18 | #define CFG_SYS_TIMERBASE ZYNQ_SCUTIMER_BASEADDR |
| 19 | #define CFG_SYS_TIMER_COUNTER (CFG_SYS_TIMERBASE + 0x4) |
Michal Simek | 40bcb86 | 2015-04-20 12:56:24 +0200 | [diff] [blame] | 20 | |
Sughosh Ganu | ccb3646 | 2022-04-15 11:29:34 +0530 | [diff] [blame] | 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) |
| 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 Teki | 4ecfc2f | 2014-01-09 01:48:06 +0530 | [diff] [blame] | 30 | /* Serial drivers */ |
Michal Simek | af482d5 | 2012-09-28 09:56:37 +0000 | [diff] [blame] | 31 | /* The following table includes the supported baudrates */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 32 | #define CFG_SYS_BAUDRATE_TABLE \ |
Michal Simek | af482d5 | 2012-09-28 09:56:37 +0000 | [diff] [blame] | 33 | {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400} |
| 34 | |
Michal Simek | af482d5 | 2012-09-28 09:56:37 +0000 | [diff] [blame] | 35 | /* Ethernet driver */ |
Michal Simek | af482d5 | 2012-09-28 09:56:37 +0000 | [diff] [blame] | 36 | |
Jagannadha Sutradharudu Teki | 03c0b86 | 2014-01-09 01:48:20 +0530 | [diff] [blame] | 37 | /* NOR */ |
Jagannadha Sutradharudu Teki | 03c0b86 | 2014-01-09 01:48:20 +0530 | [diff] [blame] | 38 | |
Siva Durga Prasad Paladugu | 42fcc18 | 2016-07-22 14:51:51 +0530 | [diff] [blame] | 39 | #ifdef CONFIG_USB_EHCI_ZYNQ |
Siva Durga Prasad Paladugu | e3b2474 | 2014-08-25 10:58:33 +0530 | [diff] [blame] | 40 | # define DFU_DEFAULT_POLL_TIMEOUT 300 |
Siva Durga Prasad Paladugu | e3b2474 | 2014-08-25 10:58:33 +0530 | [diff] [blame] | 41 | #endif |
| 42 | |
Michal Simek | b22ece1 | 2016-03-18 23:43:39 +0100 | [diff] [blame] | 43 | /* enable preboot to be loaded before CONFIG_BOOTDELAY */ |
Michal Simek | b22ece1 | 2016-03-18 23:43:39 +0100 | [diff] [blame] | 44 | |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 45 | /* Boot configuration */ |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 46 | |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 47 | #ifdef CONFIG_SPL_BUILD |
| 48 | #define BOOTENV |
| 49 | #else |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 50 | |
| 51 | #ifdef CONFIG_CMD_MMC |
Michal Simek | 9541d0b | 2019-09-11 12:51:49 +0200 | [diff] [blame] | 52 | #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 53 | #else |
| 54 | #define BOOT_TARGET_DEVICES_MMC(func) |
| 55 | #endif |
| 56 | |
| 57 | #ifdef CONFIG_CMD_USB |
Michal Simek | 786a7e0 | 2019-09-11 13:00:57 +0200 | [diff] [blame] | 58 | #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1) |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 59 | #else |
| 60 | #define BOOT_TARGET_DEVICES_USB(func) |
| 61 | #endif |
| 62 | |
Joe Hershberger | 8e8594f | 2018-04-13 15:26:40 -0500 | [diff] [blame] | 63 | #if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP) |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 64 | #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 Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 75 | #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 Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 93 | #define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \ |
| 94 | "bootcmd_qspi=sf probe 0 0 0 && " \ |
Michal Simek | 919469e | 2019-09-11 13:12:43 +0200 | [diff] [blame] | 95 | "sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \ |
Michal Simek | f964751 | 2020-04-20 09:17:53 +0200 | [diff] [blame] | 96 | "echo QSPI: Trying to boot script at ${scriptaddr} && " \ |
| 97 | "source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0" |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 98 | |
| 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 Simek | 919469e | 2019-09-11 13:12:43 +0200 | [diff] [blame] | 104 | "nand read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \ |
Michal Simek | f964751 | 2020-04-20 09:17:53 +0200 | [diff] [blame] | 105 | "echo NAND: Trying to boot script at ${scriptaddr} && " \ |
| 106 | "source ${scriptaddr}; echo NAND: SCRIPT FAILED: continuing...;\0" |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 107 | |
| 108 | #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \ |
| 109 | "nand " |
| 110 | |
| 111 | #define BOOTENV_DEV_NOR(devtypeu, devtypel, instance) \ |
Michal Simek | 24c606a7 | 2019-09-11 13:16:33 +0200 | [diff] [blame] | 112 | "script_offset_nor=0xE2FC0000\0" \ |
| 113 | "bootcmd_nor=cp.b ${script_offset_nor} ${scriptaddr} ${script_size_f} && " \ |
Michal Simek | f964751 | 2020-04-20 09:17:53 +0200 | [diff] [blame] | 114 | "echo NOR: Trying to boot script at ${scriptaddr} && " \ |
| 115 | "source ${scriptaddr}; echo NOR: SCRIPT FAILED: continuing...;\0" |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 116 | |
| 117 | #define BOOTENV_DEV_NAME_NOR(devtypeu, devtypel, instance) \ |
| 118 | "nor " |
| 119 | |
T Karthik Reddy | 6c28c29 | 2019-11-13 21:13:44 -0700 | [diff] [blame] | 120 | #define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na) |
| 121 | |
| 122 | #define BOOTENV_DEV_JTAG(devtypeu, devtypel, instance) \ |
Michal Simek | f964751 | 2020-04-20 09:17:53 +0200 | [diff] [blame] | 123 | "bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && " \ |
| 124 | "source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;\0" |
T Karthik Reddy | 6c28c29 | 2019-11-13 21:13:44 -0700 | [diff] [blame] | 125 | |
| 126 | #define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \ |
| 127 | "jtag " |
| 128 | |
T Karthik Reddy | 1908830 | 2021-03-30 23:24:58 -0600 | [diff] [blame] | 129 | #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 Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 157 | #define BOOT_TARGET_DEVICES(func) \ |
T Karthik Reddy | 6c28c29 | 2019-11-13 21:13:44 -0700 | [diff] [blame] | 158 | BOOT_TARGET_DEVICES_JTAG(func) \ |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 159 | BOOT_TARGET_DEVICES_MMC(func) \ |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 160 | BOOT_TARGET_DEVICES_QSPI(func) \ |
| 161 | BOOT_TARGET_DEVICES_NAND(func) \ |
| 162 | BOOT_TARGET_DEVICES_NOR(func) \ |
T Karthik Reddy | 1908830 | 2021-03-30 23:24:58 -0600 | [diff] [blame] | 163 | BOOT_TARGET_DEVICES_USB_DFU(func) \ |
| 164 | BOOT_TARGET_DEVICES_USB_THOR(func) \ |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 165 | BOOT_TARGET_DEVICES_USB(func) \ |
| 166 | BOOT_TARGET_DEVICES_PXE(func) \ |
Michal Simek | dfaaaf4 | 2019-09-10 15:01:53 +0200 | [diff] [blame] | 167 | BOOT_TARGET_DEVICES_DHCP(func) |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 168 | |
| 169 | #include <config_distro_bootcmd.h> |
| 170 | #endif /* CONFIG_SPL_BUILD */ |
| 171 | |
Jagannadha Sutradharudu Teki | a534a11 | 2014-01-09 01:48:22 +0530 | [diff] [blame] | 172 | /* Default environment */ |
Tom Rini | c9edebe | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 173 | #ifndef CFG_EXTRA_ENV_SETTINGS |
| 174 | #define CFG_EXTRA_ENV_SETTINGS \ |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 175 | "script_size_f=0x40000\0" \ |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 176 | "fdt_addr_r=0x1f00000\0" \ |
| 177 | "pxefile_addr_r=0x2000000\0" \ |
| 178 | "kernel_addr_r=0x2000000\0" \ |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 179 | "ramdisk_addr_r=0x3100000\0" \ |
Michal Simek | dfaaaf4 | 2019-09-10 15:01:53 +0200 | [diff] [blame] | 180 | BOOTENV |
Michal Simek | c6262ef | 2016-02-13 11:50:03 +0100 | [diff] [blame] | 181 | #endif |
Siva Durga Prasad Paladugu | 0ad27ca | 2014-02-20 10:28:27 +0530 | [diff] [blame] | 182 | |
Jagannadha Sutradharudu Teki | 4817a19 | 2014-01-09 01:48:04 +0530 | [diff] [blame] | 183 | /* Miscellaneous configurable options */ |
Jagannadha Sutradharudu Teki | 4817a19 | 2014-01-09 01:48:04 +0530 | [diff] [blame] | 184 | |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 185 | #define CFG_SYS_INIT_RAM_ADDR 0xFFFF0000 |
| 186 | #define CFG_SYS_INIT_RAM_SIZE 0x2000 |
Jagannadha Sutradharudu Teki | 4ecfc2f | 2014-01-09 01:48:06 +0530 | [diff] [blame] | 187 | |
Michal Simek | ec789f5 | 2014-01-20 11:29:06 +0100 | [diff] [blame] | 188 | /* Extend size of kernel image for uncompression */ |
Michal Simek | ec789f5 | 2014-01-20 11:29:06 +0100 | [diff] [blame] | 189 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 190 | /* Address in RAM where the parameters must be copied by SPL. */ |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 191 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 192 | /* Not using MMC raw mode - just for compilation purpose */ |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 193 | |
| 194 | /* qspi mode is working fine */ |
| 195 | #ifdef CONFIG_ZYNQ_QSPI |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 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) |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 200 | #endif |
| 201 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 202 | /* SP location before relocation, must use scratch RAM */ |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 203 | |
| 204 | /* 3 * 64kB blocks of OCM - one is on the top because of bootrom */ |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 205 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 206 | /* On the top of OCM space */ |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 207 | |
Michal Simek | 8f0af3f | 2015-11-23 16:27:38 +0100 | [diff] [blame] | 208 | /* |
| 209 | * SPL stack position - and stack goes down |
| 210 | * 0xfffffe00 is used for putting wfi loop. |
| 211 | * Set it up as limit for now. |
| 212 | */ |
Michal Simek | 8f0af3f | 2015-11-23 16:27:38 +0100 | [diff] [blame] | 213 | |
Jagannadha Sutradharudu Teki | 20ddda0 | 2014-01-09 01:48:10 +0530 | [diff] [blame] | 214 | #endif /* __CONFIG_ZYNQ_COMMON_H */ |