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