Lines Matching full:core

78  *   Single-Core mode : AM62x, AM62A SoCs
92 * @is_single_core: flag to denote if SoC/IP has only single core R5
116 * struct k3_r5_core - K3 R5 core structure
119 * @rproc: rproc handle representing this core
156 * @core: cached pointer to r5 core structure being used
166 struct k3_r5_core *core; member
179 * and we let remoteproc core handle it.
235 static int k3_r5_split_reset(struct k3_r5_core *core) in k3_r5_split_reset() argument
239 ret = reset_control_assert(core->reset); in k3_r5_split_reset()
241 dev_err(core->dev, "local-reset assert failed, ret = %d\n", in k3_r5_split_reset()
246 ret = core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_split_reset()
247 core->ti_sci_id); in k3_r5_split_reset()
249 dev_err(core->dev, "module-reset assert failed, ret = %d\n", in k3_r5_split_reset()
251 if (reset_control_deassert(core->reset)) in k3_r5_split_reset()
252 dev_warn(core->dev, "local-reset deassert back failed\n"); in k3_r5_split_reset()
258 static int k3_r5_split_release(struct k3_r5_core *core) in k3_r5_split_release() argument
262 ret = core->ti_sci->ops.dev_ops.get_device(core->ti_sci, in k3_r5_split_release()
263 core->ti_sci_id); in k3_r5_split_release()
265 dev_err(core->dev, "module-reset deassert failed, ret = %d\n", in k3_r5_split_release()
270 ret = reset_control_deassert(core->reset); in k3_r5_split_release()
272 dev_err(core->dev, "local-reset deassert failed, ret = %d\n", in k3_r5_split_release()
274 if (core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_split_release()
275 core->ti_sci_id)) in k3_r5_split_release()
276 dev_warn(core->dev, "module-reset assert back failed\n"); in k3_r5_split_release()
284 struct k3_r5_core *core; in k3_r5_lockstep_reset() local
288 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
289 ret = reset_control_assert(core->reset); in k3_r5_lockstep_reset()
291 dev_err(core->dev, "local-reset assert failed, ret = %d\n", in k3_r5_lockstep_reset()
293 core = list_prev_entry(core, elem); in k3_r5_lockstep_reset()
299 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
300 ret = core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_lockstep_reset()
301 core->ti_sci_id); in k3_r5_lockstep_reset()
303 dev_err(core->dev, "module-reset assert failed, ret = %d\n", in k3_r5_lockstep_reset()
312 list_for_each_entry_continue_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
313 if (core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_lockstep_reset()
314 core->ti_sci_id)) in k3_r5_lockstep_reset()
315 dev_warn(core->dev, "module-reset assert back failed\n"); in k3_r5_lockstep_reset()
317 core = list_last_entry(&cluster->cores, struct k3_r5_core, elem); in k3_r5_lockstep_reset()
319 list_for_each_entry_from_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
320 if (reset_control_deassert(core->reset)) in k3_r5_lockstep_reset()
321 dev_warn(core->dev, "local-reset deassert back failed\n"); in k3_r5_lockstep_reset()
329 struct k3_r5_core *core; in k3_r5_lockstep_release() local
333 list_for_each_entry_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
334 ret = core->ti_sci->ops.dev_ops.get_device(core->ti_sci, in k3_r5_lockstep_release()
335 core->ti_sci_id); in k3_r5_lockstep_release()
337 dev_err(core->dev, "module-reset deassert failed, ret = %d\n", in k3_r5_lockstep_release()
339 core = list_next_entry(core, elem); in k3_r5_lockstep_release()
345 list_for_each_entry_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
346 ret = reset_control_deassert(core->reset); in k3_r5_lockstep_release()
348 dev_err(core->dev, "module-reset deassert failed, ret = %d\n", in k3_r5_lockstep_release()
357 list_for_each_entry_continue(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
358 if (reset_control_assert(core->reset)) in k3_r5_lockstep_release()
359 dev_warn(core->dev, "local-reset assert back failed\n"); in k3_r5_lockstep_release()
361 core = list_first_entry(&cluster->cores, struct k3_r5_core, elem); in k3_r5_lockstep_release()
363 list_for_each_entry_from(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
364 if (core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_lockstep_release()
365 core->ti_sci_id)) in k3_r5_lockstep_release()
366 dev_warn(core->dev, "module-reset assert back failed\n"); in k3_r5_lockstep_release()
372 static inline int k3_r5_core_halt(struct k3_r5_core *core) in k3_r5_core_halt() argument
374 return ti_sci_proc_set_control(core->tsp, in k3_r5_core_halt()
378 static inline int k3_r5_core_run(struct k3_r5_core *core) in k3_r5_core_run() argument
380 return ti_sci_proc_set_control(core->tsp, in k3_r5_core_run()
427 * invoked by remoteproc core before any firmware loading, and is followed
433 * private to each core. Only Core0 needs to be unhalted for running the
442 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_prepare() local
449 ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl, &stat); in k3_r5_rproc_prepare()
457 k3_r5_lockstep_release(cluster) : k3_r5_split_release(core); in k3_r5_rproc_prepare()
476 * Zero out both TCMs unconditionally (access from v8 Arm core is not in k3_r5_rproc_prepare()
481 memset(core->mem[0].cpu_addr, 0x00, core->mem[0].size); in k3_r5_rproc_prepare()
484 memset(core->mem[1].cpu_addr, 0x00, core->mem[1].size); in k3_r5_rproc_prepare()
495 * .unprepare() ops is invoked by the remoteproc core after the remoteproc is
509 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_unprepare() local
516 k3_r5_lockstep_reset(cluster) : k3_r5_split_reset(core); in k3_r5_rproc_unprepare()
525 * 1. Configure the boot vector for R5F core(s)
526 * 2. Unhalt/Run the R5F core(s)
545 struct k3_r5_core *core; in k3_r5_rproc_start() local
555 dev_dbg(dev, "booting R5F core using boot addr = 0x%x\n", boot_addr); in k3_r5_rproc_start()
558 core = kproc->core; in k3_r5_rproc_start()
559 ret = ti_sci_proc_set_config(core->tsp, boot_addr, 0, 0); in k3_r5_rproc_start()
565 list_for_each_entry_reverse(core, &cluster->cores, elem) { in k3_r5_rproc_start()
566 ret = k3_r5_core_run(core); in k3_r5_rproc_start()
571 ret = k3_r5_core_run(core); in k3_r5_rproc_start()
579 list_for_each_entry_continue(core, &cluster->cores, elem) { in k3_r5_rproc_start()
580 if (k3_r5_core_halt(core)) in k3_r5_rproc_start()
581 dev_warn(core->dev, "core halt back failed\n"); in k3_r5_rproc_start()
590 * 1. Halt R5F core(s)
604 * core is running, but is needed to make sure the core won't run after
616 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_stop() local
621 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_rproc_stop()
622 ret = k3_r5_core_halt(core); in k3_r5_rproc_stop()
624 core = list_prev_entry(core, elem); in k3_r5_rproc_stop()
629 ret = k3_r5_core_halt(core); in k3_r5_rproc_stop()
639 list_for_each_entry_from_reverse(core, &cluster->cores, elem) { in k3_r5_rproc_stop()
640 if (k3_r5_core_run(core)) in k3_r5_rproc_stop()
641 dev_warn(core->dev, "core run back failed\n"); in k3_r5_rproc_stop()
665 dev_info(dev, "R5F core initialized in IPC-only mode\n"); in k3_r5_rproc_attach()
683 dev_info(dev, "R5F core deinitialized in IPC-only mode\n"); in k3_r5_rproc_detach()
725 * either by the remoteproc core for loading, or by any rpmsg bus drivers.
730 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_da_to_va() local
741 for (i = 0; i < core->num_mems; i++) { in k3_r5_rproc_da_to_va()
742 bus_addr = core->mem[i].bus_addr; in k3_r5_rproc_da_to_va()
743 dev_addr = core->mem[i].dev_addr; in k3_r5_rproc_da_to_va()
744 size = core->mem[i].size; in k3_r5_rproc_da_to_va()
749 va = core->mem[i].cpu_addr + offset; in k3_r5_rproc_da_to_va()
756 va = core->mem[i].cpu_addr + offset; in k3_r5_rproc_da_to_va()
762 for (i = 0; i < core->num_sram; i++) { in k3_r5_rproc_da_to_va()
763 dev_addr = core->sram[i].dev_addr; in k3_r5_rproc_da_to_va()
764 size = core->sram[i].size; in k3_r5_rproc_da_to_va()
768 va = core->sram[i].cpu_addr + offset; in k3_r5_rproc_da_to_va()
798 * Internal R5F Core configuration
803 * as an alternate for LockStep mode that exercises only a single R5F core
804 * called Single-CPU mode. Each R5F core has a number of settings to either
805 * enable/disable each of the TCMs, control which TCM appears at the R5F core's
807 * corresponding core are released. These settings are all protected and managed
810 * This function is used to pre-configure these settings for each R5F core, and
836 struct k3_r5_core *core0, *core, *temp; in k3_r5_rproc_configure() local
848 core = core0; in k3_r5_rproc_configure()
850 core = kproc->core; in k3_r5_rproc_configure()
853 ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl, in k3_r5_rproc_configure()
878 if (core == core0) { in k3_r5_rproc_configure()
901 if (core->atcm_enable) in k3_r5_rproc_configure()
906 if (core->btcm_enable) in k3_r5_rproc_configure()
911 if (core->loczrama) in k3_r5_rproc_configure()
927 if (temp != core) { in k3_r5_rproc_configure()
939 ret = ti_sci_proc_set_config(core->tsp, boot_vec, in k3_r5_rproc_configure()
942 ret = k3_r5_core_halt(core); in k3_r5_rproc_configure()
946 ret = ti_sci_proc_set_config(core->tsp, boot_vec, in k3_r5_rproc_configure()
1058 * Each R5F core within a typical R5FSS instance has a total of 64 KB of TCMs,
1073 struct k3_r5_core *core = kproc->core; in k3_r5_adjust_tcm_sizes() local
1074 struct device *cdev = core->dev; in k3_r5_adjust_tcm_sizes()
1084 if (core == core0) { in k3_r5_adjust_tcm_sizes()
1085 WARN_ON(core->mem[0].size != SZ_64K); in k3_r5_adjust_tcm_sizes()
1086 WARN_ON(core->mem[1].size != SZ_64K); in k3_r5_adjust_tcm_sizes()
1088 core->mem[0].size /= 2; in k3_r5_adjust_tcm_sizes()
1089 core->mem[1].size /= 2; in k3_r5_adjust_tcm_sizes()
1092 core->mem[0].size, core->mem[1].size); in k3_r5_adjust_tcm_sizes()
1097 * This function checks and configures a R5F core for IPC-only or remoteproc
1098 * mode. The driver is configured to be in IPC-only mode for a R5F core when
1099 * the core has been loaded and started by a bootloader. The IPC-only mode is
1101 * and ensuring that the core is running. Any incomplete steps at bootloader
1112 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_configure_mode() local
1113 struct device *cdev = core->dev; in k3_r5_rproc_configure_mode()
1124 ret = core->ti_sci->ops.dev_ops.is_on(core->ti_sci, core->ti_sci_id, in k3_r5_rproc_configure_mode()
1132 …dev_warn(cdev, "R5F core may have been powered on by a different host, programmed state (%d) != ac… in k3_r5_rproc_configure_mode()
1136 ret = reset_control_status(core->reset); in k3_r5_rproc_configure_mode()
1143 ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl, in k3_r5_rproc_configure_mode()
1165 * be deasserted and R5F core to be unhalted. Local reset status is in k3_r5_rproc_configure_mode()
1193 /* fixup TCMs, cluster & core flags to actual values in IPC-only mode */ in k3_r5_rproc_configure_mode()
1195 if (core == core0) in k3_r5_rproc_configure_mode()
1197 core->atcm_enable = atcm_enable; in k3_r5_rproc_configure_mode()
1198 core->btcm_enable = btcm_enable; in k3_r5_rproc_configure_mode()
1199 core->loczrama = loczrama; in k3_r5_rproc_configure_mode()
1200 core->mem[0].dev_addr = loczrama ? 0 : K3_R5_TCM_DEV_ADDR; in k3_r5_rproc_configure_mode()
1201 core->mem[1].dev_addr = loczrama ? K3_R5_TCM_DEV_ADDR : 0; in k3_r5_rproc_configure_mode()
1212 struct k3_r5_core *core, *core1; in k3_r5_cluster_rproc_init() local
1219 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_cluster_rproc_init()
1220 cdev = core->dev; in k3_r5_cluster_rproc_init()
1242 kproc->core = core; in k3_r5_cluster_rproc_init()
1245 core->rproc = rproc; in k3_r5_cluster_rproc_init()
1277 * single core mode in k3_r5_cluster_rproc_init()
1302 core->rproc = NULL; in k3_r5_cluster_rproc_init()
1305 if (cluster->mode == CLUSTER_MODE_SPLIT && core == core1) { in k3_r5_cluster_rproc_init()
1306 core = list_prev_entry(core, elem); in k3_r5_cluster_rproc_init()
1307 rproc = core->rproc; in k3_r5_cluster_rproc_init()
1318 struct k3_r5_core *core; in k3_r5_cluster_rproc_exit() local
1324 * with first core, whereas split-mode has two rprocs associated with in k3_r5_cluster_rproc_exit()
1325 * each core, and requires that core1 be powered down first in k3_r5_cluster_rproc_exit()
1327 core = (cluster->mode == CLUSTER_MODE_LOCKSTEP || in k3_r5_cluster_rproc_exit()
1332 list_for_each_entry_from_reverse(core, &cluster->cores, elem) { in k3_r5_cluster_rproc_exit()
1333 rproc = core->rproc; in k3_r5_cluster_rproc_exit()
1349 core->rproc = NULL; in k3_r5_cluster_rproc_exit()
1354 struct k3_r5_core *core) in k3_r5_core_of_get_internal_memories() argument
1363 core->mem = devm_kcalloc(dev, num_mems, sizeof(*core->mem), GFP_KERNEL); in k3_r5_core_of_get_internal_memories()
1364 if (!core->mem) in k3_r5_core_of_get_internal_memories()
1390 core->mem[i].cpu_addr = devm_ioremap_wc(dev, res->start, in k3_r5_core_of_get_internal_memories()
1392 if (!core->mem[i].cpu_addr) { in k3_r5_core_of_get_internal_memories()
1396 core->mem[i].bus_addr = res->start; in k3_r5_core_of_get_internal_memories()
1407 core->mem[i].dev_addr = core->loczrama ? in k3_r5_core_of_get_internal_memories()
1410 core->mem[i].dev_addr = core->loczrama ? in k3_r5_core_of_get_internal_memories()
1413 core->mem[i].size = resource_size(res); in k3_r5_core_of_get_internal_memories()
1416 mem_names[i], &core->mem[i].bus_addr, in k3_r5_core_of_get_internal_memories()
1417 core->mem[i].size, core->mem[i].cpu_addr, in k3_r5_core_of_get_internal_memories()
1418 core->mem[i].dev_addr); in k3_r5_core_of_get_internal_memories()
1420 core->num_mems = num_mems; in k3_r5_core_of_get_internal_memories()
1426 struct k3_r5_core *core) in k3_r5_core_of_get_sram_memories() argument
1442 core->sram = devm_kcalloc(dev, num_sram, sizeof(*core->sram), GFP_KERNEL); in k3_r5_core_of_get_sram_memories()
1443 if (!core->sram) in k3_r5_core_of_get_sram_memories()
1461 core->sram[i].bus_addr = res.start; in k3_r5_core_of_get_sram_memories()
1462 core->sram[i].dev_addr = res.start; in k3_r5_core_of_get_sram_memories()
1463 core->sram[i].size = resource_size(&res); in k3_r5_core_of_get_sram_memories()
1464 core->sram[i].cpu_addr = devm_ioremap_wc(dev, res.start, in k3_r5_core_of_get_sram_memories()
1466 if (!core->sram[i].cpu_addr) { in k3_r5_core_of_get_sram_memories()
1473 i, &core->sram[i].bus_addr, in k3_r5_core_of_get_sram_memories()
1474 core->sram[i].size, core->sram[i].cpu_addr, in k3_r5_core_of_get_sram_memories()
1475 core->sram[i].dev_addr); in k3_r5_core_of_get_sram_memories()
1477 core->num_sram = num_sram; in k3_r5_core_of_get_sram_memories()
1512 struct k3_r5_core *core; in k3_r5_core_of_init() local
1518 core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); in k3_r5_core_of_init()
1519 if (!core) { in k3_r5_core_of_init()
1524 core->dev = dev; in k3_r5_core_of_init()
1529 core->atcm_enable = 0; in k3_r5_core_of_init()
1530 core->btcm_enable = 1; in k3_r5_core_of_init()
1531 core->loczrama = 1; in k3_r5_core_of_init()
1533 ret = of_property_read_u32(np, "ti,atcm-enable", &core->atcm_enable); in k3_r5_core_of_init()
1540 ret = of_property_read_u32(np, "ti,btcm-enable", &core->btcm_enable); in k3_r5_core_of_init()
1547 ret = of_property_read_u32(np, "ti,loczrama", &core->loczrama); in k3_r5_core_of_init()
1553 core->ti_sci = devm_ti_sci_get_by_phandle(dev, "ti,sci"); in k3_r5_core_of_init()
1554 if (IS_ERR(core->ti_sci)) { in k3_r5_core_of_init()
1555 ret = PTR_ERR(core->ti_sci); in k3_r5_core_of_init()
1560 core->ti_sci = NULL; in k3_r5_core_of_init()
1564 ret = of_property_read_u32(np, "ti,sci-dev-id", &core->ti_sci_id); in k3_r5_core_of_init()
1570 core->reset = devm_reset_control_get_exclusive(dev, NULL); in k3_r5_core_of_init()
1571 if (IS_ERR_OR_NULL(core->reset)) { in k3_r5_core_of_init()
1572 ret = PTR_ERR_OR_ZERO(core->reset); in k3_r5_core_of_init()
1582 core->tsp = k3_r5_core_of_get_tsp(dev, core->ti_sci); in k3_r5_core_of_init()
1583 if (IS_ERR(core->tsp)) { in k3_r5_core_of_init()
1584 ret = PTR_ERR(core->tsp); in k3_r5_core_of_init()
1590 ret = k3_r5_core_of_get_internal_memories(pdev, core); in k3_r5_core_of_init()
1597 ret = k3_r5_core_of_get_sram_memories(pdev, core); in k3_r5_core_of_init()
1603 ret = ti_sci_proc_request(core->tsp); in k3_r5_core_of_init()
1609 platform_set_drvdata(pdev, core); in k3_r5_core_of_init()
1625 struct k3_r5_core *core = platform_get_drvdata(pdev); in k3_r5_core_of_exit() local
1629 ret = ti_sci_proc_release(core->tsp); in k3_r5_core_of_exit()
1641 struct k3_r5_core *core, *temp; in k3_r5_cluster_of_exit() local
1643 list_for_each_entry_safe_reverse(core, temp, &cluster->cores, elem) { in k3_r5_cluster_of_exit()
1644 list_del(&core->elem); in k3_r5_cluster_of_exit()
1645 cpdev = to_platform_device(core->dev); in k3_r5_cluster_of_exit()
1657 struct k3_r5_core *core; in k3_r5_cluster_of_init() local
1664 dev_err(dev, "could not get R5 core platform device\n"); in k3_r5_cluster_of_init()
1678 core = platform_get_drvdata(cpdev); in k3_r5_cluster_of_init()
1680 list_add_tail(&core->elem, &cluster->cores); in k3_r5_cluster_of_init()
1726 * Single core on AM62x in k3_r5_probe()
1750 dev_err(dev, "SoC supports only single core R5 but num_cores is set to %d\n", in k3_r5_probe()