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