Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | 04b7e62 | 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 | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Michal Simek | d54b1af | 2015-09-30 17:26:55 +0200 | [diff] [blame] | 8 | #include <sata.h> |
Michal Simek | b216cc1 | 2015-07-23 13:27:40 +0200 | [diff] [blame] | 9 | #include <ahci.h> |
| 10 | #include <scsi.h> |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 11 | #include <malloc.h> |
Michal Simek | bf0f9ca | 2018-04-19 15:43:38 +0200 | [diff] [blame] | 12 | #include <wdt.h> |
Michal Simek | c23d3f8 | 2015-11-05 08:34:35 +0100 | [diff] [blame] | 13 | #include <asm/arch/clk.h> |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 14 | #include <asm/arch/hardware.h> |
| 15 | #include <asm/arch/sys_proto.h> |
Michal Simek | f2f0864 | 2018-01-10 09:36:09 +0100 | [diff] [blame] | 16 | #include <asm/arch/psu_init_gpl.h> |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 17 | #include <asm/io.h> |
Michal Simek | f183a98 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 18 | #include <dm/device.h> |
Michal Simek | bf0f9ca | 2018-04-19 15:43:38 +0200 | [diff] [blame] | 19 | #include <dm/uclass.h> |
Siva Durga Prasad Paladugu | ba1f68e | 2015-08-04 13:03:26 +0530 | [diff] [blame] | 20 | #include <usb.h> |
| 21 | #include <dwc3-uboot.h> |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 22 | #include <zynqmppl.h> |
Michal Simek | eec32f6 | 2016-04-22 11:48:49 +0200 | [diff] [blame] | 23 | #include <i2c.h> |
Michal Simek | 76d0a77 | 2016-09-01 11:16:40 +0200 | [diff] [blame] | 24 | #include <g_dnl.h> |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 25 | |
| 26 | DECLARE_GLOBAL_DATA_PTR; |
| 27 | |
Michal Simek | bf0f9ca | 2018-04-19 15:43:38 +0200 | [diff] [blame] | 28 | #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT) |
| 29 | static struct udevice *watchdog_dev; |
| 30 | #endif |
| 31 | |
Michal Simek | 8111aff | 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 | 6908b86 | 2017-11-06 12:55:59 +0100 | [diff] [blame] | 37 | u32 id; |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 38 | u32 ver; |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 39 | char *name; |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 40 | bool evexists; |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 41 | } zynqmp_devices[] = { |
| 42 | { |
| 43 | .id = 0x10, |
| 44 | .name = "3eg", |
| 45 | }, |
| 46 | { |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 47 | .id = 0x10, |
| 48 | .ver = 0x2c, |
| 49 | .name = "3cg", |
| 50 | }, |
| 51 | { |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 52 | .id = 0x11, |
| 53 | .name = "2eg", |
| 54 | }, |
| 55 | { |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 56 | .id = 0x11, |
| 57 | .ver = 0x2c, |
| 58 | .name = "2cg", |
| 59 | }, |
| 60 | { |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 61 | .id = 0x20, |
| 62 | .name = "5ev", |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 63 | .evexists = 1, |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 64 | }, |
| 65 | { |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 66 | .id = 0x20, |
| 67 | .ver = 0x100, |
| 68 | .name = "5eg", |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 69 | .evexists = 1, |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 70 | }, |
| 71 | { |
| 72 | .id = 0x20, |
| 73 | .ver = 0x12c, |
| 74 | .name = "5cg", |
Siva Durga Prasad Paladugu | 951c019 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 75 | .evexists = 1, |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 76 | }, |
| 77 | { |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 78 | .id = 0x21, |
| 79 | .name = "4ev", |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 80 | .evexists = 1, |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 81 | }, |
| 82 | { |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 83 | .id = 0x21, |
| 84 | .ver = 0x100, |
| 85 | .name = "4eg", |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 86 | .evexists = 1, |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 87 | }, |
| 88 | { |
| 89 | .id = 0x21, |
| 90 | .ver = 0x12c, |
| 91 | .name = "4cg", |
Siva Durga Prasad Paladugu | 951c019 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 92 | .evexists = 1, |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 93 | }, |
| 94 | { |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 95 | .id = 0x30, |
| 96 | .name = "7ev", |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 97 | .evexists = 1, |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 98 | }, |
| 99 | { |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 100 | .id = 0x30, |
| 101 | .ver = 0x100, |
| 102 | .name = "7eg", |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 103 | .evexists = 1, |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 104 | }, |
| 105 | { |
| 106 | .id = 0x30, |
| 107 | .ver = 0x12c, |
| 108 | .name = "7cg", |
Siva Durga Prasad Paladugu | 951c019 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 109 | .evexists = 1, |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 110 | }, |
| 111 | { |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 112 | .id = 0x38, |
| 113 | .name = "9eg", |
| 114 | }, |
| 115 | { |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 116 | .id = 0x38, |
| 117 | .ver = 0x2c, |
| 118 | .name = "9cg", |
| 119 | }, |
| 120 | { |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 121 | .id = 0x39, |
| 122 | .name = "6eg", |
| 123 | }, |
| 124 | { |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 125 | .id = 0x39, |
| 126 | .ver = 0x2c, |
| 127 | .name = "6cg", |
| 128 | }, |
| 129 | { |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 130 | .id = 0x40, |
| 131 | .name = "11eg", |
| 132 | }, |
Michal Simek | 50d8cef | 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 | 8111aff | 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 | b510e53 | 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 | }, |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 174 | }; |
Siva Durga Prasad Paladugu | 8d52653 | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 175 | #endif |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 176 | |
Siva Durga Prasad Paladugu | cd35d52 | 2017-07-25 11:51:38 +0530 | [diff] [blame] | 177 | int chip_id(unsigned char id) |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 178 | { |
| 179 | struct pt_regs regs; |
Siva Durga Prasad Paladugu | 9f0a8e9 | 2017-07-25 11:51:36 +0530 | [diff] [blame] | 180 | int val = -EINVAL; |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 181 | |
Siva Durga Prasad Paladugu | 8d52653 | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 182 | if (current_el() != 3) { |
| 183 | regs.regs[0] = ZYNQMP_SIP_SVC_CSU_DMA_CHIPID; |
| 184 | regs.regs[1] = 0; |
| 185 | regs.regs[2] = 0; |
| 186 | regs.regs[3] = 0; |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 187 | |
Siva Durga Prasad Paladugu | 8d52653 | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 188 | smc_call(®s); |
| 189 | |
| 190 | /* |
| 191 | * SMC returns: |
| 192 | * regs[0][31:0] = status of the operation |
| 193 | * regs[0][63:32] = CSU.IDCODE register |
| 194 | * regs[1][31:0] = CSU.version register |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 195 | * regs[1][63:32] = CSU.IDCODE2 register |
Siva Durga Prasad Paladugu | 8d52653 | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 196 | */ |
| 197 | switch (id) { |
| 198 | case IDCODE: |
| 199 | regs.regs[0] = upper_32_bits(regs.regs[0]); |
| 200 | regs.regs[0] &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | |
| 201 | ZYNQMP_CSU_IDCODE_SVD_MASK; |
| 202 | regs.regs[0] >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; |
| 203 | val = regs.regs[0]; |
| 204 | break; |
| 205 | case VERSION: |
| 206 | regs.regs[1] = lower_32_bits(regs.regs[1]); |
| 207 | regs.regs[1] &= ZYNQMP_CSU_SILICON_VER_MASK; |
| 208 | val = regs.regs[1]; |
| 209 | break; |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 210 | case IDCODE2: |
| 211 | regs.regs[1] = lower_32_bits(regs.regs[1]); |
| 212 | regs.regs[1] >>= ZYNQMP_CSU_VERSION_EMPTY_SHIFT; |
| 213 | val = regs.regs[1]; |
| 214 | break; |
Siva Durga Prasad Paladugu | 8d52653 | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 215 | default: |
| 216 | printf("%s, Invalid Req:0x%x\n", __func__, id); |
| 217 | } |
| 218 | } else { |
| 219 | switch (id) { |
| 220 | case IDCODE: |
| 221 | val = readl(ZYNQMP_CSU_IDCODE_ADDR); |
| 222 | val &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | |
| 223 | ZYNQMP_CSU_IDCODE_SVD_MASK; |
| 224 | val >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; |
| 225 | break; |
| 226 | case VERSION: |
| 227 | val = readl(ZYNQMP_CSU_VER_ADDR); |
| 228 | val &= ZYNQMP_CSU_SILICON_VER_MASK; |
| 229 | break; |
| 230 | default: |
| 231 | printf("%s, Invalid Req:0x%x\n", __func__, id); |
| 232 | } |
Siva Durga Prasad Paladugu | 9f0a8e9 | 2017-07-25 11:51:36 +0530 | [diff] [blame] | 233 | } |
Soren Brinkmann | d7696a5 | 2016-09-29 11:44:41 -0700 | [diff] [blame] | 234 | |
Siva Durga Prasad Paladugu | 9f0a8e9 | 2017-07-25 11:51:36 +0530 | [diff] [blame] | 235 | return val; |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 236 | } |
| 237 | |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 238 | #define ZYNQMP_VERSION_SIZE 9 |
| 239 | #define ZYNQMP_PL_STATUS_BIT 9 |
Siva Durga Prasad Paladugu | 951c019 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 240 | #define ZYNQMP_IPDIS_VCU_BIT 8 |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 241 | #define ZYNQMP_PL_STATUS_MASK BIT(ZYNQMP_PL_STATUS_BIT) |
| 242 | #define ZYNQMP_CSU_VERSION_MASK ~(ZYNQMP_PL_STATUS_MASK) |
Siva Durga Prasad Paladugu | 951c019 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 243 | #define ZYNQMP_CSU_VCUDIS_VER_MASK ZYNQMP_CSU_VERSION_MASK & \ |
| 244 | ~BIT(ZYNQMP_IPDIS_VCU_BIT) |
| 245 | #define MAX_VARIANTS_EV 3 |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 246 | |
Siva Durga Prasad Paladugu | 8d52653 | 2017-07-25 11:51:37 +0530 | [diff] [blame] | 247 | #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \ |
| 248 | !defined(CONFIG_SPL_BUILD) |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 249 | static char *zynqmp_get_silicon_idcode_name(void) |
| 250 | { |
Siva Durga Prasad Paladugu | 951c019 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 251 | u32 i, id, ver, j; |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 252 | char *buf; |
| 253 | static char name[ZYNQMP_VERSION_SIZE]; |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 254 | |
Siva Durga Prasad Paladugu | 9f0a8e9 | 2017-07-25 11:51:36 +0530 | [diff] [blame] | 255 | id = chip_id(IDCODE); |
Michal Simek | 50d8cef | 2017-08-22 14:58:53 +0200 | [diff] [blame] | 256 | ver = chip_id(IDCODE2); |
| 257 | |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 258 | for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) { |
Siva Durga Prasad Paladugu | 951c019 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 259 | if (zynqmp_devices[i].id == id) { |
| 260 | if (zynqmp_devices[i].evexists && |
| 261 | !(ver & ZYNQMP_PL_STATUS_MASK)) |
| 262 | break; |
| 263 | if (zynqmp_devices[i].ver == (ver & |
| 264 | ZYNQMP_CSU_VERSION_MASK)) |
| 265 | break; |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 266 | } |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 267 | } |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 268 | |
| 269 | if (i >= ARRAY_SIZE(zynqmp_devices)) |
| 270 | return "unknown"; |
| 271 | |
Siva Durga Prasad Paladugu | 951c019 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 272 | strncat(name, "zu", 2); |
| 273 | if (!zynqmp_devices[i].evexists || |
| 274 | (ver & ZYNQMP_PL_STATUS_MASK)) { |
| 275 | strncat(name, zynqmp_devices[i].name, |
| 276 | ZYNQMP_VERSION_SIZE - 3); |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 277 | return name; |
Siva Durga Prasad Paladugu | 951c019 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 278 | } |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 279 | |
Siva Durga Prasad Paladugu | 951c019 | 2018-10-26 17:47:55 +0530 | [diff] [blame] | 280 | /* |
| 281 | * Here we are means, PL not powered up and ev variant |
| 282 | * exists. So, we need to ignore VCU disable bit(8) in |
| 283 | * version and findout if its CG or EG/EV variant. |
| 284 | */ |
| 285 | for (j = 0; j < MAX_VARIANTS_EV; j++, i++) { |
| 286 | if ((zynqmp_devices[i].ver & ~BIT(ZYNQMP_IPDIS_VCU_BIT)) == |
| 287 | (ver & ZYNQMP_CSU_VCUDIS_VER_MASK)) { |
| 288 | strncat(name, zynqmp_devices[i].name, |
| 289 | ZYNQMP_VERSION_SIZE - 3); |
| 290 | break; |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | if (j >= MAX_VARIANTS_EV) |
| 295 | return "unknown"; |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 296 | |
| 297 | if (strstr(name, "eg") || strstr(name, "ev")) { |
| 298 | buf = strstr(name, "e"); |
| 299 | *buf = '\0'; |
| 300 | } |
| 301 | |
| 302 | return name; |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 303 | } |
| 304 | #endif |
| 305 | |
Michal Simek | 8b35330 | 2017-02-07 14:32:26 +0100 | [diff] [blame] | 306 | int board_early_init_f(void) |
| 307 | { |
Michal Simek | c8785f2 | 2018-01-10 11:48:48 +0100 | [diff] [blame] | 308 | int ret = 0; |
Michal Simek | 8b35330 | 2017-02-07 14:32:26 +0100 | [diff] [blame] | 309 | #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_CLK_ZYNQMP) |
Siva Durga Prasad Paladugu | 8406d47 | 2018-08-21 15:44:49 +0530 | [diff] [blame] | 310 | u32 pm_api_version; |
| 311 | |
| 312 | pm_api_version = zynqmp_pmufw_version(); |
| 313 | printf("PMUFW:\tv%d.%d\n", |
| 314 | pm_api_version >> ZYNQMP_PM_VERSION_MAJOR_SHIFT, |
| 315 | pm_api_version & ZYNQMP_PM_VERSION_MINOR_MASK); |
| 316 | |
| 317 | if (pm_api_version < ZYNQMP_PM_VERSION) |
| 318 | panic("PMUFW version error. Expected: v%d.%d\n", |
| 319 | ZYNQMP_PM_VERSION_MAJOR, ZYNQMP_PM_VERSION_MINOR); |
Michal Simek | 8b35330 | 2017-02-07 14:32:26 +0100 | [diff] [blame] | 320 | #endif |
Michal Simek | e0f3610 | 2017-07-12 13:08:41 +0200 | [diff] [blame] | 321 | |
Michal Simek | 1a1ab5a | 2018-01-15 12:52:59 +0100 | [diff] [blame] | 322 | #if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED) |
Michal Simek | c8785f2 | 2018-01-10 11:48:48 +0100 | [diff] [blame] | 323 | ret = psu_init(); |
Michal Simek | e0f3610 | 2017-07-12 13:08:41 +0200 | [diff] [blame] | 324 | #endif |
| 325 | |
Michal Simek | bf0f9ca | 2018-04-19 15:43:38 +0200 | [diff] [blame] | 326 | #if defined(CONFIG_WDT) && !defined(CONFIG_SPL_BUILD) |
| 327 | /* bss is not cleared at time when watchdog_reset() is called */ |
| 328 | watchdog_dev = NULL; |
| 329 | #endif |
| 330 | |
Michal Simek | c8785f2 | 2018-01-10 11:48:48 +0100 | [diff] [blame] | 331 | return ret; |
Michal Simek | 8b35330 | 2017-02-07 14:32:26 +0100 | [diff] [blame] | 332 | } |
| 333 | |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 334 | int board_init(void) |
| 335 | { |
Michal Simek | fb7242d | 2015-06-22 14:31:06 +0200 | [diff] [blame] | 336 | printf("EL Level:\tEL%d\n", current_el()); |
| 337 | |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 338 | #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \ |
| 339 | !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_FPGA_SUPPORT) && \ |
| 340 | defined(CONFIG_SPL_BUILD)) |
| 341 | if (current_el() != 3) { |
Siva Durga Prasad Paladugu | ba2622d | 2018-03-02 16:20:10 +0530 | [diff] [blame] | 342 | zynqmppl.name = zynqmp_get_silicon_idcode_name(); |
Michal Simek | 8111aff | 2016-02-01 15:05:58 +0100 | [diff] [blame] | 343 | printf("Chip ID:\t%s\n", zynqmppl.name); |
| 344 | fpga_init(); |
| 345 | fpga_add(fpga_xilinx, &zynqmppl); |
| 346 | } |
| 347 | #endif |
| 348 | |
Michal Simek | bf0f9ca | 2018-04-19 15:43:38 +0200 | [diff] [blame] | 349 | #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT) |
Michal Simek | 169d34b | 2018-07-11 08:30:07 +0200 | [diff] [blame] | 350 | if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) { |
| 351 | debug("Watchdog: Not found by seq!\n"); |
| 352 | if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) { |
| 353 | puts("Watchdog: Not found!\n"); |
| 354 | return 0; |
| 355 | } |
Michal Simek | bf0f9ca | 2018-04-19 15:43:38 +0200 | [diff] [blame] | 356 | } |
Michal Simek | 169d34b | 2018-07-11 08:30:07 +0200 | [diff] [blame] | 357 | |
| 358 | wdt_start(watchdog_dev, 0, 0); |
| 359 | puts("Watchdog: Started\n"); |
Michal Simek | bf0f9ca | 2018-04-19 15:43:38 +0200 | [diff] [blame] | 360 | #endif |
| 361 | |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 362 | return 0; |
| 363 | } |
| 364 | |
Michal Simek | bf0f9ca | 2018-04-19 15:43:38 +0200 | [diff] [blame] | 365 | #ifdef CONFIG_WATCHDOG |
| 366 | /* Called by macro WATCHDOG_RESET */ |
| 367 | void watchdog_reset(void) |
| 368 | { |
| 369 | # if !defined(CONFIG_SPL_BUILD) |
| 370 | static ulong next_reset; |
| 371 | ulong now; |
| 372 | |
| 373 | if (!watchdog_dev) |
| 374 | return; |
| 375 | |
| 376 | now = timer_get_us(); |
| 377 | |
| 378 | /* Do not reset the watchdog too often */ |
| 379 | if (now > next_reset) { |
| 380 | wdt_reset(watchdog_dev); |
| 381 | next_reset = now + 1000; |
| 382 | } |
| 383 | # endif |
| 384 | } |
| 385 | #endif |
| 386 | |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 387 | int board_early_init_r(void) |
| 388 | { |
| 389 | u32 val; |
| 390 | |
Siva Durga Prasad Paladugu | 64d9000 | 2017-12-07 15:05:30 +0530 | [diff] [blame] | 391 | if (current_el() != 3) |
| 392 | return 0; |
| 393 | |
Michal Simek | 245d528 | 2017-07-12 10:32:18 +0200 | [diff] [blame] | 394 | val = readl(&crlapb_base->timestamp_ref_ctrl); |
| 395 | val &= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT; |
| 396 | |
Siva Durga Prasad Paladugu | 64d9000 | 2017-12-07 15:05:30 +0530 | [diff] [blame] | 397 | if (!val) { |
Michal Simek | c23d3f8 | 2015-11-05 08:34:35 +0100 | [diff] [blame] | 398 | val = readl(&crlapb_base->timestamp_ref_ctrl); |
| 399 | val |= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT; |
| 400 | writel(val, &crlapb_base->timestamp_ref_ctrl); |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 401 | |
Michal Simek | c23d3f8 | 2015-11-05 08:34:35 +0100 | [diff] [blame] | 402 | /* Program freq register in System counter */ |
| 403 | writel(zynqmp_get_system_timer_freq(), |
| 404 | &iou_scntr_secure->base_frequency_id_register); |
| 405 | /* And enable system counter */ |
| 406 | writel(ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN, |
| 407 | &iou_scntr_secure->counter_control_register); |
| 408 | } |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 409 | return 0; |
| 410 | } |
| 411 | |
Michal Simek | eec32f6 | 2016-04-22 11:48:49 +0200 | [diff] [blame] | 412 | int zynq_board_read_rom_ethaddr(unsigned char *ethaddr) |
| 413 | { |
| 414 | #if defined(CONFIG_ZYNQ_GEM_EEPROM_ADDR) && \ |
| 415 | defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET) && \ |
| 416 | defined(CONFIG_ZYNQ_EEPROM_BUS) |
| 417 | i2c_set_bus_num(CONFIG_ZYNQ_EEPROM_BUS); |
| 418 | |
| 419 | if (eeprom_read(CONFIG_ZYNQ_GEM_EEPROM_ADDR, |
| 420 | CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET, |
| 421 | ethaddr, 6)) |
| 422 | printf("I2C EEPROM MAC address read failed\n"); |
| 423 | #endif |
| 424 | |
| 425 | return 0; |
| 426 | } |
| 427 | |
Nitin Jain | b2eb59b | 2018-02-16 12:56:17 +0530 | [diff] [blame] | 428 | unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, |
| 429 | char * const argv[]) |
| 430 | { |
| 431 | int ret = 0; |
| 432 | |
| 433 | if (current_el() > 1) { |
| 434 | smp_kick_all_cpus(); |
| 435 | dcache_disable(); |
| 436 | armv8_switch_to_el1(0x0, 0, 0, 0, (unsigned long)entry, |
| 437 | ES_TO_AARCH64); |
| 438 | } else { |
| 439 | printf("FAIL: current EL is not above EL1\n"); |
| 440 | ret = EINVAL; |
| 441 | } |
| 442 | return ret; |
| 443 | } |
| 444 | |
Michal Simek | 8faa66a | 2016-02-08 09:34:53 +0100 | [diff] [blame] | 445 | #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE) |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 446 | int dram_init_banksize(void) |
Michal Simek | 8faa66a | 2016-02-08 09:34:53 +0100 | [diff] [blame] | 447 | { |
Nitin Jain | 9bcc76f | 2018-04-20 12:30:40 +0530 | [diff] [blame] | 448 | int ret; |
| 449 | |
| 450 | ret = fdtdec_setup_memory_banksize(); |
| 451 | if (ret) |
| 452 | return ret; |
| 453 | |
| 454 | mem_map_fill(); |
| 455 | |
| 456 | return 0; |
Tom Rini | edcfdbd | 2016-12-09 07:56:54 -0500 | [diff] [blame] | 457 | } |
Michal Simek | 8faa66a | 2016-02-08 09:34:53 +0100 | [diff] [blame] | 458 | |
Tom Rini | edcfdbd | 2016-12-09 07:56:54 -0500 | [diff] [blame] | 459 | int dram_init(void) |
| 460 | { |
Siva Durga Prasad Paladugu | b3d55ea | 2018-07-16 15:56:11 +0530 | [diff] [blame] | 461 | if (fdtdec_setup_mem_size_base() != 0) |
Nathan Rossi | ac04bfa | 2016-12-19 00:03:34 +1000 | [diff] [blame] | 462 | return -EINVAL; |
Tom Rini | edcfdbd | 2016-12-09 07:56:54 -0500 | [diff] [blame] | 463 | |
| 464 | return 0; |
Michal Simek | 8faa66a | 2016-02-08 09:34:53 +0100 | [diff] [blame] | 465 | } |
| 466 | #else |
Nitin Jain | 9bcc76f | 2018-04-20 12:30:40 +0530 | [diff] [blame] | 467 | int dram_init_banksize(void) |
| 468 | { |
| 469 | #if defined(CONFIG_NR_DRAM_BANKS) |
| 470 | gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; |
| 471 | gd->bd->bi_dram[0].size = get_effective_memsize(); |
| 472 | #endif |
| 473 | |
| 474 | mem_map_fill(); |
| 475 | |
| 476 | return 0; |
| 477 | } |
| 478 | |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 479 | int dram_init(void) |
| 480 | { |
Michal Simek | 1b84621 | 2018-04-11 16:12:28 +0200 | [diff] [blame] | 481 | gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, |
| 482 | CONFIG_SYS_SDRAM_SIZE); |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 483 | |
| 484 | return 0; |
| 485 | } |
Michal Simek | 8faa66a | 2016-02-08 09:34:53 +0100 | [diff] [blame] | 486 | #endif |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 487 | |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 488 | void reset_cpu(ulong addr) |
| 489 | { |
| 490 | } |
| 491 | |
Michal Simek | 342edfe | 2018-12-20 09:33:38 +0100 | [diff] [blame] | 492 | #if defined(CONFIG_BOARD_LATE_INIT) |
Michal Simek | 29b9b71 | 2018-05-17 14:06:06 +0200 | [diff] [blame] | 493 | static const struct { |
| 494 | u32 bit; |
| 495 | const char *name; |
| 496 | } reset_reasons[] = { |
| 497 | { RESET_REASON_DEBUG_SYS, "DEBUG" }, |
| 498 | { RESET_REASON_SOFT, "SOFT" }, |
| 499 | { RESET_REASON_SRST, "SRST" }, |
| 500 | { RESET_REASON_PSONLY, "PS-ONLY" }, |
| 501 | { RESET_REASON_PMU, "PMU" }, |
| 502 | { RESET_REASON_INTERNAL, "INTERNAL" }, |
| 503 | { RESET_REASON_EXTERNAL, "EXTERNAL" }, |
| 504 | {} |
| 505 | }; |
| 506 | |
| 507 | static u32 reset_reason(void) |
| 508 | { |
| 509 | u32 ret; |
| 510 | int i; |
| 511 | const char *reason = NULL; |
| 512 | |
| 513 | ret = readl(&crlapb_base->reset_reason); |
| 514 | |
| 515 | puts("Reset reason:\t"); |
| 516 | |
| 517 | for (i = 0; i < ARRAY_SIZE(reset_reasons); i++) { |
| 518 | if (ret & reset_reasons[i].bit) { |
| 519 | reason = reset_reasons[i].name; |
| 520 | printf("%s ", reset_reasons[i].name); |
| 521 | break; |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | puts("\n"); |
| 526 | |
| 527 | env_set("reset_reason", reason); |
| 528 | |
| 529 | writel(~0, &crlapb_base->reset_reason); |
| 530 | |
| 531 | return ret; |
| 532 | } |
| 533 | |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 534 | int board_late_init(void) |
| 535 | { |
| 536 | u32 reg = 0; |
| 537 | u8 bootmode; |
Michal Simek | f183a98 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 538 | struct udevice *dev; |
| 539 | int bootseq = -1; |
| 540 | int bootseq_len = 0; |
Michal Simek | 7410b14 | 2018-04-25 11:10:34 +0200 | [diff] [blame] | 541 | int env_targets_len = 0; |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 542 | const char *mode; |
| 543 | char *new_targets; |
Siva Durga Prasad Paladugu | 245c556 | 2017-12-20 16:35:06 +0530 | [diff] [blame] | 544 | char *env_targets; |
Siva Durga Prasad Paladugu | e6fd3bb | 2017-02-21 17:58:28 +0530 | [diff] [blame] | 545 | int ret; |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 546 | |
Michal Simek | 482f549 | 2018-10-05 08:55:16 +0200 | [diff] [blame] | 547 | #if defined(CONFIG_USB_ETHER) && !defined(CONFIG_USB_GADGET_DOWNLOAD) |
| 548 | usb_ether_init(); |
| 549 | #endif |
| 550 | |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 551 | if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { |
| 552 | debug("Saved variables - Skipping\n"); |
| 553 | return 0; |
| 554 | } |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 555 | |
Siva Durga Prasad Paladugu | e6fd3bb | 2017-02-21 17:58:28 +0530 | [diff] [blame] | 556 | ret = zynqmp_mmio_read((ulong)&crlapb_base->boot_mode, ®); |
| 557 | if (ret) |
| 558 | return -EINVAL; |
| 559 | |
Michal Simek | 833e0c4 | 2016-10-25 11:43:02 +0200 | [diff] [blame] | 560 | if (reg >> BOOT_MODE_ALT_SHIFT) |
| 561 | reg >>= BOOT_MODE_ALT_SHIFT; |
| 562 | |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 563 | bootmode = reg & BOOT_MODES_MASK; |
| 564 | |
Michal Simek | c5d9523 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 565 | puts("Bootmode: "); |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 566 | switch (bootmode) { |
Michal Simek | 12398ea | 2016-08-19 14:14:52 +0200 | [diff] [blame] | 567 | case USB_MODE: |
| 568 | puts("USB_MODE\n"); |
| 569 | mode = "usb"; |
Michal Simek | 4338035 | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 570 | env_set("modeboot", "usb_dfu_spl"); |
Michal Simek | 12398ea | 2016-08-19 14:14:52 +0200 | [diff] [blame] | 571 | break; |
Siva Durga Prasad Paladugu | 30f0fc7 | 2015-03-13 11:10:26 +0530 | [diff] [blame] | 572 | case JTAG_MODE: |
Michal Simek | c5d9523 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 573 | puts("JTAG_MODE\n"); |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 574 | mode = "pxe dhcp"; |
Michal Simek | 4338035 | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 575 | env_set("modeboot", "jtagboot"); |
Siva Durga Prasad Paladugu | 30f0fc7 | 2015-03-13 11:10:26 +0530 | [diff] [blame] | 576 | break; |
| 577 | case QSPI_MODE_24BIT: |
| 578 | case QSPI_MODE_32BIT: |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 579 | mode = "qspi0"; |
Michal Simek | c5d9523 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 580 | puts("QSPI_MODE\n"); |
Michal Simek | 4338035 | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 581 | env_set("modeboot", "qspiboot"); |
Siva Durga Prasad Paladugu | 30f0fc7 | 2015-03-13 11:10:26 +0530 | [diff] [blame] | 582 | break; |
Michal Simek | 02d66cd | 2015-04-15 15:02:28 +0200 | [diff] [blame] | 583 | case EMMC_MODE: |
Michal Simek | df7ff0a | 2015-10-05 15:59:38 +0200 | [diff] [blame] | 584 | puts("EMMC_MODE\n"); |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 585 | mode = "mmc0"; |
Michal Simek | 4338035 | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 586 | env_set("modeboot", "emmcboot"); |
Michal Simek | df7ff0a | 2015-10-05 15:59:38 +0200 | [diff] [blame] | 587 | break; |
| 588 | case SD_MODE: |
Michal Simek | c5d9523 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 589 | puts("SD_MODE\n"); |
Michal Simek | f183a98 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 590 | if (uclass_get_device_by_name(UCLASS_MMC, |
Siva Durga Prasad Paladugu | e91778d | 2019-01-03 15:44:24 +0530 | [diff] [blame] | 591 | "mmc@ff160000", &dev) && |
| 592 | uclass_get_device_by_name(UCLASS_MMC, |
Michal Simek | f183a98 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 593 | "sdhci@ff160000", &dev)) { |
| 594 | puts("Boot from SD0 but without SD0 enabled!\n"); |
| 595 | return -1; |
| 596 | } |
| 597 | debug("mmc0 device found at %p, seq %d\n", dev, dev->seq); |
| 598 | |
| 599 | mode = "mmc"; |
| 600 | bootseq = dev->seq; |
Michal Simek | 4338035 | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 601 | env_set("modeboot", "sdboot"); |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 602 | break; |
Siva Durga Prasad Paladugu | 29a77d2 | 2016-09-21 11:45:05 +0530 | [diff] [blame] | 603 | case SD1_LSHFT_MODE: |
| 604 | puts("LVL_SHFT_"); |
| 605 | /* fall through */ |
Michal Simek | 108e184 | 2015-10-05 10:51:12 +0200 | [diff] [blame] | 606 | case SD_MODE1: |
Michal Simek | c5d9523 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 607 | puts("SD_MODE1\n"); |
Michal Simek | f183a98 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 608 | if (uclass_get_device_by_name(UCLASS_MMC, |
Siva Durga Prasad Paladugu | e91778d | 2019-01-03 15:44:24 +0530 | [diff] [blame] | 609 | "mmc@ff170000", &dev) && |
| 610 | uclass_get_device_by_name(UCLASS_MMC, |
Michal Simek | f183a98 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 611 | "sdhci@ff170000", &dev)) { |
| 612 | puts("Boot from SD1 but without SD1 enabled!\n"); |
| 613 | return -1; |
| 614 | } |
| 615 | debug("mmc1 device found at %p, seq %d\n", dev, dev->seq); |
| 616 | |
| 617 | mode = "mmc"; |
| 618 | bootseq = dev->seq; |
Michal Simek | 4338035 | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 619 | env_set("modeboot", "sdboot"); |
Michal Simek | 108e184 | 2015-10-05 10:51:12 +0200 | [diff] [blame] | 620 | break; |
| 621 | case NAND_MODE: |
Michal Simek | c5d9523 | 2015-09-20 17:20:42 +0200 | [diff] [blame] | 622 | puts("NAND_MODE\n"); |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 623 | mode = "nand0"; |
Michal Simek | 4338035 | 2017-12-01 15:18:24 +0100 | [diff] [blame] | 624 | env_set("modeboot", "nandboot"); |
Michal Simek | 108e184 | 2015-10-05 10:51:12 +0200 | [diff] [blame] | 625 | break; |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 626 | default: |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 627 | mode = ""; |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 628 | printf("Invalid Boot Mode:0x%x\n", bootmode); |
| 629 | break; |
| 630 | } |
| 631 | |
Michal Simek | f183a98 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 632 | if (bootseq >= 0) { |
| 633 | bootseq_len = snprintf(NULL, 0, "%i", bootseq); |
| 634 | debug("Bootseq len: %x\n", bootseq_len); |
| 635 | } |
| 636 | |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 637 | /* |
| 638 | * One terminating char + one byte for space between mode |
| 639 | * and default boot_targets |
| 640 | */ |
Siva Durga Prasad Paladugu | 245c556 | 2017-12-20 16:35:06 +0530 | [diff] [blame] | 641 | env_targets = env_get("boot_targets"); |
Michal Simek | 7410b14 | 2018-04-25 11:10:34 +0200 | [diff] [blame] | 642 | if (env_targets) |
| 643 | env_targets_len = strlen(env_targets); |
| 644 | |
Michal Simek | f183a98 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 645 | new_targets = calloc(1, strlen(mode) + env_targets_len + 2 + |
| 646 | bootseq_len); |
Michal Simek | 089b84d | 2018-06-13 09:42:41 +0200 | [diff] [blame] | 647 | if (!new_targets) |
| 648 | return -ENOMEM; |
Michal Simek | 7410b14 | 2018-04-25 11:10:34 +0200 | [diff] [blame] | 649 | |
Michal Simek | f183a98 | 2018-04-25 11:20:43 +0200 | [diff] [blame] | 650 | if (bootseq >= 0) |
| 651 | sprintf(new_targets, "%s%x %s", mode, bootseq, |
| 652 | env_targets ? env_targets : ""); |
| 653 | else |
| 654 | sprintf(new_targets, "%s %s", mode, |
| 655 | env_targets ? env_targets : ""); |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 656 | |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 657 | env_set("boot_targets", new_targets); |
Michal Simek | ecfb6dc | 2016-04-22 14:28:54 +0200 | [diff] [blame] | 658 | |
Michal Simek | 29b9b71 | 2018-05-17 14:06:06 +0200 | [diff] [blame] | 659 | reset_reason(); |
| 660 | |
Michal Simek | 04b7e62 | 2015-01-15 10:01:51 +0100 | [diff] [blame] | 661 | return 0; |
| 662 | } |
Michal Simek | 342edfe | 2018-12-20 09:33:38 +0100 | [diff] [blame] | 663 | #endif |
Siva Durga Prasad Paladugu | 650e0a3 | 2015-08-04 13:01:05 +0530 | [diff] [blame] | 664 | |
| 665 | int checkboard(void) |
| 666 | { |
Michal Simek | 47ce936 | 2016-01-25 11:04:21 +0100 | [diff] [blame] | 667 | puts("Board: Xilinx ZynqMP\n"); |
Siva Durga Prasad Paladugu | 650e0a3 | 2015-08-04 13:01:05 +0530 | [diff] [blame] | 668 | return 0; |
| 669 | } |