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 */ |
Masahiro Yamada | 8cea9b5 | 2017-02-11 22:43:54 +0900 | [diff] [blame] | 38 | #ifdef CONFIG_MTD_NOR_FLASH |
Jagannadha Sutradharudu Teki | 03c0b86 | 2014-01-09 01:48:20 +0530 | [diff] [blame] | 39 | # define CONFIG_FLASH_SHOW_PROGRESS 10 |
Jagannadha Sutradharudu Teki | 03c0b86 | 2014-01-09 01:48:20 +0530 | [diff] [blame] | 40 | #endif |
| 41 | |
Siva Durga Prasad Paladugu | 42fcc18 | 2016-07-22 14:51:51 +0530 | [diff] [blame] | 42 | #ifdef CONFIG_USB_EHCI_ZYNQ |
Siva Durga Prasad Paladugu | e3b2474 | 2014-08-25 10:58:33 +0530 | [diff] [blame] | 43 | # define DFU_DEFAULT_POLL_TIMEOUT 300 |
Michal Simek | 72cc993 | 2016-04-07 18:55:11 +0200 | [diff] [blame] | 44 | # define CONFIG_THOR_RESET_OFF |
Siva Durga Prasad Paladugu | e3b2474 | 2014-08-25 10:58:33 +0530 | [diff] [blame] | 45 | #endif |
| 46 | |
Michal Simek | b22ece1 | 2016-03-18 23:43:39 +0100 | [diff] [blame] | 47 | /* enable preboot to be loaded before CONFIG_BOOTDELAY */ |
Michal Simek | b22ece1 | 2016-03-18 23:43:39 +0100 | [diff] [blame] | 48 | |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 49 | /* Boot configuration */ |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 50 | |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 51 | #ifdef CONFIG_SPL_BUILD |
| 52 | #define BOOTENV |
| 53 | #else |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 54 | |
| 55 | #ifdef CONFIG_CMD_MMC |
Michal Simek | 9541d0b | 2019-09-11 12:51:49 +0200 | [diff] [blame] | 56 | #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] | 57 | #else |
| 58 | #define BOOT_TARGET_DEVICES_MMC(func) |
| 59 | #endif |
| 60 | |
| 61 | #ifdef CONFIG_CMD_USB |
Michal Simek | 786a7e0 | 2019-09-11 13:00:57 +0200 | [diff] [blame] | 62 | #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] | 63 | #else |
| 64 | #define BOOT_TARGET_DEVICES_USB(func) |
| 65 | #endif |
| 66 | |
Joe Hershberger | 8e8594f | 2018-04-13 15:26:40 -0500 | [diff] [blame] | 67 | #if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP) |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 68 | #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 Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 79 | #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 Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 97 | #define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \ |
| 98 | "bootcmd_qspi=sf probe 0 0 0 && " \ |
Michal Simek | 919469e | 2019-09-11 13:12:43 +0200 | [diff] [blame] | 99 | "sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \ |
Michal Simek | f964751 | 2020-04-20 09:17:53 +0200 | [diff] [blame] | 100 | "echo QSPI: Trying to boot script at ${scriptaddr} && " \ |
| 101 | "source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0" |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 102 | |
| 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 Simek | 919469e | 2019-09-11 13:12:43 +0200 | [diff] [blame] | 108 | "nand read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \ |
Michal Simek | f964751 | 2020-04-20 09:17:53 +0200 | [diff] [blame] | 109 | "echo NAND: Trying to boot script at ${scriptaddr} && " \ |
| 110 | "source ${scriptaddr}; echo NAND: SCRIPT FAILED: continuing...;\0" |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 111 | |
| 112 | #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \ |
| 113 | "nand " |
| 114 | |
| 115 | #define BOOTENV_DEV_NOR(devtypeu, devtypel, instance) \ |
Michal Simek | 24c606a7 | 2019-09-11 13:16:33 +0200 | [diff] [blame] | 116 | "script_offset_nor=0xE2FC0000\0" \ |
| 117 | "bootcmd_nor=cp.b ${script_offset_nor} ${scriptaddr} ${script_size_f} && " \ |
Michal Simek | f964751 | 2020-04-20 09:17:53 +0200 | [diff] [blame] | 118 | "echo NOR: Trying to boot script at ${scriptaddr} && " \ |
| 119 | "source ${scriptaddr}; echo NOR: SCRIPT FAILED: continuing...;\0" |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 120 | |
| 121 | #define BOOTENV_DEV_NAME_NOR(devtypeu, devtypel, instance) \ |
| 122 | "nor " |
| 123 | |
T Karthik Reddy | 6c28c29 | 2019-11-13 21:13:44 -0700 | [diff] [blame] | 124 | #define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na) |
| 125 | |
| 126 | #define BOOTENV_DEV_JTAG(devtypeu, devtypel, instance) \ |
Michal Simek | f964751 | 2020-04-20 09:17:53 +0200 | [diff] [blame] | 127 | "bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && " \ |
| 128 | "source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;\0" |
T Karthik Reddy | 6c28c29 | 2019-11-13 21:13:44 -0700 | [diff] [blame] | 129 | |
| 130 | #define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \ |
| 131 | "jtag " |
| 132 | |
T Karthik Reddy | 1908830 | 2021-03-30 23:24:58 -0600 | [diff] [blame] | 133 | #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 Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 161 | #define BOOT_TARGET_DEVICES(func) \ |
T Karthik Reddy | 6c28c29 | 2019-11-13 21:13:44 -0700 | [diff] [blame] | 162 | BOOT_TARGET_DEVICES_JTAG(func) \ |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 163 | BOOT_TARGET_DEVICES_MMC(func) \ |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 164 | BOOT_TARGET_DEVICES_QSPI(func) \ |
| 165 | BOOT_TARGET_DEVICES_NAND(func) \ |
| 166 | BOOT_TARGET_DEVICES_NOR(func) \ |
T Karthik Reddy | 1908830 | 2021-03-30 23:24:58 -0600 | [diff] [blame] | 167 | BOOT_TARGET_DEVICES_USB_DFU(func) \ |
| 168 | BOOT_TARGET_DEVICES_USB_THOR(func) \ |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 169 | BOOT_TARGET_DEVICES_USB(func) \ |
| 170 | BOOT_TARGET_DEVICES_PXE(func) \ |
Michal Simek | dfaaaf4 | 2019-09-10 15:01:53 +0200 | [diff] [blame] | 171 | BOOT_TARGET_DEVICES_DHCP(func) |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 172 | |
| 173 | #include <config_distro_bootcmd.h> |
| 174 | #endif /* CONFIG_SPL_BUILD */ |
| 175 | |
Jagannadha Sutradharudu Teki | a534a11 | 2014-01-09 01:48:22 +0530 | [diff] [blame] | 176 | /* Default environment */ |
Michal Simek | c6262ef | 2016-02-13 11:50:03 +0100 | [diff] [blame] | 177 | #ifndef CONFIG_EXTRA_ENV_SETTINGS |
Jagannadha Sutradharudu Teki | a534a11 | 2014-01-09 01:48:22 +0530 | [diff] [blame] | 178 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 179 | "scriptaddr=0x20000\0" \ |
Siva Durga Prasad Paladugu | b4883f7 | 2019-01-25 17:06:05 +0530 | [diff] [blame] | 180 | "script_size_f=0x40000\0" \ |
Alexander Graf | 605e523 | 2017-07-03 13:41:35 +0200 | [diff] [blame] | 181 | "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 Simek | dfaaaf4 | 2019-09-10 15:01:53 +0200 | [diff] [blame] | 186 | BOOTENV |
Michal Simek | c6262ef | 2016-02-13 11:50:03 +0100 | [diff] [blame] | 187 | #endif |
Siva Durga Prasad Paladugu | 0ad27ca | 2014-02-20 10:28:27 +0530 | [diff] [blame] | 188 | |
Jagannadha Sutradharudu Teki | 4817a19 | 2014-01-09 01:48:04 +0530 | [diff] [blame] | 189 | /* Miscellaneous configurable options */ |
Jagannadha Sutradharudu Teki | 4817a19 | 2014-01-09 01:48:04 +0530 | [diff] [blame] | 190 | |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame^] | 191 | #define CFG_SYS_INIT_RAM_ADDR 0xFFFF0000 |
| 192 | #define CFG_SYS_INIT_RAM_SIZE 0x2000 |
Jagannadha Sutradharudu Teki | 4ecfc2f | 2014-01-09 01:48:06 +0530 | [diff] [blame] | 193 | |
Jagannadha Sutradharudu Teki | 4ecfc2f | 2014-01-09 01:48:06 +0530 | [diff] [blame] | 194 | |
Michal Simek | ec789f5 | 2014-01-20 11:29:06 +0100 | [diff] [blame] | 195 | /* Extend size of kernel image for uncompression */ |
Michal Simek | ec789f5 | 2014-01-20 11:29:06 +0100 | [diff] [blame] | 196 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 197 | /* Address in RAM where the parameters must be copied by SPL. */ |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 198 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 199 | /* Not using MMC raw mode - just for compilation purpose */ |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 200 | |
| 201 | /* qspi mode is working fine */ |
| 202 | #ifdef CONFIG_ZYNQ_QSPI |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame^] | 203 | #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 Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 207 | #endif |
| 208 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 209 | /* SP location before relocation, must use scratch RAM */ |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 210 | |
| 211 | /* 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] | 212 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 213 | /* On the top of OCM space */ |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 214 | |
Michal Simek | 8f0af3f | 2015-11-23 16:27:38 +0100 | [diff] [blame] | 215 | /* |
| 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 Simek | 8f0af3f | 2015-11-23 16:27:38 +0100 | [diff] [blame] | 220 | |
Jagannadha Sutradharudu Teki | 20ddda0 | 2014-01-09 01:48:10 +0530 | [diff] [blame] | 221 | #endif /* __CONFIG_ZYNQ_COMMON_H */ |