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