Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * (C) Copyright 2014 - 2018 Xilinx, Inc. |
Michal Simek | a8c9436 | 2023-07-10 14:35:49 +0200 | [diff] [blame] | 4 | * Michal Simek <michal.simek@amd.com> |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
Algapally Santosh Sagar | 3c351b2 | 2023-01-19 22:36:16 -0700 | [diff] [blame] | 7 | #include <command.h> |
Simon Glass | afb0215 | 2019-12-28 10:45:01 -0700 | [diff] [blame] | 8 | #include <cpu_func.h> |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 9 | #include <env.h> |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 10 | #include <fdtdec.h> |
Simon Glass | a7b5130 | 2019-11-14 12:57:46 -0700 | [diff] [blame] | 11 | #include <init.h> |
Ashok Reddy Soma | fb6b3cd | 2021-02-23 08:07:46 -0700 | [diff] [blame] | 12 | #include <env_internal.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 13 | #include <log.h> |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 14 | #include <malloc.h> |
Simon Glass | 495a5dc | 2019-11-14 12:57:30 -0700 | [diff] [blame] | 15 | #include <time.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 16 | #include <asm/cache.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 17 | #include <asm/global_data.h> |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 18 | #include <asm/io.h> |
| 19 | #include <asm/arch/hardware.h> |
Michal Simek | 21eb5cc | 2019-04-29 09:39:09 -0700 | [diff] [blame] | 20 | #include <asm/arch/sys_proto.h> |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 21 | #include <dm/device.h> |
| 22 | #include <dm/uclass.h> |
Siva Durga Prasad Paladugu | b739897 | 2019-08-05 15:54:59 +0530 | [diff] [blame] | 23 | #include <versalpl.h> |
Michal Simek | 705d44a | 2020-03-31 12:39:37 +0200 | [diff] [blame] | 24 | #include "../common/board.h" |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 25 | |
| 26 | DECLARE_GLOBAL_DATA_PTR; |
| 27 | |
Siva Durga Prasad Paladugu | b739897 | 2019-08-05 15:54:59 +0530 | [diff] [blame] | 28 | #if defined(CONFIG_FPGA_VERSALPL) |
Oleksandr Suvorov | dae95a4 | 2022-07-22 17:16:04 +0300 | [diff] [blame] | 29 | static xilinx_desc versalpl = { |
| 30 | xilinx_versal, csu_dma, 1, &versal_op, 0, &versal_op, NULL, |
| 31 | FPGA_LEGACY |
| 32 | }; |
Siva Durga Prasad Paladugu | b739897 | 2019-08-05 15:54:59 +0530 | [diff] [blame] | 33 | #endif |
| 34 | |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 35 | int board_init(void) |
| 36 | { |
| 37 | printf("EL Level:\tEL%d\n", current_el()); |
| 38 | |
Siva Durga Prasad Paladugu | b739897 | 2019-08-05 15:54:59 +0530 | [diff] [blame] | 39 | #if defined(CONFIG_FPGA_VERSALPL) |
| 40 | fpga_init(); |
| 41 | fpga_add(fpga_xilinx, &versalpl); |
| 42 | #endif |
| 43 | |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 44 | if (CONFIG_IS_ENABLED(DM_I2C) && CONFIG_IS_ENABLED(I2C_EEPROM)) |
| 45 | xilinx_read_eeprom(); |
| 46 | |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 47 | return 0; |
| 48 | } |
| 49 | |
| 50 | int board_early_init_r(void) |
| 51 | { |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 52 | u32 val; |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 53 | |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 54 | if (current_el() != 3) |
| 55 | return 0; |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 56 | |
Michal Simek | f56f7d1 | 2019-01-28 11:12:41 +0100 | [diff] [blame] | 57 | debug("iou_switch ctrl div0 %x\n", |
| 58 | readl(&crlapb_base->iou_switch_ctrl)); |
| 59 | |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 60 | writel(IOU_SWITCH_CTRL_CLKACT_BIT | |
Michal Simek | f56f7d1 | 2019-01-28 11:12:41 +0100 | [diff] [blame] | 61 | (CONFIG_IOU_SWITCH_DIVISOR0 << IOU_SWITCH_CTRL_DIVISOR0_SHIFT), |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 62 | &crlapb_base->iou_switch_ctrl); |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 63 | |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 64 | /* Global timer init - Program time stamp reference clk */ |
| 65 | val = readl(&crlapb_base->timestamp_ref_ctrl); |
| 66 | val |= CRL_APB_TIMESTAMP_REF_CTRL_CLKACT_BIT; |
| 67 | writel(val, &crlapb_base->timestamp_ref_ctrl); |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 68 | |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 69 | debug("ref ctrl 0x%x\n", |
| 70 | readl(&crlapb_base->timestamp_ref_ctrl)); |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 71 | |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 72 | /* Clear reset of timestamp reg */ |
| 73 | writel(0, &crlapb_base->rst_timestamp); |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 74 | |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 75 | /* |
| 76 | * Program freq register in System counter and |
| 77 | * enable system counter. |
| 78 | */ |
Peng Fan | 4b3a182 | 2022-04-13 17:47:17 +0800 | [diff] [blame] | 79 | writel(CONFIG_COUNTER_FREQUENCY, |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 80 | &iou_scntr_secure->base_frequency_id_register); |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 81 | |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 82 | debug("counter val 0x%x\n", |
| 83 | readl(&iou_scntr_secure->base_frequency_id_register)); |
| 84 | |
| 85 | writel(IOU_SCNTRS_CONTROL_EN, |
| 86 | &iou_scntr_secure->counter_control_register); |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 87 | |
Michal Simek | 19f6c97 | 2019-01-28 11:08:00 +0100 | [diff] [blame] | 88 | debug("scntrs control 0x%x\n", |
| 89 | readl(&iou_scntr_secure->counter_control_register)); |
| 90 | debug("timer 0x%llx\n", get_ticks()); |
| 91 | debug("timer 0x%llx\n", get_ticks()); |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 92 | |
| 93 | return 0; |
| 94 | } |
| 95 | |
Ashok Reddy Soma | 6c19105 | 2022-05-05 23:53:45 -0600 | [diff] [blame] | 96 | unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, |
| 97 | char *const argv[]) |
| 98 | { |
| 99 | int ret = 0; |
| 100 | |
| 101 | if (current_el() > 1) { |
| 102 | smp_kick_all_cpus(); |
| 103 | dcache_disable(); |
| 104 | armv8_switch_to_el1(0x0, 0, 0, 0, (unsigned long)entry, |
| 105 | ES_TO_AARCH64); |
| 106 | } else { |
| 107 | printf("FAIL: current EL is not above EL1\n"); |
| 108 | ret = EINVAL; |
| 109 | } |
| 110 | return ret; |
| 111 | } |
| 112 | |
Michal Simek | 9c91e61 | 2020-04-08 11:04:41 +0200 | [diff] [blame] | 113 | static u8 versal_get_bootmode(void) |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 114 | { |
Michal Simek | 9c91e61 | 2020-04-08 11:04:41 +0200 | [diff] [blame] | 115 | u8 bootmode; |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 116 | u32 reg = 0; |
Michal Simek | 9c91e61 | 2020-04-08 11:04:41 +0200 | [diff] [blame] | 117 | |
| 118 | reg = readl(&crp_base->boot_mode_usr); |
| 119 | |
| 120 | if (reg >> BOOT_MODE_ALT_SHIFT) |
| 121 | reg >>= BOOT_MODE_ALT_SHIFT; |
| 122 | |
| 123 | bootmode = reg & BOOT_MODES_MASK; |
| 124 | |
| 125 | return bootmode; |
| 126 | } |
| 127 | |
Michal Simek | b163476 | 2023-09-05 13:30:07 +0200 | [diff] [blame] | 128 | static int boot_targets_setup(void) |
Michal Simek | 9c91e61 | 2020-04-08 11:04:41 +0200 | [diff] [blame] | 129 | { |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 130 | u8 bootmode; |
| 131 | struct udevice *dev; |
| 132 | int bootseq = -1; |
| 133 | int bootseq_len = 0; |
| 134 | int env_targets_len = 0; |
Venkatesh Yadav Abbarapu | e5dd04a | 2023-09-04 08:50:34 +0530 | [diff] [blame] | 135 | const char *mode = NULL; |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 136 | char *new_targets; |
| 137 | char *env_targets; |
| 138 | |
Michal Simek | 9c91e61 | 2020-04-08 11:04:41 +0200 | [diff] [blame] | 139 | bootmode = versal_get_bootmode(); |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 140 | |
| 141 | puts("Bootmode: "); |
| 142 | switch (bootmode) { |
T Karthik Reddy | facca9a | 2019-07-11 16:07:57 +0530 | [diff] [blame] | 143 | case USB_MODE: |
| 144 | puts("USB_MODE\n"); |
T Karthik Reddy | 1104faf | 2021-03-30 23:24:57 -0600 | [diff] [blame] | 145 | mode = "usb_dfu0 usb_dfu1"; |
T Karthik Reddy | facca9a | 2019-07-11 16:07:57 +0530 | [diff] [blame] | 146 | break; |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 147 | case JTAG_MODE: |
| 148 | puts("JTAG_MODE\n"); |
Siva Durga Prasad Paladugu | 00784e0 | 2019-06-25 17:13:14 +0530 | [diff] [blame] | 149 | mode = "jtag pxe dhcp"; |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 150 | break; |
| 151 | case QSPI_MODE_24BIT: |
| 152 | puts("QSPI_MODE_24\n"); |
Venkatesh Yadav Abbarapu | bf6e041 | 2024-05-10 08:22:38 +0200 | [diff] [blame] | 153 | if (uclass_get_device_by_name(UCLASS_SPI, |
| 154 | "spi@f1030000", &dev)) { |
| 155 | debug("QSPI driver for QSPI device is not present\n"); |
| 156 | break; |
| 157 | } |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 158 | mode = "xspi0"; |
| 159 | break; |
| 160 | case QSPI_MODE_32BIT: |
| 161 | puts("QSPI_MODE_32\n"); |
Venkatesh Yadav Abbarapu | bf6e041 | 2024-05-10 08:22:38 +0200 | [diff] [blame] | 162 | if (uclass_get_device_by_name(UCLASS_SPI, |
| 163 | "spi@f1030000", &dev)) { |
| 164 | debug("QSPI driver for QSPI device is not present\n"); |
| 165 | break; |
| 166 | } |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 167 | mode = "xspi0"; |
| 168 | break; |
| 169 | case OSPI_MODE: |
| 170 | puts("OSPI_MODE\n"); |
Venkatesh Yadav Abbarapu | bf6e041 | 2024-05-10 08:22:38 +0200 | [diff] [blame] | 171 | if (uclass_get_device_by_name(UCLASS_SPI, |
| 172 | "spi@f1010000", &dev)) { |
| 173 | debug("OSPI driver for OSPI device is not present\n"); |
| 174 | break; |
| 175 | } |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 176 | mode = "xspi0"; |
| 177 | break; |
| 178 | case EMMC_MODE: |
| 179 | puts("EMMC_MODE\n"); |
T Karthik Reddy | bc2b964 | 2019-12-16 04:44:26 -0700 | [diff] [blame] | 180 | if (uclass_get_device_by_name(UCLASS_MMC, |
T Karthik Reddy | a12445f | 2021-11-18 12:57:20 +0100 | [diff] [blame] | 181 | "mmc@f1050000", &dev) && |
| 182 | uclass_get_device_by_name(UCLASS_MMC, |
T Karthik Reddy | bc2b964 | 2019-12-16 04:44:26 -0700 | [diff] [blame] | 183 | "sdhci@f1050000", &dev)) { |
Venkatesh Yadav Abbarapu | e5dd04a | 2023-09-04 08:50:34 +0530 | [diff] [blame] | 184 | debug("SD1 driver for SD1 device is not present\n"); |
| 185 | break; |
T Karthik Reddy | bc2b964 | 2019-12-16 04:44:26 -0700 | [diff] [blame] | 186 | } |
Simon Glass | 75e534b | 2020-12-16 21:20:07 -0700 | [diff] [blame] | 187 | debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev)); |
T Karthik Reddy | bc2b964 | 2019-12-16 04:44:26 -0700 | [diff] [blame] | 188 | mode = "mmc"; |
Simon Glass | 75e534b | 2020-12-16 21:20:07 -0700 | [diff] [blame] | 189 | bootseq = dev_seq(dev); |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 190 | break; |
Polak, Leszek | cddfc13 | 2023-10-08 14:34:42 +0000 | [diff] [blame] | 191 | case SELECTMAP_MODE: |
| 192 | puts("SELECTMAP_MODE\n"); |
| 193 | break; |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 194 | case SD_MODE: |
| 195 | puts("SD_MODE\n"); |
| 196 | if (uclass_get_device_by_name(UCLASS_MMC, |
T Karthik Reddy | a12445f | 2021-11-18 12:57:20 +0100 | [diff] [blame] | 197 | "mmc@f1040000", &dev) && |
| 198 | uclass_get_device_by_name(UCLASS_MMC, |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 199 | "sdhci@f1040000", &dev)) { |
Venkatesh Yadav Abbarapu | e5dd04a | 2023-09-04 08:50:34 +0530 | [diff] [blame] | 200 | debug("SD0 driver for SD0 device is not present\n"); |
| 201 | break; |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 202 | } |
Simon Glass | 75e534b | 2020-12-16 21:20:07 -0700 | [diff] [blame] | 203 | debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev)); |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 204 | |
| 205 | mode = "mmc"; |
Simon Glass | 75e534b | 2020-12-16 21:20:07 -0700 | [diff] [blame] | 206 | bootseq = dev_seq(dev); |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 207 | break; |
| 208 | case SD1_LSHFT_MODE: |
| 209 | puts("LVL_SHFT_"); |
| 210 | /* fall through */ |
| 211 | case SD_MODE1: |
| 212 | puts("SD_MODE1\n"); |
| 213 | if (uclass_get_device_by_name(UCLASS_MMC, |
T Karthik Reddy | a12445f | 2021-11-18 12:57:20 +0100 | [diff] [blame] | 214 | "mmc@f1050000", &dev) && |
| 215 | uclass_get_device_by_name(UCLASS_MMC, |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 216 | "sdhci@f1050000", &dev)) { |
Venkatesh Yadav Abbarapu | e5dd04a | 2023-09-04 08:50:34 +0530 | [diff] [blame] | 217 | debug("SD1 driver for SD1 device is not present\n"); |
| 218 | break; |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 219 | } |
Simon Glass | 75e534b | 2020-12-16 21:20:07 -0700 | [diff] [blame] | 220 | debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev)); |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 221 | |
| 222 | mode = "mmc"; |
Simon Glass | 75e534b | 2020-12-16 21:20:07 -0700 | [diff] [blame] | 223 | bootseq = dev_seq(dev); |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 224 | break; |
| 225 | default: |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 226 | printf("Invalid Boot Mode:0x%x\n", bootmode); |
| 227 | break; |
| 228 | } |
| 229 | |
Venkatesh Yadav Abbarapu | e5dd04a | 2023-09-04 08:50:34 +0530 | [diff] [blame] | 230 | if (mode) { |
| 231 | if (bootseq >= 0) { |
| 232 | bootseq_len = snprintf(NULL, 0, "%i", bootseq); |
| 233 | debug("Bootseq len: %x\n", bootseq_len); |
| 234 | } |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 235 | |
Venkatesh Yadav Abbarapu | e5dd04a | 2023-09-04 08:50:34 +0530 | [diff] [blame] | 236 | /* |
| 237 | * One terminating char + one byte for space between mode |
| 238 | * and default boot_targets |
| 239 | */ |
| 240 | env_targets = env_get("boot_targets"); |
| 241 | if (env_targets) |
| 242 | env_targets_len = strlen(env_targets); |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 243 | |
Venkatesh Yadav Abbarapu | e5dd04a | 2023-09-04 08:50:34 +0530 | [diff] [blame] | 244 | new_targets = calloc(1, strlen(mode) + env_targets_len + 2 + |
| 245 | bootseq_len); |
| 246 | if (!new_targets) |
| 247 | return -ENOMEM; |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 248 | |
Venkatesh Yadav Abbarapu | e5dd04a | 2023-09-04 08:50:34 +0530 | [diff] [blame] | 249 | if (bootseq >= 0) |
| 250 | sprintf(new_targets, "%s%x %s", mode, bootseq, |
| 251 | env_targets ? env_targets : ""); |
| 252 | else |
| 253 | sprintf(new_targets, "%s %s", mode, |
| 254 | env_targets ? env_targets : ""); |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 255 | |
Venkatesh Yadav Abbarapu | e5dd04a | 2023-09-04 08:50:34 +0530 | [diff] [blame] | 256 | env_set("boot_targets", new_targets); |
| 257 | } |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 258 | |
Michal Simek | b163476 | 2023-09-05 13:30:07 +0200 | [diff] [blame] | 259 | return 0; |
| 260 | } |
| 261 | |
| 262 | int board_late_init(void) |
| 263 | { |
| 264 | int ret; |
| 265 | |
| 266 | if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { |
| 267 | debug("Saved variables - Skipping\n"); |
| 268 | return 0; |
| 269 | } |
| 270 | |
| 271 | if (!IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) |
| 272 | return 0; |
| 273 | |
| 274 | if (IS_ENABLED(CONFIG_DISTRO_DEFAULTS)) { |
| 275 | ret = boot_targets_setup(); |
| 276 | if (ret) |
| 277 | return ret; |
| 278 | } |
| 279 | |
Michal Simek | 705d44a | 2020-03-31 12:39:37 +0200 | [diff] [blame] | 280 | return board_late_init_xilinx(); |
Siva Durga Prasad Paladugu | 37c2ff8 | 2019-01-31 17:28:14 +0530 | [diff] [blame] | 281 | } |
| 282 | |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 283 | int dram_init_banksize(void) |
| 284 | { |
Michal Simek | 21eb5cc | 2019-04-29 09:39:09 -0700 | [diff] [blame] | 285 | int ret; |
| 286 | |
| 287 | ret = fdtdec_setup_memory_banksize(); |
| 288 | if (ret) |
| 289 | return ret; |
| 290 | |
| 291 | mem_map_fill(); |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 292 | |
| 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | int dram_init(void) |
| 297 | { |
Michal Simek | 9134d4c | 2020-07-10 12:42:09 +0200 | [diff] [blame] | 298 | if (fdtdec_setup_mem_size_base_lowest() != 0) |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 299 | return -EINVAL; |
| 300 | |
| 301 | return 0; |
| 302 | } |
| 303 | |
Harald Seiler | 6f14d5f | 2020-12-15 16:47:52 +0100 | [diff] [blame] | 304 | void reset_cpu(void) |
Michal Simek | 4b066a1 | 2018-08-22 14:55:27 +0200 | [diff] [blame] | 305 | { |
| 306 | } |
Ashok Reddy Soma | fb6b3cd | 2021-02-23 08:07:46 -0700 | [diff] [blame] | 307 | |
Michal Simek | f3a541f | 2024-03-22 12:43:17 +0100 | [diff] [blame] | 308 | #if defined(CONFIG_ENV_IS_NOWHERE) |
Ashok Reddy Soma | fb6b3cd | 2021-02-23 08:07:46 -0700 | [diff] [blame] | 309 | enum env_location env_get_location(enum env_operation op, int prio) |
| 310 | { |
| 311 | u32 bootmode = versal_get_bootmode(); |
| 312 | |
| 313 | if (prio) |
| 314 | return ENVL_UNKNOWN; |
| 315 | |
| 316 | switch (bootmode) { |
| 317 | case EMMC_MODE: |
| 318 | case SD_MODE: |
| 319 | case SD1_LSHFT_MODE: |
| 320 | case SD_MODE1: |
| 321 | if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT)) |
| 322 | return ENVL_FAT; |
| 323 | if (IS_ENABLED(CONFIG_ENV_IS_IN_EXT4)) |
| 324 | return ENVL_EXT4; |
T Karthik Reddy | 6f8b205 | 2021-11-24 12:16:55 +0100 | [diff] [blame] | 325 | return ENVL_NOWHERE; |
Ashok Reddy Soma | fb6b3cd | 2021-02-23 08:07:46 -0700 | [diff] [blame] | 326 | case OSPI_MODE: |
| 327 | case QSPI_MODE_24BIT: |
| 328 | case QSPI_MODE_32BIT: |
| 329 | if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH)) |
| 330 | return ENVL_SPI_FLASH; |
T Karthik Reddy | 6f8b205 | 2021-11-24 12:16:55 +0100 | [diff] [blame] | 331 | return ENVL_NOWHERE; |
Ashok Reddy Soma | fb6b3cd | 2021-02-23 08:07:46 -0700 | [diff] [blame] | 332 | case JTAG_MODE: |
Polak, Leszek | cddfc13 | 2023-10-08 14:34:42 +0000 | [diff] [blame] | 333 | case SELECTMAP_MODE: |
Ashok Reddy Soma | fb6b3cd | 2021-02-23 08:07:46 -0700 | [diff] [blame] | 334 | default: |
| 335 | return ENVL_NOWHERE; |
| 336 | } |
| 337 | } |
Michal Simek | f3a541f | 2024-03-22 12:43:17 +0100 | [diff] [blame] | 338 | #endif |