Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2014 - 2015 Xilinx, Inc. |
| 4 | * Michal Simek <michal.simek@xilinx.com> |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Simon Glass | 62270f4 | 2019-11-14 12:57:35 -0700 | [diff] [blame^] | 8 | #include <cpu_func.h> |
Simon Glass | 9fb625c | 2019-08-01 09:46:51 -0600 | [diff] [blame] | 9 | #include <env.h> |
Michal Simek | 679b994 | 2015-09-30 17:26:55 +0200 | [diff] [blame] | 10 | #include <sata.h> |
Michal Simek | 6fe6f13 | 2015-07-23 13:27:40 +0200 | [diff] [blame] | 11 | #include <ahci.h> |
| 12 | #include <scsi.h> |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 13 | #include <malloc.h> |
Michal Simek | 4490e01 | 2018-04-19 15:43:38 +0200 | [diff] [blame] | 14 | #include <wdt.h> |
Michal Simek | 0785dfd | 2015-11-05 08:34:35 +0100 | [diff] [blame] | 15 | #include <asm/arch/clk.h> |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 16 | #include <asm/arch/hardware.h> |
| 17 | #include <asm/arch/sys_proto.h> |
Michal Simek | 2ad341e | 2018-01-10 09:36:09 +0100 | [diff] [blame] | 18 | #include <asm/arch/psu_init_gpl.h> |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 19 | #include <asm/io.h> |
Michal Simek | 2882b39 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 20 | #include <dm/device.h> |
Michal Simek | 4490e01 | 2018-04-19 15:43:38 +0200 | [diff] [blame] | 21 | #include <dm/uclass.h> |
Siva Durga Prasad Paladugu | 16fa00a | 2015-08-04 13:03:26 +0530 | [diff] [blame] | 22 | #include <usb.h> |
| 23 | #include <dwc3-uboot.h> |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 24 | #include <zynqmppl.h> |
Ibai Erkiaga | 009ab7b | 2019-09-27 11:37:01 +0100 | [diff] [blame] | 25 | #include <zynqmp_firmware.h> |
Michal Simek | 9feff38 | 2016-09-01 11:16:40 +0200 | [diff] [blame] | 26 | #include <g_dnl.h> |
T Karthik Reddy | a69814c | 2019-08-20 09:30:57 +0530 | [diff] [blame] | 27 | #include <linux/sizes.h> |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 28 | |
Luca Ceresoli | c28a9cf | 2019-05-21 18:06:43 +0200 | [diff] [blame] | 29 | #include "pm_cfg_obj.h" |
| 30 | |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 31 | DECLARE_GLOBAL_DATA_PTR; |
| 32 | |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 33 | #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \ |
| 34 | !defined(CONFIG_SPL_BUILD) |
| 35 | static xilinx_desc zynqmppl = XILINX_ZYNQMP_DESC; |
| 36 | |
| 37 | static const struct { |
Michal Simek | 8ebdf9e | 2017-11-06 12:55:59 +0100 | [diff] [blame] | 38 | u32 id; |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 39 | u32 ver; |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 40 | char *name; |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 41 | bool evexists; |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 42 | } zynqmp_devices[] = { |
| 43 | { |
| 44 | .id = 0x10, |
| 45 | .name = "3eg", |
| 46 | }, |
| 47 | { |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 48 | .id = 0x10, |
| 49 | .ver = 0x2c, |
| 50 | .name = "3cg", |
| 51 | }, |
| 52 | { |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 53 | .id = 0x11, |
| 54 | .name = "2eg", |
| 55 | }, |
| 56 | { |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 57 | .id = 0x11, |
| 58 | .ver = 0x2c, |
| 59 | .name = "2cg", |
| 60 | }, |
| 61 | { |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 62 | .id = 0x20, |
| 63 | .name = "5ev", |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 64 | .evexists = 1, |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 65 | }, |
| 66 | { |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 67 | .id = 0x20, |
| 68 | .ver = 0x100, |
| 69 | .name = "5eg", |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 70 | .evexists = 1, |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 71 | }, |
| 72 | { |
| 73 | .id = 0x20, |
| 74 | .ver = 0x12c, |
| 75 | .name = "5cg", |
Siva Durga Prasad Paladugu | 5473f24 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 76 | .evexists = 1, |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 77 | }, |
| 78 | { |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 79 | .id = 0x21, |
| 80 | .name = "4ev", |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 81 | .evexists = 1, |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 82 | }, |
| 83 | { |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 84 | .id = 0x21, |
| 85 | .ver = 0x100, |
| 86 | .name = "4eg", |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 87 | .evexists = 1, |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 88 | }, |
| 89 | { |
| 90 | .id = 0x21, |
| 91 | .ver = 0x12c, |
| 92 | .name = "4cg", |
Siva Durga Prasad Paladugu | 5473f24 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 93 | .evexists = 1, |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 94 | }, |
| 95 | { |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 96 | .id = 0x30, |
| 97 | .name = "7ev", |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 98 | .evexists = 1, |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 99 | }, |
| 100 | { |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 101 | .id = 0x30, |
| 102 | .ver = 0x100, |
| 103 | .name = "7eg", |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 104 | .evexists = 1, |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 105 | }, |
| 106 | { |
| 107 | .id = 0x30, |
| 108 | .ver = 0x12c, |
| 109 | .name = "7cg", |
Siva Durga Prasad Paladugu | 5473f24 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 110 | .evexists = 1, |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 111 | }, |
| 112 | { |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 113 | .id = 0x38, |
| 114 | .name = "9eg", |
| 115 | }, |
| 116 | { |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 117 | .id = 0x38, |
| 118 | .ver = 0x2c, |
| 119 | .name = "9cg", |
| 120 | }, |
| 121 | { |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 122 | .id = 0x39, |
| 123 | .name = "6eg", |
| 124 | }, |
| 125 | { |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 126 | .id = 0x39, |
| 127 | .ver = 0x2c, |
| 128 | .name = "6cg", |
| 129 | }, |
| 130 | { |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 131 | .id = 0x40, |
| 132 | .name = "11eg", |
| 133 | }, |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 134 | { /* For testing purpose only */ |
| 135 | .id = 0x50, |
| 136 | .ver = 0x2c, |
| 137 | .name = "15cg", |
| 138 | }, |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 139 | { |
| 140 | .id = 0x50, |
| 141 | .name = "15eg", |
| 142 | }, |
| 143 | { |
| 144 | .id = 0x58, |
| 145 | .name = "19eg", |
| 146 | }, |
| 147 | { |
| 148 | .id = 0x59, |
| 149 | .name = "17eg", |
| 150 | }, |
Michal Simek | b030fed | 2017-06-02 08:08:59 +0200 | [diff] [blame] | 151 | { |
| 152 | .id = 0x61, |
| 153 | .name = "21dr", |
| 154 | }, |
| 155 | { |
| 156 | .id = 0x63, |
| 157 | .name = "23dr", |
| 158 | }, |
| 159 | { |
| 160 | .id = 0x65, |
| 161 | .name = "25dr", |
| 162 | }, |
| 163 | { |
| 164 | .id = 0x64, |
| 165 | .name = "27dr", |
| 166 | }, |
| 167 | { |
| 168 | .id = 0x60, |
| 169 | .name = "28dr", |
| 170 | }, |
| 171 | { |
| 172 | .id = 0x62, |
| 173 | .name = "29dr", |
| 174 | }, |
Siva Durga Prasad Paladugu | c749090 | 2019-03-23 15:00:06 +0530 | [diff] [blame] | 175 | { |
| 176 | .id = 0x66, |
| 177 | .name = "39dr", |
| 178 | }, |
Siva Durga Prasad Paladugu | 134b0c8 | 2019-07-23 11:56:17 +0530 | [diff] [blame] | 179 | { |
| 180 | .id = 0x7b, |
| 181 | .name = "48dr", |
| 182 | }, |
| 183 | { |
| 184 | .id = 0x7e, |
| 185 | .name = "49dr", |
| 186 | }, |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 187 | }; |
Siva Durga Prasad Paladugu | 74ba69d | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 188 | #endif |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 189 | |
Siva Durga Prasad Paladugu | f52bf5a | 2017-07-25 11:51:38 +0530 | [diff] [blame] | 190 | int chip_id(unsigned char id) |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 191 | { |
| 192 | struct pt_regs regs; |
Siva Durga Prasad Paladugu | db3123b | 2017-07-25 11:51:36 +0530 | [diff] [blame] | 193 | int val = -EINVAL; |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 194 | |
Siva Durga Prasad Paladugu | 74ba69d | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 195 | if (current_el() != 3) { |
| 196 | regs.regs[0] = ZYNQMP_SIP_SVC_CSU_DMA_CHIPID; |
| 197 | regs.regs[1] = 0; |
| 198 | regs.regs[2] = 0; |
| 199 | regs.regs[3] = 0; |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 200 | |
Siva Durga Prasad Paladugu | 74ba69d | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 201 | smc_call(®s); |
| 202 | |
| 203 | /* |
| 204 | * SMC returns: |
| 205 | * regs[0][31:0] = status of the operation |
| 206 | * regs[0][63:32] = CSU.IDCODE register |
| 207 | * regs[1][31:0] = CSU.version register |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 208 | * regs[1][63:32] = CSU.IDCODE2 register |
Siva Durga Prasad Paladugu | 74ba69d | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 209 | */ |
| 210 | switch (id) { |
| 211 | case IDCODE: |
| 212 | regs.regs[0] = upper_32_bits(regs.regs[0]); |
| 213 | regs.regs[0] &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | |
| 214 | ZYNQMP_CSU_IDCODE_SVD_MASK; |
| 215 | regs.regs[0] >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; |
| 216 | val = regs.regs[0]; |
| 217 | break; |
| 218 | case VERSION: |
| 219 | regs.regs[1] = lower_32_bits(regs.regs[1]); |
| 220 | regs.regs[1] &= ZYNQMP_CSU_SILICON_VER_MASK; |
| 221 | val = regs.regs[1]; |
| 222 | break; |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 223 | case IDCODE2: |
| 224 | regs.regs[1] = lower_32_bits(regs.regs[1]); |
| 225 | regs.regs[1] >>= ZYNQMP_CSU_VERSION_EMPTY_SHIFT; |
| 226 | val = regs.regs[1]; |
| 227 | break; |
Siva Durga Prasad Paladugu | 74ba69d | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 228 | default: |
| 229 | printf("%s, Invalid Req:0x%x\n", __func__, id); |
| 230 | } |
| 231 | } else { |
| 232 | switch (id) { |
| 233 | case IDCODE: |
| 234 | val = readl(ZYNQMP_CSU_IDCODE_ADDR); |
| 235 | val &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | |
| 236 | ZYNQMP_CSU_IDCODE_SVD_MASK; |
| 237 | val >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; |
| 238 | break; |
| 239 | case VERSION: |
| 240 | val = readl(ZYNQMP_CSU_VER_ADDR); |
| 241 | val &= ZYNQMP_CSU_SILICON_VER_MASK; |
| 242 | break; |
| 243 | default: |
| 244 | printf("%s, Invalid Req:0x%x\n", __func__, id); |
| 245 | } |
Siva Durga Prasad Paladugu | db3123b | 2017-07-25 11:51:36 +0530 | [diff] [blame] | 246 | } |
Soren Brinkmann | 0cba6ab | 2016-09-29 11:44:41 -0700 | [diff] [blame] | 247 | |
Siva Durga Prasad Paladugu | db3123b | 2017-07-25 11:51:36 +0530 | [diff] [blame] | 248 | return val; |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 249 | } |
| 250 | |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 251 | #define ZYNQMP_VERSION_SIZE 9 |
| 252 | #define ZYNQMP_PL_STATUS_BIT 9 |
Siva Durga Prasad Paladugu | 5473f24 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 253 | #define ZYNQMP_IPDIS_VCU_BIT 8 |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 254 | #define ZYNQMP_PL_STATUS_MASK BIT(ZYNQMP_PL_STATUS_BIT) |
| 255 | #define ZYNQMP_CSU_VERSION_MASK ~(ZYNQMP_PL_STATUS_MASK) |
Siva Durga Prasad Paladugu | 5473f24 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 256 | #define ZYNQMP_CSU_VCUDIS_VER_MASK ZYNQMP_CSU_VERSION_MASK & \ |
| 257 | ~BIT(ZYNQMP_IPDIS_VCU_BIT) |
| 258 | #define MAX_VARIANTS_EV 3 |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 259 | |
Siva Durga Prasad Paladugu | 74ba69d | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 260 | #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \ |
| 261 | !defined(CONFIG_SPL_BUILD) |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 262 | static char *zynqmp_get_silicon_idcode_name(void) |
| 263 | { |
Siva Durga Prasad Paladugu | 5473f24 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 264 | u32 i, id, ver, j; |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 265 | char *buf; |
| 266 | static char name[ZYNQMP_VERSION_SIZE]; |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 267 | |
Siva Durga Prasad Paladugu | db3123b | 2017-07-25 11:51:36 +0530 | [diff] [blame] | 268 | id = chip_id(IDCODE); |
Michal Simek | 494fffe | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 269 | ver = chip_id(IDCODE2); |
| 270 | |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 271 | for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) { |
Siva Durga Prasad Paladugu | 5473f24 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 272 | if (zynqmp_devices[i].id == id) { |
| 273 | if (zynqmp_devices[i].evexists && |
| 274 | !(ver & ZYNQMP_PL_STATUS_MASK)) |
| 275 | break; |
| 276 | if (zynqmp_devices[i].ver == (ver & |
| 277 | ZYNQMP_CSU_VERSION_MASK)) |
| 278 | break; |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 279 | } |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 280 | } |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 281 | |
| 282 | if (i >= ARRAY_SIZE(zynqmp_devices)) |
| 283 | return "unknown"; |
| 284 | |
Siva Durga Prasad Paladugu | 5473f24 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 285 | strncat(name, "zu", 2); |
| 286 | if (!zynqmp_devices[i].evexists || |
| 287 | (ver & ZYNQMP_PL_STATUS_MASK)) { |
| 288 | strncat(name, zynqmp_devices[i].name, |
| 289 | ZYNQMP_VERSION_SIZE - 3); |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 290 | return name; |
Siva Durga Prasad Paladugu | 5473f24 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 291 | } |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 292 | |
Siva Durga Prasad Paladugu | 5473f24 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 293 | /* |
| 294 | * Here we are means, PL not powered up and ev variant |
| 295 | * exists. So, we need to ignore VCU disable bit(8) in |
| 296 | * version and findout if its CG or EG/EV variant. |
| 297 | */ |
| 298 | for (j = 0; j < MAX_VARIANTS_EV; j++, i++) { |
| 299 | if ((zynqmp_devices[i].ver & ~BIT(ZYNQMP_IPDIS_VCU_BIT)) == |
| 300 | (ver & ZYNQMP_CSU_VCUDIS_VER_MASK)) { |
| 301 | strncat(name, zynqmp_devices[i].name, |
| 302 | ZYNQMP_VERSION_SIZE - 3); |
| 303 | break; |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | if (j >= MAX_VARIANTS_EV) |
| 308 | return "unknown"; |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 309 | |
| 310 | if (strstr(name, "eg") || strstr(name, "ev")) { |
| 311 | buf = strstr(name, "e"); |
| 312 | *buf = '\0'; |
| 313 | } |
| 314 | |
| 315 | return name; |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 316 | } |
| 317 | #endif |
| 318 | |
Michal Simek | fb4000e | 2017-02-07 14:32:26 +0100 | [diff] [blame] | 319 | int board_early_init_f(void) |
| 320 | { |
Michal Simek | f32e79f | 2018-01-10 11:48:48 +0100 | [diff] [blame] | 321 | int ret = 0; |
Michal Simek | 55de092 | 2017-07-12 13:08:41 +0200 | [diff] [blame] | 322 | |
Michal Simek | 88f05a9 | 2018-01-15 12:52:59 +0100 | [diff] [blame] | 323 | #if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED) |
Michal Simek | f32e79f | 2018-01-10 11:48:48 +0100 | [diff] [blame] | 324 | ret = psu_init(); |
Michal Simek | 55de092 | 2017-07-12 13:08:41 +0200 | [diff] [blame] | 325 | #endif |
| 326 | |
Michal Simek | f32e79f | 2018-01-10 11:48:48 +0100 | [diff] [blame] | 327 | return ret; |
Michal Simek | fb4000e | 2017-02-07 14:32:26 +0100 | [diff] [blame] | 328 | } |
| 329 | |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 330 | int board_init(void) |
| 331 | { |
Ibai Erkiaga | 325a22d | 2019-09-27 11:37:04 +0100 | [diff] [blame] | 332 | struct udevice *dev; |
| 333 | |
| 334 | uclass_get_device_by_name(UCLASS_FIRMWARE, "zynqmp-power", &dev); |
| 335 | if (!dev) |
| 336 | panic("PMU Firmware device not found - Enable it"); |
| 337 | |
Luca Ceresoli | c28a9cf | 2019-05-21 18:06:43 +0200 | [diff] [blame] | 338 | #if defined(CONFIG_SPL_BUILD) |
| 339 | /* Check *at build time* if the filename is an non-empty string */ |
| 340 | if (sizeof(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE) > 1) |
| 341 | zynqmp_pmufw_load_config_object(zynqmp_pm_cfg_obj, |
| 342 | zynqmp_pm_cfg_obj_size); |
| 343 | #endif |
| 344 | |
Michal Simek | a0736ef | 2015-06-22 14:31:06 +0200 | [diff] [blame] | 345 | printf("EL Level:\tEL%d\n", current_el()); |
| 346 | |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 347 | #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \ |
| 348 | !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_FPGA_SUPPORT) && \ |
| 349 | defined(CONFIG_SPL_BUILD)) |
| 350 | if (current_el() != 3) { |
Siva Durga Prasad Paladugu | 83bf2ff | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 351 | zynqmppl.name = zynqmp_get_silicon_idcode_name(); |
Michal Simek | 47e60cb | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 352 | printf("Chip ID:\t%s\n", zynqmppl.name); |
| 353 | fpga_init(); |
| 354 | fpga_add(fpga_xilinx, &zynqmppl); |
| 355 | } |
| 356 | #endif |
| 357 | |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 358 | return 0; |
| 359 | } |
| 360 | |
| 361 | int board_early_init_r(void) |
| 362 | { |
| 363 | u32 val; |
| 364 | |
Siva Durga Prasad Paladugu | ec60a27 | 2017-12-07 15:05:30 +0530 | [diff] [blame] | 365 | if (current_el() != 3) |
| 366 | return 0; |
| 367 | |
Michal Simek | 90a35db | 2017-07-12 10:32:18 +0200 | [diff] [blame] | 368 | val = readl(&crlapb_base->timestamp_ref_ctrl); |
| 369 | val &= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT; |
| 370 | |
Siva Durga Prasad Paladugu | ec60a27 | 2017-12-07 15:05:30 +0530 | [diff] [blame] | 371 | if (!val) { |
Michal Simek | 0785dfd | 2015-11-05 08:34:35 +0100 | [diff] [blame] | 372 | val = readl(&crlapb_base->timestamp_ref_ctrl); |
| 373 | val |= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT; |
| 374 | writel(val, &crlapb_base->timestamp_ref_ctrl); |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 375 | |
Michal Simek | 0785dfd | 2015-11-05 08:34:35 +0100 | [diff] [blame] | 376 | /* Program freq register in System counter */ |
| 377 | writel(zynqmp_get_system_timer_freq(), |
| 378 | &iou_scntr_secure->base_frequency_id_register); |
| 379 | /* And enable system counter */ |
| 380 | writel(ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN, |
| 381 | &iou_scntr_secure->counter_control_register); |
| 382 | } |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 383 | return 0; |
| 384 | } |
| 385 | |
Nitin Jain | 5191686 | 2018-02-16 12:56:17 +0530 | [diff] [blame] | 386 | unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, |
| 387 | char * const argv[]) |
| 388 | { |
| 389 | int ret = 0; |
| 390 | |
| 391 | if (current_el() > 1) { |
| 392 | smp_kick_all_cpus(); |
| 393 | dcache_disable(); |
| 394 | armv8_switch_to_el1(0x0, 0, 0, 0, (unsigned long)entry, |
| 395 | ES_TO_AARCH64); |
| 396 | } else { |
| 397 | printf("FAIL: current EL is not above EL1\n"); |
| 398 | ret = EINVAL; |
| 399 | } |
| 400 | return ret; |
| 401 | } |
| 402 | |
Michal Simek | 8d59d7f | 2016-02-08 09:34:53 +0100 | [diff] [blame] | 403 | #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE) |
Simon Glass | 76b00ac | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 404 | int dram_init_banksize(void) |
Tom Rini | 361a879 | 2016-12-09 07:56:54 -0500 | [diff] [blame] | 405 | { |
Nitin Jain | 0678941 | 2018-04-20 12:30:40 +0530 | [diff] [blame] | 406 | int ret; |
| 407 | |
| 408 | ret = fdtdec_setup_memory_banksize(); |
| 409 | if (ret) |
| 410 | return ret; |
| 411 | |
| 412 | mem_map_fill(); |
| 413 | |
| 414 | return 0; |
Michal Simek | 8d59d7f | 2016-02-08 09:34:53 +0100 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | int dram_init(void) |
| 418 | { |
Siva Durga Prasad Paladugu | 12308b1 | 2018-07-16 15:56:11 +0530 | [diff] [blame] | 419 | if (fdtdec_setup_mem_size_base() != 0) |
Nathan Rossi | 950f86c | 2016-12-19 00:03:34 +1000 | [diff] [blame] | 420 | return -EINVAL; |
Michal Simek | 8d59d7f | 2016-02-08 09:34:53 +0100 | [diff] [blame] | 421 | |
| 422 | return 0; |
| 423 | } |
| 424 | #else |
Nitin Jain | 0678941 | 2018-04-20 12:30:40 +0530 | [diff] [blame] | 425 | int dram_init_banksize(void) |
| 426 | { |
| 427 | #if defined(CONFIG_NR_DRAM_BANKS) |
| 428 | gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; |
| 429 | gd->bd->bi_dram[0].size = get_effective_memsize(); |
| 430 | #endif |
| 431 | |
| 432 | mem_map_fill(); |
| 433 | |
| 434 | return 0; |
| 435 | } |
| 436 | |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 437 | int dram_init(void) |
| 438 | { |
Michal Simek | 61dc92a | 2018-04-11 16:12:28 +0200 | [diff] [blame] | 439 | gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, |
| 440 | CONFIG_SYS_SDRAM_SIZE); |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 441 | |
| 442 | return 0; |
| 443 | } |
Michal Simek | 8d59d7f | 2016-02-08 09:34:53 +0100 | [diff] [blame] | 444 | #endif |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 445 | |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 446 | void reset_cpu(ulong addr) |
| 447 | { |
| 448 | } |
| 449 | |
Michal Simek | 0bf3f9c | 2018-12-20 09:33:38 +0100 | [diff] [blame] | 450 | #if defined(CONFIG_BOARD_LATE_INIT) |
Michal Simek | d348bea | 2018-05-17 14:06:06 +0200 | [diff] [blame] | 451 | static const struct { |
| 452 | u32 bit; |
| 453 | const char *name; |
| 454 | } reset_reasons[] = { |
| 455 | { RESET_REASON_DEBUG_SYS, "DEBUG" }, |
| 456 | { RESET_REASON_SOFT, "SOFT" }, |
| 457 | { RESET_REASON_SRST, "SRST" }, |
| 458 | { RESET_REASON_PSONLY, "PS-ONLY" }, |
| 459 | { RESET_REASON_PMU, "PMU" }, |
| 460 | { RESET_REASON_INTERNAL, "INTERNAL" }, |
| 461 | { RESET_REASON_EXTERNAL, "EXTERNAL" }, |
| 462 | {} |
| 463 | }; |
| 464 | |
T Karthik Reddy | be52372 | 2019-03-13 20:24:18 +0530 | [diff] [blame] | 465 | static int reset_reason(void) |
Michal Simek | d348bea | 2018-05-17 14:06:06 +0200 | [diff] [blame] | 466 | { |
T Karthik Reddy | be52372 | 2019-03-13 20:24:18 +0530 | [diff] [blame] | 467 | u32 reg; |
| 468 | int i, ret; |
Michal Simek | d348bea | 2018-05-17 14:06:06 +0200 | [diff] [blame] | 469 | const char *reason = NULL; |
| 470 | |
T Karthik Reddy | be52372 | 2019-03-13 20:24:18 +0530 | [diff] [blame] | 471 | ret = zynqmp_mmio_read((ulong)&crlapb_base->reset_reason, ®); |
| 472 | if (ret) |
| 473 | return -EINVAL; |
Michal Simek | d348bea | 2018-05-17 14:06:06 +0200 | [diff] [blame] | 474 | |
| 475 | puts("Reset reason:\t"); |
| 476 | |
| 477 | for (i = 0; i < ARRAY_SIZE(reset_reasons); i++) { |
T Karthik Reddy | be52372 | 2019-03-13 20:24:18 +0530 | [diff] [blame] | 478 | if (reg & reset_reasons[i].bit) { |
Michal Simek | d348bea | 2018-05-17 14:06:06 +0200 | [diff] [blame] | 479 | reason = reset_reasons[i].name; |
| 480 | printf("%s ", reset_reasons[i].name); |
| 481 | break; |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | puts("\n"); |
| 486 | |
| 487 | env_set("reset_reason", reason); |
| 488 | |
T Karthik Reddy | be52372 | 2019-03-13 20:24:18 +0530 | [diff] [blame] | 489 | ret = zynqmp_mmio_write(~0, ~0, (ulong)&crlapb_base->reset_reason); |
| 490 | if (ret) |
| 491 | return -EINVAL; |
Michal Simek | d348bea | 2018-05-17 14:06:06 +0200 | [diff] [blame] | 492 | |
| 493 | return ret; |
| 494 | } |
| 495 | |
Michal Simek | 91d7e0c | 2019-02-14 13:14:30 +0100 | [diff] [blame] | 496 | static int set_fdtfile(void) |
| 497 | { |
| 498 | char *compatible, *fdtfile; |
| 499 | const char *suffix = ".dtb"; |
| 500 | const char *vendor = "xilinx/"; |
| 501 | |
| 502 | if (env_get("fdtfile")) |
| 503 | return 0; |
| 504 | |
| 505 | compatible = (char *)fdt_getprop(gd->fdt_blob, 0, "compatible", NULL); |
| 506 | if (compatible) { |
| 507 | debug("Compatible: %s\n", compatible); |
| 508 | |
| 509 | /* Discard vendor prefix */ |
| 510 | strsep(&compatible, ","); |
| 511 | |
| 512 | fdtfile = calloc(1, strlen(vendor) + strlen(compatible) + |
| 513 | strlen(suffix) + 1); |
| 514 | if (!fdtfile) |
| 515 | return -ENOMEM; |
| 516 | |
| 517 | sprintf(fdtfile, "%s%s%s", vendor, compatible, suffix); |
| 518 | |
| 519 | env_set("fdtfile", fdtfile); |
| 520 | free(fdtfile); |
| 521 | } |
| 522 | |
| 523 | return 0; |
| 524 | } |
| 525 | |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 526 | int board_late_init(void) |
| 527 | { |
| 528 | u32 reg = 0; |
| 529 | u8 bootmode; |
Michal Simek | 2882b39 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 530 | struct udevice *dev; |
| 531 | int bootseq = -1; |
| 532 | int bootseq_len = 0; |
Michal Simek | 0478b0b | 2018-04-25 11:10:34 +0200 | [diff] [blame] | 533 | int env_targets_len = 0; |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 534 | const char *mode; |
| 535 | char *new_targets; |
Siva Durga Prasad Paladugu | 01c42d3 | 2017-12-20 16:35:06 +0530 | [diff] [blame] | 536 | char *env_targets; |
Siva Durga Prasad Paladugu | d1db89f | 2017-02-21 17:58:28 +0530 | [diff] [blame] | 537 | int ret; |
T Karthik Reddy | a69814c | 2019-08-20 09:30:57 +0530 | [diff] [blame] | 538 | ulong initrd_hi; |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 539 | |
Michal Simek | e615f39 | 2018-10-05 08:55:16 +0200 | [diff] [blame] | 540 | #if defined(CONFIG_USB_ETHER) && !defined(CONFIG_USB_GADGET_DOWNLOAD) |
| 541 | usb_ether_init(); |
| 542 | #endif |
| 543 | |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 544 | if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { |
| 545 | debug("Saved variables - Skipping\n"); |
| 546 | return 0; |
| 547 | } |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 548 | |
Michal Simek | 91d7e0c | 2019-02-14 13:14:30 +0100 | [diff] [blame] | 549 | ret = set_fdtfile(); |
| 550 | if (ret) |
| 551 | return ret; |
| 552 | |
Siva Durga Prasad Paladugu | d1db89f | 2017-02-21 17:58:28 +0530 | [diff] [blame] | 553 | ret = zynqmp_mmio_read((ulong)&crlapb_base->boot_mode, ®); |
| 554 | if (ret) |
| 555 | return -EINVAL; |
| 556 | |
Michal Simek | 47359a0 | 2016-10-25 11:43:02 +0200 | [diff] [blame] | 557 | if (reg >> BOOT_MODE_ALT_SHIFT) |
| 558 | reg >>= BOOT_MODE_ALT_SHIFT; |
| 559 | |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 560 | bootmode = reg & BOOT_MODES_MASK; |
| 561 | |
Michal Simek | fb90917 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 562 | puts("Bootmode: "); |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 563 | switch (bootmode) { |
Michal Simek | d58fc12 | 2016-08-19 14:14:52 +0200 | [diff] [blame] | 564 | case USB_MODE: |
| 565 | puts("USB_MODE\n"); |
| 566 | mode = "usb"; |
Michal Simek | 07656ba | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 567 | env_set("modeboot", "usb_dfu_spl"); |
Michal Simek | d58fc12 | 2016-08-19 14:14:52 +0200 | [diff] [blame] | 568 | break; |
Siva Durga Prasad Paladugu | 0a5bcc8 | 2015-03-13 11:10:26 +0530 | [diff] [blame] | 569 | case JTAG_MODE: |
Michal Simek | fb90917 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 570 | puts("JTAG_MODE\n"); |
Siva Durga Prasad Paladugu | 5d2274c | 2019-06-25 17:41:09 +0530 | [diff] [blame] | 571 | mode = "jtag pxe dhcp"; |
Michal Simek | 07656ba | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 572 | env_set("modeboot", "jtagboot"); |
Siva Durga Prasad Paladugu | 0a5bcc8 | 2015-03-13 11:10:26 +0530 | [diff] [blame] | 573 | break; |
| 574 | case QSPI_MODE_24BIT: |
| 575 | case QSPI_MODE_32BIT: |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 576 | mode = "qspi0"; |
Michal Simek | fb90917 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 577 | puts("QSPI_MODE\n"); |
Michal Simek | 07656ba | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 578 | env_set("modeboot", "qspiboot"); |
Siva Durga Prasad Paladugu | 0a5bcc8 | 2015-03-13 11:10:26 +0530 | [diff] [blame] | 579 | break; |
Michal Simek | 39c56f5 | 2015-04-15 15:02:28 +0200 | [diff] [blame] | 580 | case EMMC_MODE: |
Michal Simek | 78678fe | 2015-10-05 15:59:38 +0200 | [diff] [blame] | 581 | puts("EMMC_MODE\n"); |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 582 | mode = "mmc0"; |
Michal Simek | 07656ba | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 583 | env_set("modeboot", "emmcboot"); |
Michal Simek | 78678fe | 2015-10-05 15:59:38 +0200 | [diff] [blame] | 584 | break; |
| 585 | case SD_MODE: |
Michal Simek | fb90917 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 586 | puts("SD_MODE\n"); |
Michal Simek | 2882b39 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 587 | if (uclass_get_device_by_name(UCLASS_MMC, |
Siva Durga Prasad Paladugu | e7c9de6 | 2019-01-03 15:44:24 +0530 | [diff] [blame] | 588 | "mmc@ff160000", &dev) && |
| 589 | uclass_get_device_by_name(UCLASS_MMC, |
Michal Simek | 2882b39 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 590 | "sdhci@ff160000", &dev)) { |
| 591 | puts("Boot from SD0 but without SD0 enabled!\n"); |
| 592 | return -1; |
| 593 | } |
| 594 | debug("mmc0 device found at %p, seq %d\n", dev, dev->seq); |
| 595 | |
| 596 | mode = "mmc"; |
| 597 | bootseq = dev->seq; |
Michal Simek | 07656ba | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 598 | env_set("modeboot", "sdboot"); |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 599 | break; |
Siva Durga Prasad Paladugu | e199227 | 2016-09-21 11:45:05 +0530 | [diff] [blame] | 600 | case SD1_LSHFT_MODE: |
| 601 | puts("LVL_SHFT_"); |
| 602 | /* fall through */ |
Michal Simek | af813ac | 2015-10-05 10:51:12 +0200 | [diff] [blame] | 603 | case SD_MODE1: |
Michal Simek | fb90917 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 604 | puts("SD_MODE1\n"); |
Michal Simek | 2882b39 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 605 | if (uclass_get_device_by_name(UCLASS_MMC, |
Siva Durga Prasad Paladugu | e7c9de6 | 2019-01-03 15:44:24 +0530 | [diff] [blame] | 606 | "mmc@ff170000", &dev) && |
| 607 | uclass_get_device_by_name(UCLASS_MMC, |
Michal Simek | 2882b39 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 608 | "sdhci@ff170000", &dev)) { |
| 609 | puts("Boot from SD1 but without SD1 enabled!\n"); |
| 610 | return -1; |
| 611 | } |
| 612 | debug("mmc1 device found at %p, seq %d\n", dev, dev->seq); |
| 613 | |
| 614 | mode = "mmc"; |
| 615 | bootseq = dev->seq; |
Michal Simek | 07656ba | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 616 | env_set("modeboot", "sdboot"); |
Michal Simek | af813ac | 2015-10-05 10:51:12 +0200 | [diff] [blame] | 617 | break; |
| 618 | case NAND_MODE: |
Michal Simek | fb90917 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 619 | puts("NAND_MODE\n"); |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 620 | mode = "nand0"; |
Michal Simek | 07656ba | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 621 | env_set("modeboot", "nandboot"); |
Michal Simek | af813ac | 2015-10-05 10:51:12 +0200 | [diff] [blame] | 622 | break; |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 623 | default: |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 624 | mode = ""; |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 625 | printf("Invalid Boot Mode:0x%x\n", bootmode); |
| 626 | break; |
| 627 | } |
| 628 | |
Michal Simek | 2882b39 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 629 | if (bootseq >= 0) { |
| 630 | bootseq_len = snprintf(NULL, 0, "%i", bootseq); |
| 631 | debug("Bootseq len: %x\n", bootseq_len); |
| 632 | } |
| 633 | |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 634 | /* |
| 635 | * One terminating char + one byte for space between mode |
| 636 | * and default boot_targets |
| 637 | */ |
Siva Durga Prasad Paladugu | 01c42d3 | 2017-12-20 16:35:06 +0530 | [diff] [blame] | 638 | env_targets = env_get("boot_targets"); |
Michal Simek | 0478b0b | 2018-04-25 11:10:34 +0200 | [diff] [blame] | 639 | if (env_targets) |
| 640 | env_targets_len = strlen(env_targets); |
| 641 | |
Michal Simek | 2882b39 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 642 | new_targets = calloc(1, strlen(mode) + env_targets_len + 2 + |
| 643 | bootseq_len); |
Michal Simek | 1e3e68f | 2018-06-13 09:42:41 +0200 | [diff] [blame] | 644 | if (!new_targets) |
| 645 | return -ENOMEM; |
Michal Simek | 0478b0b | 2018-04-25 11:10:34 +0200 | [diff] [blame] | 646 | |
Michal Simek | 2882b39 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 647 | if (bootseq >= 0) |
| 648 | sprintf(new_targets, "%s%x %s", mode, bootseq, |
| 649 | env_targets ? env_targets : ""); |
| 650 | else |
| 651 | sprintf(new_targets, "%s %s", mode, |
| 652 | env_targets ? env_targets : ""); |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 653 | |
Simon Glass | 382bee5 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 654 | env_set("boot_targets", new_targets); |
Michal Simek | b72894f | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 655 | |
T Karthik Reddy | a69814c | 2019-08-20 09:30:57 +0530 | [diff] [blame] | 656 | initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE; |
| 657 | initrd_hi = round_down(initrd_hi, SZ_16M); |
| 658 | env_set_addr("initrd_high", (void *)initrd_hi); |
| 659 | |
Michal Simek | d348bea | 2018-05-17 14:06:06 +0200 | [diff] [blame] | 660 | reset_reason(); |
| 661 | |
Michal Simek | 84c7204 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 662 | return 0; |
| 663 | } |
Michal Simek | 0bf3f9c | 2018-12-20 09:33:38 +0100 | [diff] [blame] | 664 | #endif |
Siva Durga Prasad Paladugu | 84696ff | 2015-08-04 13:01:05 +0530 | [diff] [blame] | 665 | |
| 666 | int checkboard(void) |
| 667 | { |
Michal Simek | 5af0855 | 2016-01-25 11:04:21 +0100 | [diff] [blame] | 668 | puts("Board: Xilinx ZynqMP\n"); |
Siva Durga Prasad Paladugu | 84696ff | 2015-08-04 13:01:05 +0530 | [diff] [blame] | 669 | return 0; |
| 670 | } |