Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * J721E: SoC specific initialization |
| 4 | * |
| 5 | * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/ |
| 6 | * Lokesh Vutla <lokeshvutla@ti.com> |
| 7 | */ |
| 8 | |
| 9 | #include <common.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 10 | #include <init.h> |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 11 | #include <spl.h> |
| 12 | #include <asm/io.h> |
| 13 | #include <asm/armv7_mpu.h> |
Lokesh Vutla | 6edde29 | 2019-06-13 10:29:43 +0530 | [diff] [blame] | 14 | #include <asm/arch/hardware.h> |
Andreas Dannenberg | 5e1782c | 2019-06-13 10:29:47 +0530 | [diff] [blame] | 15 | #include <asm/arch/sysfw-loader.h> |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 16 | #include "common.h" |
Lokesh Vutla | 96c11f4 | 2019-06-13 10:29:46 +0530 | [diff] [blame] | 17 | #include <asm/arch/sys_proto.h> |
| 18 | #include <linux/soc/ti/ti_sci_protocol.h> |
Andreas Dannenberg | 5e1782c | 2019-06-13 10:29:47 +0530 | [diff] [blame] | 19 | #include <dm.h> |
| 20 | #include <dm/uclass-internal.h> |
| 21 | #include <dm/pinctrl.h> |
Faiz Abbas | 6839321 | 2020-02-26 13:44:36 +0530 | [diff] [blame] | 22 | #include <mmc.h> |
Keerthy | 7007adc | 2020-02-12 13:55:04 +0530 | [diff] [blame] | 23 | #include <remoteproc.h> |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 24 | |
| 25 | #ifdef CONFIG_SPL_BUILD |
Andrew F. Davis | f0bcb66 | 2020-01-10 14:35:21 -0500 | [diff] [blame] | 26 | #ifdef CONFIG_K3_LOAD_SYSFW |
| 27 | #ifdef CONFIG_TI_SECURE_DEVICE |
| 28 | struct fwl_data cbass_hc_cfg0_fwls[] = { |
| 29 | { "PCIE0_CFG", 2560, 8 }, |
| 30 | { "PCIE1_CFG", 2561, 8 }, |
| 31 | { "USB3SS0_CORE", 2568, 4 }, |
| 32 | { "USB3SS1_CORE", 2570, 4 }, |
| 33 | { "EMMC8SS0_CFG", 2576, 4 }, |
| 34 | { "UFS_HCI0_CFG", 2580, 4 }, |
| 35 | { "SERDES0", 2584, 1 }, |
| 36 | { "SERDES1", 2585, 1 }, |
| 37 | }, cbass_hc0_fwls[] = { |
| 38 | { "PCIE0_HP", 2528, 24 }, |
| 39 | { "PCIE0_LP", 2529, 24 }, |
| 40 | { "PCIE1_HP", 2530, 24 }, |
| 41 | { "PCIE1_LP", 2531, 24 }, |
| 42 | }, cbass_rc_cfg0_fwls[] = { |
| 43 | { "EMMCSD4SS0_CFG", 2380, 4 }, |
| 44 | }, cbass_rc0_fwls[] = { |
| 45 | { "GPMC0", 2310, 8 }, |
| 46 | }, infra_cbass0_fwls[] = { |
| 47 | { "PLL_MMR0", 8, 26 }, |
| 48 | { "CTRL_MMR0", 9, 16 }, |
| 49 | }, mcu_cbass0_fwls[] = { |
| 50 | { "MCU_R5FSS0_CORE0", 1024, 4 }, |
| 51 | { "MCU_R5FSS0_CORE0_CFG", 1025, 2 }, |
| 52 | { "MCU_R5FSS0_CORE1", 1028, 4 }, |
| 53 | { "MCU_FSS0_CFG", 1032, 12 }, |
| 54 | { "MCU_FSS0_S1", 1033, 8 }, |
| 55 | { "MCU_FSS0_S0", 1036, 8 }, |
| 56 | { "MCU_PSROM49152X32", 1048, 1 }, |
| 57 | { "MCU_MSRAM128KX64", 1050, 8 }, |
| 58 | { "MCU_CTRL_MMR0", 1200, 8 }, |
| 59 | { "MCU_PLL_MMR0", 1201, 3 }, |
| 60 | { "MCU_CPSW0", 1220, 2 }, |
| 61 | }, wkup_cbass0_fwls[] = { |
| 62 | { "WKUP_CTRL_MMR0", 131, 16 }, |
| 63 | }; |
| 64 | #endif |
| 65 | #endif |
| 66 | |
Andreas Dannenberg | 660aa46 | 2019-06-13 10:29:44 +0530 | [diff] [blame] | 67 | static void mmr_unlock(u32 base, u32 partition) |
| 68 | { |
| 69 | /* Translate the base address */ |
| 70 | phys_addr_t part_base = base + partition * CTRL_MMR0_PARTITION_SIZE; |
| 71 | |
| 72 | /* Unlock the requested partition if locked using two-step sequence */ |
| 73 | writel(CTRLMMR_LOCK_KICK0_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK0); |
| 74 | writel(CTRLMMR_LOCK_KICK1_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK1); |
| 75 | } |
| 76 | |
| 77 | static void ctrl_mmr_unlock(void) |
| 78 | { |
| 79 | /* Unlock all WKUP_CTRL_MMR0 module registers */ |
| 80 | mmr_unlock(WKUP_CTRL_MMR0_BASE, 0); |
| 81 | mmr_unlock(WKUP_CTRL_MMR0_BASE, 1); |
| 82 | mmr_unlock(WKUP_CTRL_MMR0_BASE, 2); |
| 83 | mmr_unlock(WKUP_CTRL_MMR0_BASE, 3); |
| 84 | mmr_unlock(WKUP_CTRL_MMR0_BASE, 4); |
| 85 | mmr_unlock(WKUP_CTRL_MMR0_BASE, 6); |
| 86 | mmr_unlock(WKUP_CTRL_MMR0_BASE, 7); |
| 87 | |
| 88 | /* Unlock all MCU_CTRL_MMR0 module registers */ |
| 89 | mmr_unlock(MCU_CTRL_MMR0_BASE, 0); |
| 90 | mmr_unlock(MCU_CTRL_MMR0_BASE, 1); |
| 91 | mmr_unlock(MCU_CTRL_MMR0_BASE, 2); |
| 92 | mmr_unlock(MCU_CTRL_MMR0_BASE, 3); |
| 93 | mmr_unlock(MCU_CTRL_MMR0_BASE, 4); |
| 94 | |
| 95 | /* Unlock all CTRL_MMR0 module registers */ |
| 96 | mmr_unlock(CTRL_MMR0_BASE, 0); |
| 97 | mmr_unlock(CTRL_MMR0_BASE, 1); |
| 98 | mmr_unlock(CTRL_MMR0_BASE, 2); |
| 99 | mmr_unlock(CTRL_MMR0_BASE, 3); |
| 100 | mmr_unlock(CTRL_MMR0_BASE, 4); |
| 101 | mmr_unlock(CTRL_MMR0_BASE, 5); |
| 102 | mmr_unlock(CTRL_MMR0_BASE, 6); |
| 103 | mmr_unlock(CTRL_MMR0_BASE, 7); |
| 104 | } |
| 105 | |
Faiz Abbas | 6839321 | 2020-02-26 13:44:36 +0530 | [diff] [blame] | 106 | #if defined(CONFIG_K3_LOAD_SYSFW) |
| 107 | void k3_mmc_stop_clock(void) |
| 108 | { |
| 109 | if (spl_boot_device() == BOOT_DEVICE_MMC1) { |
| 110 | struct mmc *mmc = find_mmc_device(0); |
| 111 | |
| 112 | if (!mmc) |
| 113 | return; |
| 114 | |
| 115 | mmc->saved_clock = mmc->clock; |
| 116 | mmc_set_clock(mmc, 0, true); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | void k3_mmc_restart_clock(void) |
| 121 | { |
| 122 | if (spl_boot_device() == BOOT_DEVICE_MMC1) { |
| 123 | struct mmc *mmc = find_mmc_device(0); |
| 124 | |
| 125 | if (!mmc) |
| 126 | return; |
| 127 | |
| 128 | mmc_set_clock(mmc, mmc->saved_clock, false); |
| 129 | } |
| 130 | } |
| 131 | #endif |
| 132 | |
Andreas Dannenberg | b826741 | 2019-06-13 10:29:45 +0530 | [diff] [blame] | 133 | /* |
| 134 | * This uninitialized global variable would normal end up in the .bss section, |
| 135 | * but the .bss is cleared between writing and reading this variable, so move |
| 136 | * it to the .data section. |
| 137 | */ |
| 138 | u32 bootindex __attribute__((section(".data"))); |
| 139 | |
| 140 | static void store_boot_index_from_rom(void) |
| 141 | { |
| 142 | bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX); |
| 143 | } |
| 144 | |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 145 | void board_init_f(ulong dummy) |
| 146 | { |
Lokesh Vutla | edfb5de | 2019-10-07 19:26:38 +0530 | [diff] [blame] | 147 | #if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW) |
Andreas Dannenberg | 5e1782c | 2019-06-13 10:29:47 +0530 | [diff] [blame] | 148 | struct udevice *dev; |
| 149 | int ret; |
| 150 | #endif |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 151 | /* |
Andreas Dannenberg | b826741 | 2019-06-13 10:29:45 +0530 | [diff] [blame] | 152 | * Cannot delay this further as there is a chance that |
| 153 | * K3_BOOT_PARAM_TABLE_INDEX can be over written by SPL MALLOC section. |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 154 | */ |
Andreas Dannenberg | b826741 | 2019-06-13 10:29:45 +0530 | [diff] [blame] | 155 | store_boot_index_from_rom(); |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 156 | |
Andreas Dannenberg | 660aa46 | 2019-06-13 10:29:44 +0530 | [diff] [blame] | 157 | /* Make all control module registers accessible */ |
| 158 | ctrl_mmr_unlock(); |
| 159 | |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 160 | #ifdef CONFIG_CPU_V7R |
Lokesh Vutla | 5fbd6fe | 2019-12-31 15:49:55 +0530 | [diff] [blame] | 161 | disable_linefill_optimization(); |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 162 | setup_k3_mpu_regions(); |
| 163 | #endif |
| 164 | |
| 165 | /* Init DM early */ |
| 166 | spl_early_init(); |
| 167 | |
Andreas Dannenberg | 5e1782c | 2019-06-13 10:29:47 +0530 | [diff] [blame] | 168 | #ifdef CONFIG_K3_LOAD_SYSFW |
| 169 | /* |
| 170 | * Process pinctrl for the serial0 a.k.a. MCU_UART0 module and continue |
| 171 | * regardless of the result of pinctrl. Do this without probing the |
| 172 | * device, but instead by searching the device that would request the |
| 173 | * given sequence number if probed. The UART will be used by the system |
| 174 | * firmware (SYSFW) image for various purposes and SYSFW depends on us |
| 175 | * to initialize its pin settings. |
| 176 | */ |
| 177 | ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, true, &dev); |
| 178 | if (!ret) |
| 179 | pinctrl_select_state(dev, "default"); |
| 180 | |
| 181 | /* |
| 182 | * Load, start up, and configure system controller firmware. Provide |
| 183 | * the U-Boot console init function to the SYSFW post-PM configuration |
| 184 | * callback hook, effectively switching on (or over) the console |
| 185 | * output. |
| 186 | */ |
Faiz Abbas | 6839321 | 2020-02-26 13:44:36 +0530 | [diff] [blame] | 187 | k3_sysfw_loader(k3_mmc_stop_clock, k3_mmc_restart_clock); |
| 188 | |
| 189 | /* Prepare console output */ |
| 190 | preloader_console_init(); |
Andrew F. Davis | f0bcb66 | 2020-01-10 14:35:21 -0500 | [diff] [blame] | 191 | |
| 192 | /* Disable ROM configured firewalls right after loading sysfw */ |
| 193 | #ifdef CONFIG_TI_SECURE_DEVICE |
| 194 | remove_fwl_configs(cbass_hc_cfg0_fwls, ARRAY_SIZE(cbass_hc_cfg0_fwls)); |
| 195 | remove_fwl_configs(cbass_hc0_fwls, ARRAY_SIZE(cbass_hc0_fwls)); |
| 196 | remove_fwl_configs(cbass_rc_cfg0_fwls, ARRAY_SIZE(cbass_rc_cfg0_fwls)); |
| 197 | remove_fwl_configs(cbass_rc0_fwls, ARRAY_SIZE(cbass_rc0_fwls)); |
| 198 | remove_fwl_configs(infra_cbass0_fwls, ARRAY_SIZE(infra_cbass0_fwls)); |
| 199 | remove_fwl_configs(mcu_cbass0_fwls, ARRAY_SIZE(mcu_cbass0_fwls)); |
| 200 | remove_fwl_configs(wkup_cbass0_fwls, ARRAY_SIZE(wkup_cbass0_fwls)); |
| 201 | #endif |
Andreas Dannenberg | 5e1782c | 2019-06-13 10:29:47 +0530 | [diff] [blame] | 202 | #else |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 203 | /* Prepare console output */ |
| 204 | preloader_console_init(); |
Andreas Dannenberg | 5e1782c | 2019-06-13 10:29:47 +0530 | [diff] [blame] | 205 | #endif |
Lokesh Vutla | edfb5de | 2019-10-07 19:26:38 +0530 | [diff] [blame] | 206 | |
Lokesh Vutla | 5fafe44 | 2020-03-10 16:50:58 +0530 | [diff] [blame] | 207 | /* Output System Firmware version info */ |
| 208 | k3_sysfw_print_ver(); |
| 209 | |
Andreas Dannenberg | d036a21 | 2020-01-07 13:15:54 +0530 | [diff] [blame] | 210 | /* Perform EEPROM-based board detection */ |
Lokesh Vutla | 5a08e65 | 2020-08-05 22:44:14 +0530 | [diff] [blame^] | 211 | if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) |
| 212 | do_board_detect(); |
Andreas Dannenberg | d036a21 | 2020-01-07 13:15:54 +0530 | [diff] [blame] | 213 | |
Keerthy | 0b01f66 | 2019-10-24 15:00:53 +0530 | [diff] [blame] | 214 | #if defined(CONFIG_CPU_V7R) && defined(CONFIG_K3_AVS0) |
| 215 | ret = uclass_get_device_by_driver(UCLASS_MISC, DM_GET_DRIVER(k3_avs), |
| 216 | &dev); |
| 217 | if (ret) |
| 218 | printf("AVS init failed: %d\n", ret); |
| 219 | #endif |
| 220 | |
Lokesh Vutla | edfb5de | 2019-10-07 19:26:38 +0530 | [diff] [blame] | 221 | #if defined(CONFIG_K3_J721E_DDRSS) |
| 222 | ret = uclass_get_device(UCLASS_RAM, 0, &dev); |
| 223 | if (ret) |
| 224 | panic("DRAM init failed: %d\n", ret); |
| 225 | #endif |
Jan Kiszka | 7ce99f7 | 2020-05-18 07:57:22 +0200 | [diff] [blame] | 226 | spl_enable_dcache(); |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 227 | } |
Lokesh Vutla | 6edde29 | 2019-06-13 10:29:43 +0530 | [diff] [blame] | 228 | |
Harald Seiler | 0bf7ab1 | 2020-04-15 11:33:30 +0200 | [diff] [blame] | 229 | u32 spl_mmc_boot_mode(const u32 boot_device) |
Lokesh Vutla | 6edde29 | 2019-06-13 10:29:43 +0530 | [diff] [blame] | 230 | { |
| 231 | switch (boot_device) { |
| 232 | case BOOT_DEVICE_MMC1: |
| 233 | return MMCSD_MODE_EMMCBOOT; |
| 234 | case BOOT_DEVICE_MMC2: |
| 235 | return MMCSD_MODE_FS; |
| 236 | default: |
| 237 | return MMCSD_MODE_RAW; |
| 238 | } |
| 239 | } |
| 240 | |
Andreas Dannenberg | ee0f5e6 | 2020-05-16 21:05:01 +0530 | [diff] [blame] | 241 | static u32 __get_backup_bootmedia(u32 main_devstat) |
| 242 | { |
| 243 | u32 bkup_boot = (main_devstat & MAIN_DEVSTAT_BKUP_BOOTMODE_MASK) >> |
| 244 | MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT; |
| 245 | |
| 246 | switch (bkup_boot) { |
| 247 | case BACKUP_BOOT_DEVICE_USB: |
| 248 | return BOOT_DEVICE_DFU; |
| 249 | case BACKUP_BOOT_DEVICE_UART: |
| 250 | return BOOT_DEVICE_UART; |
| 251 | case BACKUP_BOOT_DEVICE_ETHERNET: |
| 252 | return BOOT_DEVICE_ETHERNET; |
| 253 | case BACKUP_BOOT_DEVICE_MMC2: |
| 254 | { |
| 255 | u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >> |
| 256 | MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT; |
| 257 | if (port == 0x0) |
| 258 | return BOOT_DEVICE_MMC1; |
| 259 | return BOOT_DEVICE_MMC2; |
| 260 | } |
| 261 | case BACKUP_BOOT_DEVICE_SPI: |
| 262 | return BOOT_DEVICE_SPI; |
| 263 | case BACKUP_BOOT_DEVICE_I2C: |
| 264 | return BOOT_DEVICE_I2C; |
| 265 | } |
| 266 | |
| 267 | return BOOT_DEVICE_RAM; |
| 268 | } |
| 269 | |
Lokesh Vutla | 6edde29 | 2019-06-13 10:29:43 +0530 | [diff] [blame] | 270 | static u32 __get_primary_bootmedia(u32 main_devstat, u32 wkup_devstat) |
| 271 | { |
| 272 | |
| 273 | u32 bootmode = (wkup_devstat & WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK) >> |
| 274 | WKUP_DEVSTAT_PRIMARY_BOOTMODE_SHIFT; |
| 275 | |
| 276 | bootmode |= (main_devstat & MAIN_DEVSTAT_BOOT_MODE_B_MASK) << |
| 277 | BOOT_MODE_B_SHIFT; |
| 278 | |
| 279 | if (bootmode == BOOT_DEVICE_OSPI || bootmode == BOOT_DEVICE_QSPI) |
| 280 | bootmode = BOOT_DEVICE_SPI; |
| 281 | |
| 282 | if (bootmode == BOOT_DEVICE_MMC2) { |
| 283 | u32 port = (main_devstat & |
| 284 | MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK) >> |
| 285 | MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT; |
| 286 | if (port == 0x0) |
| 287 | bootmode = BOOT_DEVICE_MMC1; |
| 288 | } |
| 289 | |
| 290 | return bootmode; |
| 291 | } |
| 292 | |
| 293 | u32 spl_boot_device(void) |
| 294 | { |
| 295 | u32 wkup_devstat = readl(CTRLMMR_WKUP_DEVSTAT); |
| 296 | u32 main_devstat; |
| 297 | |
| 298 | if (wkup_devstat & WKUP_DEVSTAT_MCU_OMLY_MASK) { |
| 299 | printf("ERROR: MCU only boot is not yet supported\n"); |
| 300 | return BOOT_DEVICE_RAM; |
| 301 | } |
| 302 | |
| 303 | /* MAIN CTRL MMR can only be read if MCU ONLY is 0 */ |
| 304 | main_devstat = readl(CTRLMMR_MAIN_DEVSTAT); |
| 305 | |
Andreas Dannenberg | ee0f5e6 | 2020-05-16 21:05:01 +0530 | [diff] [blame] | 306 | if (bootindex == K3_PRIMARY_BOOTMODE) |
| 307 | return __get_primary_bootmedia(main_devstat, wkup_devstat); |
| 308 | else |
| 309 | return __get_backup_bootmedia(main_devstat); |
Lokesh Vutla | 6edde29 | 2019-06-13 10:29:43 +0530 | [diff] [blame] | 310 | } |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 311 | #endif |
Lokesh Vutla | 96c11f4 | 2019-06-13 10:29:46 +0530 | [diff] [blame] | 312 | |
| 313 | #ifdef CONFIG_SYS_K3_SPL_ATF |
| 314 | |
| 315 | #define J721E_DEV_MCU_RTI0 262 |
| 316 | #define J721E_DEV_MCU_RTI1 263 |
| 317 | #define J721E_DEV_MCU_ARMSS0_CPU0 250 |
| 318 | #define J721E_DEV_MCU_ARMSS0_CPU1 251 |
| 319 | |
| 320 | void release_resources_for_core_shutdown(void) |
| 321 | { |
| 322 | struct ti_sci_handle *ti_sci; |
| 323 | struct ti_sci_dev_ops *dev_ops; |
| 324 | struct ti_sci_proc_ops *proc_ops; |
| 325 | int ret; |
| 326 | u32 i; |
| 327 | |
| 328 | const u32 put_device_ids[] = { |
| 329 | J721E_DEV_MCU_RTI0, |
| 330 | J721E_DEV_MCU_RTI1, |
| 331 | }; |
| 332 | |
| 333 | ti_sci = get_ti_sci_handle(); |
| 334 | dev_ops = &ti_sci->ops.dev_ops; |
| 335 | proc_ops = &ti_sci->ops.proc_ops; |
| 336 | |
| 337 | /* Iterate through list of devices to put (shutdown) */ |
| 338 | for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) { |
| 339 | u32 id = put_device_ids[i]; |
| 340 | |
| 341 | ret = dev_ops->put_device(ti_sci, id); |
| 342 | if (ret) |
| 343 | panic("Failed to put device %u (%d)\n", id, ret); |
| 344 | } |
| 345 | |
| 346 | const u32 put_core_ids[] = { |
| 347 | J721E_DEV_MCU_ARMSS0_CPU1, |
| 348 | J721E_DEV_MCU_ARMSS0_CPU0, /* Handle CPU0 after CPU1 */ |
| 349 | }; |
| 350 | |
| 351 | /* Iterate through list of cores to put (shutdown) */ |
| 352 | for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) { |
| 353 | u32 id = put_core_ids[i]; |
| 354 | |
| 355 | /* |
| 356 | * Queue up the core shutdown request. Note that this call |
| 357 | * needs to be followed up by an actual invocation of an WFE |
| 358 | * or WFI CPU instruction. |
| 359 | */ |
| 360 | ret = proc_ops->proc_shutdown_no_wait(ti_sci, id); |
| 361 | if (ret) |
| 362 | panic("Failed sending core %u shutdown message (%d)\n", |
| 363 | id, ret); |
| 364 | } |
| 365 | } |
| 366 | #endif |
Keerthy | 7007adc | 2020-02-12 13:55:04 +0530 | [diff] [blame] | 367 | |
| 368 | #ifdef CONFIG_SYS_K3_SPL_ATF |
| 369 | void start_non_linux_remote_cores(void) |
| 370 | { |
| 371 | int size = 0, ret; |
| 372 | u32 loadaddr = 0; |
| 373 | |
| 374 | size = load_firmware("name_mainr5f0_0fw", "addr_mainr5f0_0load", |
| 375 | &loadaddr); |
| 376 | if (size <= 0) |
| 377 | goto err_load; |
| 378 | |
| 379 | /* assuming remoteproc 2 is aliased for the needed remotecore */ |
| 380 | ret = rproc_load(2, loadaddr, size); |
| 381 | if (ret) { |
| 382 | printf("Firmware failed to start on rproc (%d)\n", ret); |
| 383 | goto err_load; |
| 384 | } |
| 385 | |
| 386 | ret = rproc_start(2); |
| 387 | if (ret) { |
| 388 | printf("Firmware init failed on rproc (%d)\n", ret); |
| 389 | goto err_load; |
| 390 | } |
| 391 | |
| 392 | printf("Remoteproc 2 started successfully\n"); |
| 393 | |
| 394 | return; |
| 395 | |
| 396 | err_load: |
| 397 | rproc_reset(2); |
Lokesh Vutla | a228532 | 2019-06-13 10:29:42 +0530 | [diff] [blame] | 398 | } |
| 399 | #endif |