Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 5 | */ |
| 6 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 7 | #include <debug.h> |
Soren Brinkmann | e5bdcaa | 2016-06-22 09:02:56 -0700 | [diff] [blame] | 8 | #include <generic_delay_timer.h> |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 9 | #include <mmio.h> |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 10 | #include <platform.h> |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 11 | #include <stdbool.h> |
| 12 | #include <string.h> |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 13 | #include <xlat_tables.h> |
| 14 | #include "../zynqmp_private.h" |
Siva Durga Prasad Paladugu | 00ae6c5 | 2017-02-20 17:55:50 +0530 | [diff] [blame] | 15 | #include "pm_api_sys.h" |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 16 | |
| 17 | /* |
| 18 | * Table of regions to map using the MMU. |
| 19 | * This doesn't include TZRAM as the 'mem_layout' argument passed to |
| 20 | * configure_mmu_elx() will give the available subset of that, |
| 21 | */ |
| 22 | const mmap_region_t plat_arm_mmap[] = { |
| 23 | { DEVICE0_BASE, DEVICE0_BASE, DEVICE0_SIZE, MT_DEVICE | MT_RW | MT_SECURE }, |
| 24 | { DEVICE1_BASE, DEVICE1_BASE, DEVICE1_SIZE, MT_DEVICE | MT_RW | MT_SECURE }, |
| 25 | { CRF_APB_BASE, CRF_APB_BASE, CRF_APB_SIZE, MT_DEVICE | MT_RW | MT_SECURE }, |
| 26 | {0} |
| 27 | }; |
| 28 | |
| 29 | static unsigned int zynqmp_get_silicon_ver(void) |
| 30 | { |
Soren Brinkmann | 8586399 | 2016-09-16 10:34:47 -0700 | [diff] [blame] | 31 | static unsigned int ver; |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 32 | |
Soren Brinkmann | 8586399 | 2016-09-16 10:34:47 -0700 | [diff] [blame] | 33 | if (!ver) { |
| 34 | ver = mmio_read_32(ZYNQMP_CSU_BASEADDR + |
| 35 | ZYNQMP_CSU_VERSION_OFFSET); |
| 36 | ver &= ZYNQMP_SILICON_VER_MASK; |
| 37 | ver >>= ZYNQMP_SILICON_VER_SHIFT; |
| 38 | } |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 39 | |
| 40 | return ver; |
| 41 | } |
| 42 | |
| 43 | unsigned int zynqmp_get_uart_clk(void) |
| 44 | { |
| 45 | unsigned int ver = zynqmp_get_silicon_ver(); |
| 46 | |
| 47 | switch (ver) { |
| 48 | case ZYNQMP_CSU_VERSION_VELOCE: |
| 49 | return 48000; |
| 50 | case ZYNQMP_CSU_VERSION_EP108: |
| 51 | return 25000000; |
| 52 | case ZYNQMP_CSU_VERSION_QEMU: |
| 53 | return 133000000; |
Jonathan Wright | ff957ed | 2018-03-14 15:24:00 +0000 | [diff] [blame] | 54 | default: |
| 55 | /* Do nothing in default case */ |
| 56 | break; |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | return 100000000; |
| 60 | } |
| 61 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 62 | #if LOG_LEVEL >= LOG_LEVEL_NOTICE |
| 63 | static const struct { |
| 64 | unsigned int id; |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 65 | unsigned int ver; |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 66 | char *name; |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 67 | bool evexists; |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 68 | } zynqmp_devices[] = { |
| 69 | { |
| 70 | .id = 0x10, |
| 71 | .name = "3EG", |
| 72 | }, |
| 73 | { |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 74 | .id = 0x10, |
| 75 | .ver = 0x2c, |
| 76 | .name = "3CG", |
| 77 | }, |
| 78 | { |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 79 | .id = 0x11, |
| 80 | .name = "2EG", |
| 81 | }, |
| 82 | { |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 83 | .id = 0x11, |
| 84 | .ver = 0x2c, |
| 85 | .name = "2CG", |
| 86 | }, |
| 87 | { |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 88 | .id = 0x20, |
| 89 | .name = "5EV", |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 90 | .evexists = true, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 91 | }, |
| 92 | { |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 93 | .id = 0x20, |
| 94 | .ver = 0x100, |
| 95 | .name = "5EG", |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 96 | .evexists = true, |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 97 | }, |
| 98 | { |
| 99 | .id = 0x20, |
| 100 | .ver = 0x12c, |
| 101 | .name = "5CG", |
| 102 | }, |
| 103 | { |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 104 | .id = 0x21, |
| 105 | .name = "4EV", |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 106 | .evexists = true, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 107 | }, |
| 108 | { |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 109 | .id = 0x21, |
| 110 | .ver = 0x100, |
| 111 | .name = "4EG", |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 112 | .evexists = true, |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 113 | }, |
| 114 | { |
| 115 | .id = 0x21, |
| 116 | .ver = 0x12c, |
| 117 | .name = "4CG", |
| 118 | }, |
| 119 | { |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 120 | .id = 0x30, |
| 121 | .name = "7EV", |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 122 | .evexists = true, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 123 | }, |
| 124 | { |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 125 | .id = 0x30, |
| 126 | .ver = 0x100, |
| 127 | .name = "7EG", |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 128 | .evexists = true, |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 129 | }, |
| 130 | { |
| 131 | .id = 0x30, |
| 132 | .ver = 0x12c, |
| 133 | .name = "7CG", |
| 134 | }, |
| 135 | { |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 136 | .id = 0x38, |
| 137 | .name = "9EG", |
| 138 | }, |
| 139 | { |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 140 | .id = 0x38, |
| 141 | .ver = 0x2c, |
| 142 | .name = "9CG", |
| 143 | }, |
| 144 | { |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 145 | .id = 0x39, |
| 146 | .name = "6EG", |
| 147 | }, |
| 148 | { |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 149 | .id = 0x39, |
| 150 | .ver = 0x2c, |
| 151 | .name = "6CG", |
| 152 | }, |
| 153 | { |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 154 | .id = 0x40, |
| 155 | .name = "11EG", |
| 156 | }, |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 157 | { /* For testing purpose only */ |
| 158 | .id = 0x50, |
| 159 | .ver = 0x2c, |
| 160 | .name = "15CG", |
| 161 | }, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 162 | { |
| 163 | .id = 0x50, |
| 164 | .name = "15EG", |
| 165 | }, |
| 166 | { |
| 167 | .id = 0x58, |
| 168 | .name = "19EG", |
| 169 | }, |
| 170 | { |
| 171 | .id = 0x59, |
| 172 | .name = "17EG", |
| 173 | }, |
Siva Durga Prasad Paladugu | 19d69c0 | 2017-06-06 12:54:52 +0530 | [diff] [blame] | 174 | { |
| 175 | .id = 0x60, |
| 176 | .name = "28DR", |
| 177 | }, |
| 178 | { |
| 179 | .id = 0x61, |
| 180 | .name = "21DR", |
| 181 | }, |
| 182 | { |
| 183 | .id = 0x62, |
| 184 | .name = "29DR", |
| 185 | }, |
| 186 | { |
| 187 | .id = 0x63, |
| 188 | .name = "23DR", |
| 189 | }, |
| 190 | { |
| 191 | .id = 0x64, |
| 192 | .name = "27DR", |
| 193 | }, |
| 194 | { |
| 195 | .id = 0x65, |
| 196 | .name = "25DR", |
| 197 | }, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 198 | }; |
| 199 | |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 200 | #define ZYNQMP_PL_STATUS_BIT 9 |
| 201 | #define ZYNQMP_PL_STATUS_MASK BIT(ZYNQMP_PL_STATUS_BIT) |
| 202 | #define ZYNQMP_CSU_VERSION_MASK ~(ZYNQMP_PL_STATUS_MASK) |
| 203 | |
| 204 | static char *zynqmp_get_silicon_idcode_name(void) |
Soren Brinkmann | cb36681 | 2016-09-22 12:21:11 -0700 | [diff] [blame] | 205 | { |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 206 | uint32_t id, ver, chipid[2]; |
| 207 | size_t i, j, len; |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 208 | const char *name = "EG/EV"; |
Soren Brinkmann | cb36681 | 2016-09-22 12:21:11 -0700 | [diff] [blame] | 209 | |
Siva Durga Prasad Paladugu | 6a8933c | 2018-06-20 17:03:57 +0530 | [diff] [blame] | 210 | #ifdef IMAGE_BL32 |
| 211 | /* |
| 212 | * For BL32, get the chip id info directly by reading corresponding |
| 213 | * registers instead of making pm call. This has limitation |
| 214 | * that these registers should be configured to have access |
| 215 | * from APU which is default case. |
| 216 | */ |
| 217 | chipid[0] = mmio_read_32(ZYNQMP_CSU_BASEADDR + ZYNQMP_CSU_IDCODE_OFFSET); |
| 218 | chipid[1] = mmio_read_32(EFUSE_BASEADDR + EFUSE_IPDISABLE_OFFSET); |
| 219 | #else |
| 220 | if (pm_get_chipid(chipid) != PM_RET_SUCCESS) |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 221 | return "UNKN"; |
Siva Durga Prasad Paladugu | 6a8933c | 2018-06-20 17:03:57 +0530 | [diff] [blame] | 222 | #endif |
Soren Brinkmann | cb36681 | 2016-09-22 12:21:11 -0700 | [diff] [blame] | 223 | |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 224 | id = chipid[0] & (ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | |
| 225 | ZYNQMP_CSU_IDCODE_SVD_MASK); |
Soren Brinkmann | cb36681 | 2016-09-22 12:21:11 -0700 | [diff] [blame] | 226 | id >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 227 | ver = chipid[1] >> ZYNQMP_EFUSE_IPDISABLE_SHIFT; |
Soren Brinkmann | cb36681 | 2016-09-22 12:21:11 -0700 | [diff] [blame] | 228 | |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 229 | for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) { |
| 230 | if (zynqmp_devices[i].id == id && |
| 231 | zynqmp_devices[i].ver == (ver & ZYNQMP_CSU_VERSION_MASK)) |
| 232 | break; |
| 233 | } |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 234 | |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 235 | if (i >= ARRAY_SIZE(zynqmp_devices)) |
| 236 | return "UNKN"; |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 237 | |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 238 | if (!zynqmp_devices[i].evexists) |
| 239 | return zynqmp_devices[i].name; |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 240 | |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 241 | if (ver & ZYNQMP_PL_STATUS_MASK) |
| 242 | return zynqmp_devices[i].name; |
Siva Durga Prasad Paladugu | 83e3725 | 2018-05-01 11:10:25 +0530 | [diff] [blame] | 243 | |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 244 | len = strlen(zynqmp_devices[i].name) - 2; |
| 245 | for (j = 0; j < strlen(name); j++) { |
| 246 | zynqmp_devices[i].name[len] = name[j]; |
| 247 | len++; |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 248 | } |
Siva Durga Prasad Paladugu | b76656d | 2018-03-05 18:47:15 +0530 | [diff] [blame] | 249 | zynqmp_devices[i].name[len] = '\0'; |
| 250 | |
| 251 | return zynqmp_devices[i].name; |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | static unsigned int zynqmp_get_rtl_ver(void) |
| 255 | { |
| 256 | uint32_t ver; |
| 257 | |
| 258 | ver = mmio_read_32(ZYNQMP_CSU_BASEADDR + ZYNQMP_CSU_VERSION_OFFSET); |
| 259 | ver &= ZYNQMP_RTL_VER_MASK; |
| 260 | ver >>= ZYNQMP_RTL_VER_SHIFT; |
| 261 | |
| 262 | return ver; |
| 263 | } |
| 264 | |
| 265 | static char *zynqmp_print_silicon_idcode(void) |
| 266 | { |
| 267 | uint32_t id, maskid, tmp; |
| 268 | |
| 269 | id = mmio_read_32(ZYNQMP_CSU_BASEADDR + ZYNQMP_CSU_IDCODE_OFFSET); |
| 270 | |
| 271 | tmp = id; |
| 272 | tmp &= ZYNQMP_CSU_IDCODE_XILINX_ID_MASK | |
Soren Brinkmann | 3111413 | 2016-05-20 07:05:00 -0700 | [diff] [blame] | 273 | ZYNQMP_CSU_IDCODE_FAMILY_MASK; |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 274 | maskid = ZYNQMP_CSU_IDCODE_XILINX_ID << ZYNQMP_CSU_IDCODE_XILINX_ID_SHIFT | |
Soren Brinkmann | 3111413 | 2016-05-20 07:05:00 -0700 | [diff] [blame] | 275 | ZYNQMP_CSU_IDCODE_FAMILY << ZYNQMP_CSU_IDCODE_FAMILY_SHIFT; |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 276 | if (tmp != maskid) { |
| 277 | ERROR("Incorrect XILINX IDCODE 0x%x, maskid 0x%x\n", id, maskid); |
| 278 | return "UNKN"; |
| 279 | } |
| 280 | VERBOSE("Xilinx IDCODE 0x%x\n", id); |
| 281 | return zynqmp_get_silicon_idcode_name(); |
| 282 | } |
| 283 | |
| 284 | static unsigned int zynqmp_get_ps_ver(void) |
| 285 | { |
| 286 | uint32_t ver = mmio_read_32(ZYNQMP_CSU_BASEADDR + ZYNQMP_CSU_VERSION_OFFSET); |
| 287 | |
| 288 | ver &= ZYNQMP_PS_VER_MASK; |
| 289 | ver >>= ZYNQMP_PS_VER_SHIFT; |
| 290 | |
| 291 | return ver + 1; |
| 292 | } |
| 293 | |
| 294 | static void zynqmp_print_platform_name(void) |
| 295 | { |
| 296 | unsigned int ver = zynqmp_get_silicon_ver(); |
| 297 | unsigned int rtl = zynqmp_get_rtl_ver(); |
| 298 | char *label = "Unknown"; |
| 299 | |
| 300 | switch (ver) { |
| 301 | case ZYNQMP_CSU_VERSION_VELOCE: |
| 302 | label = "VELOCE"; |
| 303 | break; |
| 304 | case ZYNQMP_CSU_VERSION_EP108: |
| 305 | label = "EP108"; |
| 306 | break; |
| 307 | case ZYNQMP_CSU_VERSION_QEMU: |
| 308 | label = "QEMU"; |
| 309 | break; |
| 310 | case ZYNQMP_CSU_VERSION_SILICON: |
| 311 | label = "silicon"; |
| 312 | break; |
Jonathan Wright | ff957ed | 2018-03-14 15:24:00 +0000 | [diff] [blame] | 313 | default: |
| 314 | /* Do nothing in default case */ |
| 315 | break; |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 316 | } |
| 317 | |
Siva Durga Prasad Paladugu | 40808bc | 2018-04-30 19:43:03 +0530 | [diff] [blame] | 318 | NOTICE("ATF running on XCZU%s/%s v%d/RTL%d.%d at 0x%x\n", |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 319 | zynqmp_print_silicon_idcode(), label, zynqmp_get_ps_ver(), |
Siva Durga Prasad Paladugu | 40808bc | 2018-04-30 19:43:03 +0530 | [diff] [blame] | 320 | (rtl & 0xf0) >> 4, rtl & 0xf, BL31_BASE); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 321 | } |
| 322 | #else |
| 323 | static inline void zynqmp_print_platform_name(void) { } |
| 324 | #endif |
| 325 | |
Soren Brinkmann | b43d943 | 2016-04-18 11:49:42 -0700 | [diff] [blame] | 326 | unsigned int zynqmp_get_bootmode(void) |
| 327 | { |
Siva Durga Prasad Paladugu | 00ae6c5 | 2017-02-20 17:55:50 +0530 | [diff] [blame] | 328 | uint32_t r; |
Siva Durga Prasad Paladugu | 40808bc | 2018-04-30 19:43:03 +0530 | [diff] [blame] | 329 | unsigned int ret; |
Siva Durga Prasad Paladugu | 00ae6c5 | 2017-02-20 17:55:50 +0530 | [diff] [blame] | 330 | |
Siva Durga Prasad Paladugu | 40808bc | 2018-04-30 19:43:03 +0530 | [diff] [blame] | 331 | ret = pm_mmio_read(CRL_APB_BOOT_MODE_USER, &r); |
| 332 | |
| 333 | if (ret != PM_RET_SUCCESS) |
Siva Durga Prasad Paladugu | 00ae6c5 | 2017-02-20 17:55:50 +0530 | [diff] [blame] | 334 | r = mmio_read_32(CRL_APB_BOOT_MODE_USER); |
Soren Brinkmann | b43d943 | 2016-04-18 11:49:42 -0700 | [diff] [blame] | 335 | |
| 336 | return r & CRL_APB_BOOT_MODE_MASK; |
| 337 | } |
| 338 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 339 | void zynqmp_config_setup(void) |
| 340 | { |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 341 | zynqmp_print_platform_name(); |
Soren Brinkmann | e5bdcaa | 2016-06-22 09:02:56 -0700 | [diff] [blame] | 342 | generic_delay_timer_init(); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 343 | } |
| 344 | |
Antonio Nino Diaz | e82e29c | 2016-05-19 10:00:28 +0100 | [diff] [blame] | 345 | unsigned int plat_get_syscnt_freq2(void) |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 346 | { |
Soren Brinkmann | cfcb1a2 | 2016-09-16 10:31:06 -0700 | [diff] [blame] | 347 | unsigned int ver = zynqmp_get_silicon_ver(); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 348 | |
Soren Brinkmann | cfcb1a2 | 2016-09-16 10:31:06 -0700 | [diff] [blame] | 349 | switch (ver) { |
| 350 | case ZYNQMP_CSU_VERSION_VELOCE: |
| 351 | return 10000; |
| 352 | case ZYNQMP_CSU_VERSION_EP108: |
| 353 | return 4000000; |
| 354 | case ZYNQMP_CSU_VERSION_QEMU: |
| 355 | return 50000000; |
Jonathan Wright | ff957ed | 2018-03-14 15:24:00 +0000 | [diff] [blame] | 356 | default: |
| 357 | /* Do nothing in default case */ |
| 358 | break; |
Soren Brinkmann | cfcb1a2 | 2016-09-16 10:31:06 -0700 | [diff] [blame] | 359 | } |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 360 | |
Soren Brinkmann | cfcb1a2 | 2016-09-16 10:31:06 -0700 | [diff] [blame] | 361 | return mmio_read_32(IOU_SCNTRS_BASEFREQ); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 362 | } |