Lines Matching refs:core
170 struct k3_r5_core *core; member
247 static int k3_r5_split_reset(struct k3_r5_core *core) in k3_r5_split_reset() argument
251 ret = reset_control_assert(core->reset); in k3_r5_split_reset()
253 dev_err(core->dev, "local-reset assert failed, ret = %d\n", in k3_r5_split_reset()
258 ret = core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_split_reset()
259 core->ti_sci_id); in k3_r5_split_reset()
261 dev_err(core->dev, "module-reset assert failed, ret = %d\n", in k3_r5_split_reset()
263 if (reset_control_deassert(core->reset)) in k3_r5_split_reset()
264 dev_warn(core->dev, "local-reset deassert back failed\n"); in k3_r5_split_reset()
270 static int k3_r5_split_release(struct k3_r5_core *core) in k3_r5_split_release() argument
274 ret = core->ti_sci->ops.dev_ops.get_device(core->ti_sci, in k3_r5_split_release()
275 core->ti_sci_id); in k3_r5_split_release()
277 dev_err(core->dev, "module-reset deassert failed, ret = %d\n", in k3_r5_split_release()
282 ret = reset_control_deassert(core->reset); in k3_r5_split_release()
284 dev_err(core->dev, "local-reset deassert failed, ret = %d\n", in k3_r5_split_release()
286 if (core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_split_release()
287 core->ti_sci_id)) in k3_r5_split_release()
288 dev_warn(core->dev, "module-reset assert back failed\n"); in k3_r5_split_release()
296 struct k3_r5_core *core; in k3_r5_lockstep_reset() local
300 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
301 ret = reset_control_assert(core->reset); in k3_r5_lockstep_reset()
303 dev_err(core->dev, "local-reset assert failed, ret = %d\n", in k3_r5_lockstep_reset()
305 core = list_prev_entry(core, elem); in k3_r5_lockstep_reset()
311 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
312 ret = core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_lockstep_reset()
313 core->ti_sci_id); in k3_r5_lockstep_reset()
315 dev_err(core->dev, "module-reset assert failed, ret = %d\n", in k3_r5_lockstep_reset()
324 list_for_each_entry_continue_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
325 if (core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_lockstep_reset()
326 core->ti_sci_id)) in k3_r5_lockstep_reset()
327 dev_warn(core->dev, "module-reset assert back failed\n"); in k3_r5_lockstep_reset()
329 core = list_last_entry(&cluster->cores, struct k3_r5_core, elem); in k3_r5_lockstep_reset()
331 list_for_each_entry_from_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
332 if (reset_control_deassert(core->reset)) in k3_r5_lockstep_reset()
333 dev_warn(core->dev, "local-reset deassert back failed\n"); in k3_r5_lockstep_reset()
341 struct k3_r5_core *core; in k3_r5_lockstep_release() local
345 list_for_each_entry_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
346 ret = core->ti_sci->ops.dev_ops.get_device(core->ti_sci, in k3_r5_lockstep_release()
347 core->ti_sci_id); in k3_r5_lockstep_release()
349 dev_err(core->dev, "module-reset deassert failed, ret = %d\n", in k3_r5_lockstep_release()
351 core = list_next_entry(core, elem); in k3_r5_lockstep_release()
357 list_for_each_entry_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
358 ret = reset_control_deassert(core->reset); in k3_r5_lockstep_release()
360 dev_err(core->dev, "module-reset deassert failed, ret = %d\n", in k3_r5_lockstep_release()
369 list_for_each_entry_continue(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
370 if (reset_control_assert(core->reset)) in k3_r5_lockstep_release()
371 dev_warn(core->dev, "local-reset assert back failed\n"); in k3_r5_lockstep_release()
373 core = list_first_entry(&cluster->cores, struct k3_r5_core, elem); in k3_r5_lockstep_release()
375 list_for_each_entry_from(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
376 if (core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_lockstep_release()
377 core->ti_sci_id)) in k3_r5_lockstep_release()
378 dev_warn(core->dev, "module-reset assert back failed\n"); in k3_r5_lockstep_release()
384 static inline int k3_r5_core_halt(struct k3_r5_core *core) in k3_r5_core_halt() argument
386 return ti_sci_proc_set_control(core->tsp, in k3_r5_core_halt()
390 static inline int k3_r5_core_run(struct k3_r5_core *core) in k3_r5_core_run() argument
392 return ti_sci_proc_set_control(core->tsp, in k3_r5_core_run()
451 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_prepare() local
458 ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl, &stat); in k3_r5_rproc_prepare()
466 k3_r5_lockstep_release(cluster) : k3_r5_split_release(core); in k3_r5_rproc_prepare()
490 memset(core->mem[0].cpu_addr, 0x00, core->mem[0].size); in k3_r5_rproc_prepare()
493 memset(core->mem[1].cpu_addr, 0x00, core->mem[1].size); in k3_r5_rproc_prepare()
518 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_unprepare() local
525 k3_r5_lockstep_reset(cluster) : k3_r5_split_reset(core); in k3_r5_rproc_unprepare()
554 struct k3_r5_core *core0, *core; in k3_r5_rproc_start() local
563 core = kproc->core; in k3_r5_rproc_start()
564 ret = ti_sci_proc_set_config(core->tsp, boot_addr, 0, 0); in k3_r5_rproc_start()
570 list_for_each_entry_reverse(core, &cluster->cores, elem) { in k3_r5_rproc_start()
571 ret = k3_r5_core_run(core); in k3_r5_rproc_start()
579 if (core != core0 && core0->rproc->state == RPROC_OFFLINE) { in k3_r5_rproc_start()
585 ret = k3_r5_core_run(core); in k3_r5_rproc_start()
589 core->released_from_reset = true; in k3_r5_rproc_start()
596 list_for_each_entry_continue(core, &cluster->cores, elem) { in k3_r5_rproc_start()
597 if (k3_r5_core_halt(core)) in k3_r5_rproc_start()
598 dev_warn(core->dev, "core halt back failed\n"); in k3_r5_rproc_start()
632 struct k3_r5_core *core1, *core = kproc->core; in k3_r5_rproc_stop() local
637 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_rproc_stop()
638 ret = k3_r5_core_halt(core); in k3_r5_rproc_stop()
640 core = list_prev_entry(core, elem); in k3_r5_rproc_stop()
648 if (core != core1 && core1->rproc->state != RPROC_OFFLINE) { in k3_r5_rproc_stop()
655 ret = k3_r5_core_halt(core); in k3_r5_rproc_stop()
663 list_for_each_entry_from_reverse(core, &cluster->cores, elem) { in k3_r5_rproc_stop()
664 if (k3_r5_core_run(core)) in k3_r5_rproc_stop()
665 dev_warn(core->dev, "core run back failed\n"); in k3_r5_rproc_stop()
734 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_da_to_va() local
745 for (i = 0; i < core->num_mems; i++) { in k3_r5_rproc_da_to_va()
746 bus_addr = core->mem[i].bus_addr; in k3_r5_rproc_da_to_va()
747 dev_addr = core->mem[i].dev_addr; in k3_r5_rproc_da_to_va()
748 size = core->mem[i].size; in k3_r5_rproc_da_to_va()
753 va = core->mem[i].cpu_addr + offset; in k3_r5_rproc_da_to_va()
760 va = core->mem[i].cpu_addr + offset; in k3_r5_rproc_da_to_va()
766 for (i = 0; i < core->num_sram; i++) { in k3_r5_rproc_da_to_va()
767 dev_addr = core->sram[i].dev_addr; in k3_r5_rproc_da_to_va()
768 size = core->sram[i].size; in k3_r5_rproc_da_to_va()
772 va = core->sram[i].cpu_addr + offset; in k3_r5_rproc_da_to_va()
840 struct k3_r5_core *core0, *core, *temp; in k3_r5_rproc_configure() local
852 core = core0; in k3_r5_rproc_configure()
854 core = kproc->core; in k3_r5_rproc_configure()
857 ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl, in k3_r5_rproc_configure()
882 if (core == core0) { in k3_r5_rproc_configure()
905 if (core->atcm_enable) in k3_r5_rproc_configure()
910 if (core->btcm_enable) in k3_r5_rproc_configure()
915 if (core->loczrama) in k3_r5_rproc_configure()
931 if (temp != core) { in k3_r5_rproc_configure()
943 ret = ti_sci_proc_set_config(core->tsp, boot_vec, in k3_r5_rproc_configure()
946 ret = k3_r5_core_halt(core); in k3_r5_rproc_configure()
950 ret = ti_sci_proc_set_config(core->tsp, boot_vec, in k3_r5_rproc_configure()
1077 struct k3_r5_core *core = kproc->core; in k3_r5_adjust_tcm_sizes() local
1078 struct device *cdev = core->dev; in k3_r5_adjust_tcm_sizes()
1088 if (core == core0) { in k3_r5_adjust_tcm_sizes()
1089 WARN_ON(core->mem[0].size != SZ_64K); in k3_r5_adjust_tcm_sizes()
1090 WARN_ON(core->mem[1].size != SZ_64K); in k3_r5_adjust_tcm_sizes()
1092 core->mem[0].size /= 2; in k3_r5_adjust_tcm_sizes()
1093 core->mem[1].size /= 2; in k3_r5_adjust_tcm_sizes()
1096 core->mem[0].size, core->mem[1].size); in k3_r5_adjust_tcm_sizes()
1116 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_configure_mode() local
1117 struct device *cdev = core->dev; in k3_r5_rproc_configure_mode()
1129 ret = core->ti_sci->ops.dev_ops.is_on(core->ti_sci, core->ti_sci_id, in k3_r5_rproc_configure_mode()
1141 reset_ctrl_status = reset_control_status(core->reset); in k3_r5_rproc_configure_mode()
1152 core->released_from_reset = c_state; in k3_r5_rproc_configure_mode()
1154 ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl, in k3_r5_rproc_configure_mode()
1206 if (core == core0) in k3_r5_rproc_configure_mode()
1208 core->atcm_enable = atcm_enable; in k3_r5_rproc_configure_mode()
1209 core->btcm_enable = btcm_enable; in k3_r5_rproc_configure_mode()
1210 core->loczrama = loczrama; in k3_r5_rproc_configure_mode()
1211 core->mem[0].dev_addr = loczrama ? 0 : K3_R5_TCM_DEV_ADDR; in k3_r5_rproc_configure_mode()
1212 core->mem[1].dev_addr = loczrama ? K3_R5_TCM_DEV_ADDR : 0; in k3_r5_rproc_configure_mode()
1223 struct k3_r5_core *core, *core1; in k3_r5_cluster_rproc_init() local
1230 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_cluster_rproc_init()
1231 cdev = core->dev; in k3_r5_cluster_rproc_init()
1253 kproc->core = core; in k3_r5_cluster_rproc_init()
1256 core->rproc = rproc; in k3_r5_cluster_rproc_init()
1310 core->released_from_reset, in k3_r5_cluster_rproc_init()
1338 if (cluster->mode == CLUSTER_MODE_SPLIT && core == core1) { in k3_r5_cluster_rproc_init()
1339 core = list_prev_entry(core, elem); in k3_r5_cluster_rproc_init()
1340 rproc = core->rproc; in k3_r5_cluster_rproc_init()
1351 struct k3_r5_core *core; in k3_r5_cluster_rproc_exit() local
1360 core = (cluster->mode == CLUSTER_MODE_LOCKSTEP || in k3_r5_cluster_rproc_exit()
1365 list_for_each_entry_from_reverse(core, &cluster->cores, elem) { in k3_r5_cluster_rproc_exit()
1366 rproc = core->rproc; in k3_r5_cluster_rproc_exit()
1386 struct k3_r5_core *core) in k3_r5_core_of_get_internal_memories() argument
1395 core->mem = devm_kcalloc(dev, num_mems, sizeof(*core->mem), GFP_KERNEL); in k3_r5_core_of_get_internal_memories()
1396 if (!core->mem) in k3_r5_core_of_get_internal_memories()
1422 core->mem[i].cpu_addr = devm_ioremap_wc(dev, res->start, in k3_r5_core_of_get_internal_memories()
1424 if (!core->mem[i].cpu_addr) { in k3_r5_core_of_get_internal_memories()
1428 core->mem[i].bus_addr = res->start; in k3_r5_core_of_get_internal_memories()
1439 core->mem[i].dev_addr = core->loczrama ? in k3_r5_core_of_get_internal_memories()
1442 core->mem[i].dev_addr = core->loczrama ? in k3_r5_core_of_get_internal_memories()
1445 core->mem[i].size = resource_size(res); in k3_r5_core_of_get_internal_memories()
1448 mem_names[i], &core->mem[i].bus_addr, in k3_r5_core_of_get_internal_memories()
1449 core->mem[i].size, core->mem[i].cpu_addr, in k3_r5_core_of_get_internal_memories()
1450 core->mem[i].dev_addr); in k3_r5_core_of_get_internal_memories()
1452 core->num_mems = num_mems; in k3_r5_core_of_get_internal_memories()
1458 struct k3_r5_core *core) in k3_r5_core_of_get_sram_memories() argument
1474 core->sram = devm_kcalloc(dev, num_sram, sizeof(*core->sram), GFP_KERNEL); in k3_r5_core_of_get_sram_memories()
1475 if (!core->sram) in k3_r5_core_of_get_sram_memories()
1493 core->sram[i].bus_addr = res.start; in k3_r5_core_of_get_sram_memories()
1494 core->sram[i].dev_addr = res.start; in k3_r5_core_of_get_sram_memories()
1495 core->sram[i].size = resource_size(&res); in k3_r5_core_of_get_sram_memories()
1496 core->sram[i].cpu_addr = devm_ioremap_wc(dev, res.start, in k3_r5_core_of_get_sram_memories()
1498 if (!core->sram[i].cpu_addr) { in k3_r5_core_of_get_sram_memories()
1505 i, &core->sram[i].bus_addr, in k3_r5_core_of_get_sram_memories()
1506 core->sram[i].size, core->sram[i].cpu_addr, in k3_r5_core_of_get_sram_memories()
1507 core->sram[i].dev_addr); in k3_r5_core_of_get_sram_memories()
1509 core->num_sram = num_sram; in k3_r5_core_of_get_sram_memories()
1518 struct k3_r5_core *core; in k3_r5_core_of_init() local
1524 core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); in k3_r5_core_of_init()
1525 if (!core) { in k3_r5_core_of_init()
1530 core->dev = dev; in k3_r5_core_of_init()
1535 core->atcm_enable = 0; in k3_r5_core_of_init()
1536 core->btcm_enable = 1; in k3_r5_core_of_init()
1537 core->loczrama = 1; in k3_r5_core_of_init()
1539 ret = of_property_read_u32(np, "ti,atcm-enable", &core->atcm_enable); in k3_r5_core_of_init()
1546 ret = of_property_read_u32(np, "ti,btcm-enable", &core->btcm_enable); in k3_r5_core_of_init()
1553 ret = of_property_read_u32(np, "ti,loczrama", &core->loczrama); in k3_r5_core_of_init()
1559 core->ti_sci = devm_ti_sci_get_by_phandle(dev, "ti,sci"); in k3_r5_core_of_init()
1560 if (IS_ERR(core->ti_sci)) { in k3_r5_core_of_init()
1561 ret = PTR_ERR(core->ti_sci); in k3_r5_core_of_init()
1566 core->ti_sci = NULL; in k3_r5_core_of_init()
1570 ret = of_property_read_u32(np, "ti,sci-dev-id", &core->ti_sci_id); in k3_r5_core_of_init()
1576 core->reset = devm_reset_control_get_exclusive(dev, NULL); in k3_r5_core_of_init()
1577 if (IS_ERR_OR_NULL(core->reset)) { in k3_r5_core_of_init()
1578 ret = PTR_ERR_OR_ZERO(core->reset); in k3_r5_core_of_init()
1588 core->tsp = ti_sci_proc_of_get_tsp(dev, core->ti_sci); in k3_r5_core_of_init()
1589 if (IS_ERR(core->tsp)) { in k3_r5_core_of_init()
1590 ret = PTR_ERR(core->tsp); in k3_r5_core_of_init()
1596 ret = k3_r5_core_of_get_internal_memories(pdev, core); in k3_r5_core_of_init()
1603 ret = k3_r5_core_of_get_sram_memories(pdev, core); in k3_r5_core_of_init()
1609 ret = ti_sci_proc_request(core->tsp); in k3_r5_core_of_init()
1615 platform_set_drvdata(pdev, core); in k3_r5_core_of_init()
1631 struct k3_r5_core *core = platform_get_drvdata(pdev); in k3_r5_core_of_exit() local
1635 ret = ti_sci_proc_release(core->tsp); in k3_r5_core_of_exit()
1647 struct k3_r5_core *core, *temp; in k3_r5_cluster_of_exit() local
1649 list_for_each_entry_safe_reverse(core, temp, &cluster->cores, elem) { in k3_r5_cluster_of_exit()
1650 list_del(&core->elem); in k3_r5_cluster_of_exit()
1651 cpdev = to_platform_device(core->dev); in k3_r5_cluster_of_exit()
1663 struct k3_r5_core *core; in k3_r5_cluster_of_init() local
1684 core = platform_get_drvdata(cpdev); in k3_r5_cluster_of_init()
1686 list_add_tail(&core->elem, &cluster->cores); in k3_r5_cluster_of_init()