Lines Matching refs:core
161 struct k3_r5_core *core; member
230 static int k3_r5_split_reset(struct k3_r5_core *core) in k3_r5_split_reset() argument
234 ret = reset_control_assert(core->reset); in k3_r5_split_reset()
236 dev_err(core->dev, "local-reset assert failed, ret = %d\n", in k3_r5_split_reset()
241 ret = core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_split_reset()
242 core->ti_sci_id); in k3_r5_split_reset()
244 dev_err(core->dev, "module-reset assert failed, ret = %d\n", in k3_r5_split_reset()
246 if (reset_control_deassert(core->reset)) in k3_r5_split_reset()
247 dev_warn(core->dev, "local-reset deassert back failed\n"); in k3_r5_split_reset()
253 static int k3_r5_split_release(struct k3_r5_core *core) in k3_r5_split_release() argument
257 ret = core->ti_sci->ops.dev_ops.get_device(core->ti_sci, in k3_r5_split_release()
258 core->ti_sci_id); in k3_r5_split_release()
260 dev_err(core->dev, "module-reset deassert failed, ret = %d\n", in k3_r5_split_release()
265 ret = reset_control_deassert(core->reset); in k3_r5_split_release()
267 dev_err(core->dev, "local-reset deassert failed, ret = %d\n", in k3_r5_split_release()
269 if (core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_split_release()
270 core->ti_sci_id)) in k3_r5_split_release()
271 dev_warn(core->dev, "module-reset assert back failed\n"); in k3_r5_split_release()
279 struct k3_r5_core *core; in k3_r5_lockstep_reset() local
283 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
284 ret = reset_control_assert(core->reset); in k3_r5_lockstep_reset()
286 dev_err(core->dev, "local-reset assert failed, ret = %d\n", in k3_r5_lockstep_reset()
288 core = list_prev_entry(core, elem); in k3_r5_lockstep_reset()
294 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
295 ret = core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_lockstep_reset()
296 core->ti_sci_id); in k3_r5_lockstep_reset()
298 dev_err(core->dev, "module-reset assert failed, ret = %d\n", in k3_r5_lockstep_reset()
307 list_for_each_entry_continue_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
308 if (core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_lockstep_reset()
309 core->ti_sci_id)) in k3_r5_lockstep_reset()
310 dev_warn(core->dev, "module-reset assert back failed\n"); in k3_r5_lockstep_reset()
312 core = list_last_entry(&cluster->cores, struct k3_r5_core, elem); in k3_r5_lockstep_reset()
314 list_for_each_entry_from_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_reset()
315 if (reset_control_deassert(core->reset)) in k3_r5_lockstep_reset()
316 dev_warn(core->dev, "local-reset deassert back failed\n"); in k3_r5_lockstep_reset()
324 struct k3_r5_core *core; in k3_r5_lockstep_release() local
328 list_for_each_entry_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
329 ret = core->ti_sci->ops.dev_ops.get_device(core->ti_sci, in k3_r5_lockstep_release()
330 core->ti_sci_id); in k3_r5_lockstep_release()
332 dev_err(core->dev, "module-reset deassert failed, ret = %d\n", in k3_r5_lockstep_release()
334 core = list_next_entry(core, elem); in k3_r5_lockstep_release()
340 list_for_each_entry_reverse(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
341 ret = reset_control_deassert(core->reset); in k3_r5_lockstep_release()
343 dev_err(core->dev, "module-reset deassert failed, ret = %d\n", in k3_r5_lockstep_release()
352 list_for_each_entry_continue(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
353 if (reset_control_assert(core->reset)) in k3_r5_lockstep_release()
354 dev_warn(core->dev, "local-reset assert back failed\n"); in k3_r5_lockstep_release()
356 core = list_first_entry(&cluster->cores, struct k3_r5_core, elem); in k3_r5_lockstep_release()
358 list_for_each_entry_from(core, &cluster->cores, elem) { in k3_r5_lockstep_release()
359 if (core->ti_sci->ops.dev_ops.put_device(core->ti_sci, in k3_r5_lockstep_release()
360 core->ti_sci_id)) in k3_r5_lockstep_release()
361 dev_warn(core->dev, "module-reset assert back failed\n"); in k3_r5_lockstep_release()
367 static inline int k3_r5_core_halt(struct k3_r5_core *core) in k3_r5_core_halt() argument
369 return ti_sci_proc_set_control(core->tsp, in k3_r5_core_halt()
373 static inline int k3_r5_core_run(struct k3_r5_core *core) in k3_r5_core_run() argument
375 return ti_sci_proc_set_control(core->tsp, in k3_r5_core_run()
398 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_prepare() local
405 ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl, &stat); in k3_r5_rproc_prepare()
413 k3_r5_lockstep_release(cluster) : k3_r5_split_release(core); in k3_r5_rproc_prepare()
437 memset(core->mem[0].cpu_addr, 0x00, core->mem[0].size); in k3_r5_rproc_prepare()
440 memset(core->mem[1].cpu_addr, 0x00, core->mem[1].size); in k3_r5_rproc_prepare()
464 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_unprepare() local
471 k3_r5_lockstep_reset(cluster) : k3_r5_split_reset(core); in k3_r5_rproc_unprepare()
500 struct k3_r5_core *core; in k3_r5_rproc_start() local
536 core = kproc->core; in k3_r5_rproc_start()
537 ret = ti_sci_proc_set_config(core->tsp, boot_addr, 0, 0); in k3_r5_rproc_start()
543 list_for_each_entry_reverse(core, &cluster->cores, elem) { in k3_r5_rproc_start()
544 ret = k3_r5_core_run(core); in k3_r5_rproc_start()
549 ret = k3_r5_core_run(core); in k3_r5_rproc_start()
557 list_for_each_entry_continue(core, &cluster->cores, elem) { in k3_r5_rproc_start()
558 if (k3_r5_core_halt(core)) in k3_r5_rproc_start()
559 dev_warn(core->dev, "core halt back failed\n"); in k3_r5_rproc_start()
593 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_stop() local
598 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_rproc_stop()
599 ret = k3_r5_core_halt(core); in k3_r5_rproc_stop()
601 core = list_prev_entry(core, elem); in k3_r5_rproc_stop()
606 ret = k3_r5_core_halt(core); in k3_r5_rproc_stop()
616 list_for_each_entry_from_reverse(core, &cluster->cores, elem) { in k3_r5_rproc_stop()
617 if (k3_r5_core_run(core)) in k3_r5_rproc_stop()
618 dev_warn(core->dev, "core run back failed\n"); in k3_r5_rproc_stop()
635 struct k3_r5_core *core = kproc->core; in k3_r5_rproc_da_to_va() local
646 for (i = 0; i < core->num_mems; i++) { in k3_r5_rproc_da_to_va()
647 bus_addr = core->mem[i].bus_addr; in k3_r5_rproc_da_to_va()
648 dev_addr = core->mem[i].dev_addr; in k3_r5_rproc_da_to_va()
649 size = core->mem[i].size; in k3_r5_rproc_da_to_va()
654 va = core->mem[i].cpu_addr + offset; in k3_r5_rproc_da_to_va()
661 va = core->mem[i].cpu_addr + offset; in k3_r5_rproc_da_to_va()
667 for (i = 0; i < core->num_sram; i++) { in k3_r5_rproc_da_to_va()
668 dev_addr = core->sram[i].dev_addr; in k3_r5_rproc_da_to_va()
669 size = core->sram[i].size; in k3_r5_rproc_da_to_va()
673 va = core->sram[i].cpu_addr + offset; in k3_r5_rproc_da_to_va()
741 struct k3_r5_core *core0, *core, *temp; in k3_r5_rproc_configure() local
752 core = core0; in k3_r5_rproc_configure()
754 core = kproc->core; in k3_r5_rproc_configure()
757 ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl, in k3_r5_rproc_configure()
786 if (core == core0) { in k3_r5_rproc_configure()
809 if (core->atcm_enable) in k3_r5_rproc_configure()
814 if (core->btcm_enable) in k3_r5_rproc_configure()
819 if (core->loczrama) in k3_r5_rproc_configure()
835 if (temp != core) { in k3_r5_rproc_configure()
847 ret = ti_sci_proc_set_config(core->tsp, boot_vec, in k3_r5_rproc_configure()
850 ret = k3_r5_core_halt(core); in k3_r5_rproc_configure()
854 ret = ti_sci_proc_set_config(core->tsp, boot_vec, in k3_r5_rproc_configure()
981 struct k3_r5_core *core = kproc->core; in k3_r5_adjust_tcm_sizes() local
982 struct device *cdev = core->dev; in k3_r5_adjust_tcm_sizes()
991 if (core == core0) { in k3_r5_adjust_tcm_sizes()
992 WARN_ON(core->mem[0].size != SZ_64K); in k3_r5_adjust_tcm_sizes()
993 WARN_ON(core->mem[1].size != SZ_64K); in k3_r5_adjust_tcm_sizes()
995 core->mem[0].size /= 2; in k3_r5_adjust_tcm_sizes()
996 core->mem[1].size /= 2; in k3_r5_adjust_tcm_sizes()
999 core->mem[0].size, core->mem[1].size); in k3_r5_adjust_tcm_sizes()
1008 struct k3_r5_core *core, *core1; in k3_r5_cluster_rproc_init() local
1015 list_for_each_entry(core, &cluster->cores, elem) { in k3_r5_cluster_rproc_init()
1016 cdev = core->dev; in k3_r5_cluster_rproc_init()
1038 kproc->core = core; in k3_r5_cluster_rproc_init()
1041 core->rproc = rproc; in k3_r5_cluster_rproc_init()
1079 core->rproc = NULL; in k3_r5_cluster_rproc_init()
1082 if (cluster->mode == CLUSTER_MODE_SPLIT && core == core1) { in k3_r5_cluster_rproc_init()
1083 core = list_prev_entry(core, elem); in k3_r5_cluster_rproc_init()
1084 rproc = core->rproc; in k3_r5_cluster_rproc_init()
1095 struct k3_r5_core *core; in k3_r5_cluster_rproc_exit() local
1103 core = (cluster->mode == CLUSTER_MODE_LOCKSTEP || in k3_r5_cluster_rproc_exit()
1108 list_for_each_entry_from_reverse(core, &cluster->cores, elem) { in k3_r5_cluster_rproc_exit()
1109 rproc = core->rproc; in k3_r5_cluster_rproc_exit()
1117 core->rproc = NULL; in k3_r5_cluster_rproc_exit()
1122 struct k3_r5_core *core) in k3_r5_core_of_get_internal_memories() argument
1131 core->mem = devm_kcalloc(dev, num_mems, sizeof(*core->mem), GFP_KERNEL); in k3_r5_core_of_get_internal_memories()
1132 if (!core->mem) in k3_r5_core_of_get_internal_memories()
1158 core->mem[i].cpu_addr = devm_ioremap_wc(dev, res->start, in k3_r5_core_of_get_internal_memories()
1160 if (!core->mem[i].cpu_addr) { in k3_r5_core_of_get_internal_memories()
1164 core->mem[i].bus_addr = res->start; in k3_r5_core_of_get_internal_memories()
1175 core->mem[i].dev_addr = core->loczrama ? in k3_r5_core_of_get_internal_memories()
1178 core->mem[i].dev_addr = core->loczrama ? in k3_r5_core_of_get_internal_memories()
1181 core->mem[i].size = resource_size(res); in k3_r5_core_of_get_internal_memories()
1184 mem_names[i], &core->mem[i].bus_addr, in k3_r5_core_of_get_internal_memories()
1185 core->mem[i].size, core->mem[i].cpu_addr, in k3_r5_core_of_get_internal_memories()
1186 core->mem[i].dev_addr); in k3_r5_core_of_get_internal_memories()
1188 core->num_mems = num_mems; in k3_r5_core_of_get_internal_memories()
1194 struct k3_r5_core *core) in k3_r5_core_of_get_sram_memories() argument
1210 core->sram = devm_kcalloc(dev, num_sram, sizeof(*core->sram), GFP_KERNEL); in k3_r5_core_of_get_sram_memories()
1211 if (!core->sram) in k3_r5_core_of_get_sram_memories()
1229 core->sram[i].bus_addr = res.start; in k3_r5_core_of_get_sram_memories()
1230 core->sram[i].dev_addr = res.start; in k3_r5_core_of_get_sram_memories()
1231 core->sram[i].size = resource_size(&res); in k3_r5_core_of_get_sram_memories()
1232 core->sram[i].cpu_addr = devm_ioremap_wc(dev, res.start, in k3_r5_core_of_get_sram_memories()
1234 if (!core->sram[i].cpu_addr) { in k3_r5_core_of_get_sram_memories()
1241 i, &core->sram[i].bus_addr, in k3_r5_core_of_get_sram_memories()
1242 core->sram[i].size, core->sram[i].cpu_addr, in k3_r5_core_of_get_sram_memories()
1243 core->sram[i].dev_addr); in k3_r5_core_of_get_sram_memories()
1245 core->num_sram = num_sram; in k3_r5_core_of_get_sram_memories()
1280 struct k3_r5_core *core; in k3_r5_core_of_init() local
1286 core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); in k3_r5_core_of_init()
1287 if (!core) { in k3_r5_core_of_init()
1292 core->dev = dev; in k3_r5_core_of_init()
1297 core->atcm_enable = 0; in k3_r5_core_of_init()
1298 core->btcm_enable = 1; in k3_r5_core_of_init()
1299 core->loczrama = 1; in k3_r5_core_of_init()
1301 ret = of_property_read_u32(np, "ti,atcm-enable", &core->atcm_enable); in k3_r5_core_of_init()
1308 ret = of_property_read_u32(np, "ti,btcm-enable", &core->btcm_enable); in k3_r5_core_of_init()
1315 ret = of_property_read_u32(np, "ti,loczrama", &core->loczrama); in k3_r5_core_of_init()
1321 core->ti_sci = devm_ti_sci_get_by_phandle(dev, "ti,sci"); in k3_r5_core_of_init()
1322 if (IS_ERR(core->ti_sci)) { in k3_r5_core_of_init()
1323 ret = PTR_ERR(core->ti_sci); in k3_r5_core_of_init()
1328 core->ti_sci = NULL; in k3_r5_core_of_init()
1332 ret = of_property_read_u32(np, "ti,sci-dev-id", &core->ti_sci_id); in k3_r5_core_of_init()
1338 core->reset = devm_reset_control_get_exclusive(dev, NULL); in k3_r5_core_of_init()
1339 if (IS_ERR_OR_NULL(core->reset)) { in k3_r5_core_of_init()
1340 ret = PTR_ERR_OR_ZERO(core->reset); in k3_r5_core_of_init()
1350 core->tsp = k3_r5_core_of_get_tsp(dev, core->ti_sci); in k3_r5_core_of_init()
1351 if (IS_ERR(core->tsp)) { in k3_r5_core_of_init()
1352 ret = PTR_ERR(core->tsp); in k3_r5_core_of_init()
1358 ret = k3_r5_core_of_get_internal_memories(pdev, core); in k3_r5_core_of_init()
1365 ret = k3_r5_core_of_get_sram_memories(pdev, core); in k3_r5_core_of_init()
1371 ret = ti_sci_proc_request(core->tsp); in k3_r5_core_of_init()
1377 platform_set_drvdata(pdev, core); in k3_r5_core_of_init()
1393 struct k3_r5_core *core = platform_get_drvdata(pdev); in k3_r5_core_of_exit() local
1397 ret = ti_sci_proc_release(core->tsp); in k3_r5_core_of_exit()
1409 struct k3_r5_core *core, *temp; in k3_r5_cluster_of_exit() local
1411 list_for_each_entry_safe_reverse(core, temp, &cluster->cores, elem) { in k3_r5_cluster_of_exit()
1412 list_del(&core->elem); in k3_r5_cluster_of_exit()
1413 cpdev = to_platform_device(core->dev); in k3_r5_cluster_of_exit()
1425 struct k3_r5_core *core; in k3_r5_cluster_of_init() local
1444 core = platform_get_drvdata(cpdev); in k3_r5_cluster_of_init()
1446 list_add_tail(&core->elem, &cluster->cores); in k3_r5_cluster_of_init()