Lines Matching +full:reserved +full:- +full:ipi +full:- +full:vectors

1 // SPDX-License-Identifier: GPL-2.0
7 #include <dt-bindings/power/xlnx-zynqmp-power.h>
8 #include <linux/dma-mapping.h>
9 #include <linux/firmware/xlnx-zynqmp.h>
12 #include <linux/mailbox/zynqmp-ipi-message.h>
22 /* IPI buffer MAX length */
34 * reflects possible values of xlnx,cluster-mode dt-property
38 LOCKSTEP_MODE = 1, /* cores execute same code in lockstep,clk-for-clk */
43 * struct mem_bank_data - Memory Bank description
48 * @pm_domain_id: Power-domains id of memory bank for firmware to turn on/off
60 * struct zynqmp_sram_bank - sram bank description
98 * @magic_num: 32-bit magic number.
113 * compatibility with device-tree that does not have TCM information.
143 * @ipi: pointer to mailbox information
156 struct mbox_info *ipi; member
175 * event_notified_idr_cb() - callback for vq_interrupt per notifyid
176 * @id: rproc->notify id
190 dev_dbg(&rproc->dev, "data not found for vqid=%d\n", id); in event_notified_idr_cb()
196 * handle_event_notified() - remoteproc notification work function
203 struct mbox_info *ipi; in handle_event_notified() local
206 ipi = container_of(work, struct mbox_info, mbox_work); in handle_event_notified()
207 rproc = ipi->r5_core->rproc; in handle_event_notified()
210 * We only use IPI for interrupt. The RPU firmware side may or may in handle_event_notified()
211 * not write the notifyid when it trigger IPI. in handle_event_notified()
216 idr_for_each(&rproc->notifyids, event_notified_idr_cb, rproc); in handle_event_notified()
220 * zynqmp_r5_mb_rx_cb() - receive channel mailbox callback
224 * Receive data from ipi buffer, ack interrupt and then
230 struct mbox_info *ipi; in zynqmp_r5_mb_rx_cb() local
233 ipi = container_of(cl, struct mbox_info, mbox_cl); in zynqmp_r5_mb_rx_cb()
235 /* copy data from ipi buffer to r5_core */ in zynqmp_r5_mb_rx_cb()
237 buf_msg = (struct zynqmp_ipi_message *)ipi->rx_mc_buf; in zynqmp_r5_mb_rx_cb()
238 len = ipi_msg->len; in zynqmp_r5_mb_rx_cb()
240 dev_warn(cl->dev, "msg size exceeded than %d\n", in zynqmp_r5_mb_rx_cb()
244 buf_msg->len = len; in zynqmp_r5_mb_rx_cb()
245 memcpy(buf_msg->data, ipi_msg->data, len); in zynqmp_r5_mb_rx_cb()
248 if (mbox_send_message(ipi->rx_chan, NULL) < 0) in zynqmp_r5_mb_rx_cb()
249 dev_err(cl->dev, "ack failed to mbox rx_chan\n"); in zynqmp_r5_mb_rx_cb()
251 schedule_work(&ipi->mbox_work); in zynqmp_r5_mb_rx_cb()
255 * zynqmp_r5_setup_mbox() - Setup mailboxes related properties
266 struct mbox_info *ipi; in zynqmp_r5_setup_mbox() local
268 ipi = kzalloc(sizeof(*ipi), GFP_KERNEL); in zynqmp_r5_setup_mbox()
269 if (!ipi) in zynqmp_r5_setup_mbox()
272 mbox_cl = &ipi->mbox_cl; in zynqmp_r5_setup_mbox()
273 mbox_cl->rx_callback = zynqmp_r5_mb_rx_cb; in zynqmp_r5_setup_mbox()
274 mbox_cl->tx_block = false; in zynqmp_r5_setup_mbox()
275 mbox_cl->knows_txdone = false; in zynqmp_r5_setup_mbox()
276 mbox_cl->tx_done = NULL; in zynqmp_r5_setup_mbox()
277 mbox_cl->dev = cdev; in zynqmp_r5_setup_mbox()
280 ipi->tx_chan = mbox_request_channel_byname(mbox_cl, "tx"); in zynqmp_r5_setup_mbox()
281 if (IS_ERR(ipi->tx_chan)) { in zynqmp_r5_setup_mbox()
282 ipi->tx_chan = NULL; in zynqmp_r5_setup_mbox()
283 kfree(ipi); in zynqmp_r5_setup_mbox()
288 ipi->rx_chan = mbox_request_channel_byname(mbox_cl, "rx"); in zynqmp_r5_setup_mbox()
289 if (IS_ERR(ipi->rx_chan)) { in zynqmp_r5_setup_mbox()
290 mbox_free_channel(ipi->tx_chan); in zynqmp_r5_setup_mbox()
291 ipi->rx_chan = NULL; in zynqmp_r5_setup_mbox()
292 ipi->tx_chan = NULL; in zynqmp_r5_setup_mbox()
293 kfree(ipi); in zynqmp_r5_setup_mbox()
298 INIT_WORK(&ipi->mbox_work, handle_event_notified); in zynqmp_r5_setup_mbox()
300 return ipi; in zynqmp_r5_setup_mbox()
303 static void zynqmp_r5_free_mbox(struct mbox_info *ipi) in zynqmp_r5_free_mbox() argument
305 if (!ipi) in zynqmp_r5_free_mbox()
308 if (ipi->tx_chan) { in zynqmp_r5_free_mbox()
309 mbox_free_channel(ipi->tx_chan); in zynqmp_r5_free_mbox()
310 ipi->tx_chan = NULL; in zynqmp_r5_free_mbox()
313 if (ipi->rx_chan) { in zynqmp_r5_free_mbox()
314 mbox_free_channel(ipi->rx_chan); in zynqmp_r5_free_mbox()
315 ipi->rx_chan = NULL; in zynqmp_r5_free_mbox()
318 kfree(ipi); in zynqmp_r5_free_mbox()
322 * zynqmp_r5_core_kick() - kick a firmware if mbox is provided
328 struct zynqmp_r5_core *r5_core = rproc->priv; in zynqmp_r5_rproc_kick()
329 struct device *dev = r5_core->dev; in zynqmp_r5_rproc_kick()
331 struct mbox_info *ipi; in zynqmp_r5_rproc_kick() local
334 ipi = r5_core->ipi; in zynqmp_r5_rproc_kick()
335 if (!ipi) in zynqmp_r5_rproc_kick()
338 mb_msg = (struct zynqmp_ipi_message *)ipi->tx_mc_buf; in zynqmp_r5_rproc_kick()
339 memcpy(mb_msg->data, &vqid, sizeof(vqid)); in zynqmp_r5_rproc_kick()
340 mb_msg->len = sizeof(vqid); in zynqmp_r5_rproc_kick()
341 ret = mbox_send_message(ipi->tx_chan, mb_msg); in zynqmp_r5_rproc_kick()
352 * return 0 on success, otherwise non-zero value on failure
356 struct zynqmp_r5_core *r5_core = rproc->priv; in zynqmp_r5_rproc_start()
361 * The exception vector pointers (EVP) refer to the base-address of in zynqmp_r5_rproc_start()
362 * exception vectors (for reset, IRQ, FIQ, etc). The reset-vector in zynqmp_r5_rproc_start()
363 * starts at the base-address and subsequent vectors are on 4-byte in zynqmp_r5_rproc_start()
366 * Exception vectors can start either from 0x0000_0000 (LOVEC) or in zynqmp_r5_rproc_start()
367 * from 0xFFFF_0000 (HIVEC) which is mapped in the OCM (On-Chip Memory) in zynqmp_r5_rproc_start()
369 * Usually firmware will put Exception vectors at LOVEC. in zynqmp_r5_rproc_start()
373 * and jitter. Also, if the OCM is secured and the Cortex-R5F processor in zynqmp_r5_rproc_start()
374 * is non-secured, then the Cortex-R5F processor cannot access the in zynqmp_r5_rproc_start()
375 * HIVEC exception vectors in the OCM. in zynqmp_r5_rproc_start()
377 bootmem = (rproc->bootaddr >= 0xFFFC0000) ? in zynqmp_r5_rproc_start()
380 dev_dbg(r5_core->dev, "RPU boot addr 0x%llx from %s.", rproc->bootaddr, in zynqmp_r5_rproc_start()
383 ret = zynqmp_pm_request_wake(r5_core->pm_domain_id, 1, in zynqmp_r5_rproc_start()
386 dev_err(r5_core->dev, in zynqmp_r5_rproc_start()
387 "failed to start RPU = 0x%x\n", r5_core->pm_domain_id); in zynqmp_r5_rproc_start()
397 * return 0 on success, otherwise non-zero value on failure
401 struct zynqmp_r5_core *r5_core = rproc->priv; in zynqmp_r5_rproc_stop()
404 ret = zynqmp_pm_force_pwrdwn(r5_core->pm_domain_id, in zynqmp_r5_rproc_stop()
407 dev_err(r5_core->dev, "failed to stop remoteproc RPU %d\n", ret); in zynqmp_r5_rproc_stop()
415 * @mem: mem descriptor to map reserved memory-regions
417 * Callback to map va for memory-region's carveout.
419 * return 0 on success, otherwise non-zero value on failure
426 va = ioremap_wc(mem->dma, mem->len); in zynqmp_r5_mem_region_map()
428 return -ENOMEM; in zynqmp_r5_mem_region_map()
430 mem->va = (void *)va; in zynqmp_r5_mem_region_map()
440 * Unmap memory-region carveout
447 iounmap((void __iomem *)mem->va); in zynqmp_r5_mem_region_unmap()
455 * Construct rproc mem carveouts from memory-region property nodes
457 * return 0 on success, otherwise non-zero value on failure
467 r5_core = rproc->priv; in add_mem_regions_carveout()
469 /* Register associated reserved memory regions */ in add_mem_regions_carveout()
470 of_phandle_iterator_init(&it, r5_core->np, "memory-region", NULL, 0); in add_mem_regions_carveout()
476 dev_err(&rproc->dev, "unable to acquire memory-region\n"); in add_mem_regions_carveout()
477 return -EINVAL; in add_mem_regions_carveout()
480 if (!strcmp(it.node->name, "vdev0buffer")) { in add_mem_regions_carveout()
481 /* Init reserved memory for vdev buffer */ in add_mem_regions_carveout()
482 rproc_mem = rproc_of_resm_mem_entry_init(&rproc->dev, i, in add_mem_regions_carveout()
483 rmem->size, in add_mem_regions_carveout()
484 rmem->base, in add_mem_regions_carveout()
485 it.node->name); in add_mem_regions_carveout()
487 /* Register associated reserved memory regions */ in add_mem_regions_carveout()
488 rproc_mem = rproc_mem_entry_init(&rproc->dev, NULL, in add_mem_regions_carveout()
489 (dma_addr_t)rmem->base, in add_mem_regions_carveout()
490 rmem->size, rmem->base, in add_mem_regions_carveout()
493 it.node->name); in add_mem_regions_carveout()
498 return -ENOMEM; in add_mem_regions_carveout()
502 rproc_coredump_add_segment(rproc, rmem->base, rmem->size); in add_mem_regions_carveout()
504 dev_dbg(&rproc->dev, "reserved mem carveout %s addr=%llx, size=0x%llx", in add_mem_regions_carveout()
505 it.node->name, rmem->base, rmem->size); in add_mem_regions_carveout()
514 struct zynqmp_r5_core *r5_core = rproc->priv; in add_sram_carveouts()
521 for (i = 0; i < r5_core->num_sram; i++) { in add_sram_carveouts()
522 sram = &r5_core->sram[i]; in add_sram_carveouts()
524 dma_addr = (dma_addr_t)sram->sram_res.start; in add_sram_carveouts()
526 len = resource_size(&sram->sram_res); in add_sram_carveouts()
527 da = sram->da; in add_sram_carveouts()
529 rproc_mem = rproc_mem_entry_init(&rproc->dev, NULL, in add_sram_carveouts()
534 sram->sram_res.name); in add_sram_carveouts()
536 dev_err(&rproc->dev, "failed to add sram %s da=0x%x, size=0x%lx", in add_sram_carveouts()
537 sram->sram_res.name, da, len); in add_sram_carveouts()
538 return -ENOMEM; in add_sram_carveouts()
544 dev_dbg(&rproc->dev, "sram carveout %s addr=%llx, da=0x%x, size=0x%lx", in add_sram_carveouts()
545 sram->sram_res.name, dma_addr, da, len); in add_sram_carveouts()
562 iounmap((void __iomem *)mem->va); in tcm_mem_unmap()
575 * return 0 on success, otherwise non-zero value on failure
582 va = ioremap_wc(mem->dma, mem->len); in tcm_mem_map()
584 return -ENOMEM; in tcm_mem_map()
587 mem->va = (void *)va; in tcm_mem_map()
590 memset_io(va, 0, mem->len); in tcm_mem_map()
601 * return 0 on success, otherwise non-zero value on failure
615 r5_core = rproc->priv; in add_tcm_banks()
616 dev = r5_core->dev; in add_tcm_banks()
617 num_banks = r5_core->tcm_bank_count; in add_tcm_banks()
620 * Power-on Each 64KB TCM, in add_tcm_banks()
625 bank_addr = r5_core->tcm_banks[i]->addr; in add_tcm_banks()
626 da = r5_core->tcm_banks[i]->da; in add_tcm_banks()
627 bank_name = r5_core->tcm_banks[i]->bank_name; in add_tcm_banks()
628 bank_size = r5_core->tcm_banks[i]->size; in add_tcm_banks()
629 pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; in add_tcm_banks()
647 if (rproc->state == RPROC_DETACHED) in add_tcm_banks()
655 ret = -ENOMEM; in add_tcm_banks()
668 for (i--; i >= 0; i--) { in add_tcm_banks()
669 pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; in add_tcm_banks()
682 * return 0 on success, otherwise non-zero value on failure
689 if (ret == -EINVAL) { in zynqmp_r5_parse_fw()
696 dev_info(&rproc->dev, "no resource table found.\n"); in zynqmp_r5_parse_fw()
704 * adds carveouts for TCM bank and reserved memory regions
716 dev_err(&rproc->dev, "failed to get TCM banks, err %d\n", ret); in zynqmp_r5_rproc_prepare()
722 dev_err(&rproc->dev, "failed to get reserve mem regions %d\n", ret); in zynqmp_r5_rproc_prepare()
728 dev_err(&rproc->dev, "failed to get sram carveout %d\n", ret); in zynqmp_r5_rproc_prepare()
737 * Turns off TCM banks using power-domain id
749 r5_core = rproc->priv; in zynqmp_r5_rproc_unprepare()
751 for (i = 0; i < r5_core->tcm_bank_count; i++) { in zynqmp_r5_rproc_unprepare()
752 pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; in zynqmp_r5_rproc_unprepare()
754 dev_warn(r5_core->dev, in zynqmp_r5_rproc_unprepare()
766 r5_core = rproc->priv; in zynqmp_r5_get_loaded_rsc_table()
768 *size = r5_core->rsc_tbl_size; in zynqmp_r5_get_loaded_rsc_table()
770 return (struct resource_table *)r5_core->rsc_tbl_va; in zynqmp_r5_get_loaded_rsc_table()
776 struct device *dev = r5_core->dev; in zynqmp_r5_get_rsc_table_va()
785 * Start address of first entry under "memory-region" property list in zynqmp_r5_get_rsc_table_va()
789 np = of_parse_phandle(r5_core->np, "memory-region", 0); in zynqmp_r5_get_rsc_table_va()
792 return -EINVAL; in zynqmp_r5_get_rsc_table_va()
798 dev_err(dev, "failed to get memory-region resource addr\n"); in zynqmp_r5_get_rsc_table_va()
799 return -EINVAL; in zynqmp_r5_get_rsc_table_va()
806 return -EIO; in zynqmp_r5_get_rsc_table_va()
813 if (rsc_data_va->magic_num != RSC_TBL_XLNX_MAGIC || in zynqmp_r5_get_rsc_table_va()
814 rsc_data_va->comp_magic_num != ~RSC_TBL_XLNX_MAGIC) { in zynqmp_r5_get_rsc_table_va()
816 return -EINVAL; in zynqmp_r5_get_rsc_table_va()
819 r5_core->rsc_tbl_va = ioremap_wc(rsc_data_va->rsc_tbl, in zynqmp_r5_get_rsc_table_va()
820 rsc_data_va->rsc_tbl_size); in zynqmp_r5_get_rsc_table_va()
821 if (!r5_core->rsc_tbl_va) { in zynqmp_r5_get_rsc_table_va()
823 return -EINVAL; in zynqmp_r5_get_rsc_table_va()
826 rsc_tbl_addr = (struct resource_table *)r5_core->rsc_tbl_va; in zynqmp_r5_get_rsc_table_va()
832 if (rsc_tbl_addr->ver != 1) in zynqmp_r5_get_rsc_table_va()
834 rsc_tbl_addr->ver); in zynqmp_r5_get_rsc_table_va()
836 r5_core->rsc_tbl_size = rsc_data_va->rsc_tbl_size; in zynqmp_r5_get_rsc_table_va()
845 dev_dbg(&rproc->dev, "rproc %d attached\n", rproc->index); in zynqmp_r5_attach()
904 return ERR_PTR(-ENOMEM); in zynqmp_r5_add_rproc_core()
909 r5_rproc->auto_boot = false; in zynqmp_r5_add_rproc_core()
910 r5_core = r5_rproc->priv; in zynqmp_r5_add_rproc_core()
911 r5_core->dev = cdev; in zynqmp_r5_add_rproc_core()
912 r5_core->np = dev_of_node(cdev); in zynqmp_r5_add_rproc_core()
913 if (!r5_core->np) { in zynqmp_r5_add_rproc_core()
915 ret = -EINVAL; in zynqmp_r5_add_rproc_core()
934 r5_rproc->state = RPROC_DETACHED; in zynqmp_r5_add_rproc_core()
936 r5_core->rproc = r5_rproc; in zynqmp_r5_add_rproc_core()
946 struct device_node *np = r5_core->np; in zynqmp_r5_get_sram_banks()
947 struct device *dev = r5_core->dev; in zynqmp_r5_get_sram_banks()
954 if (!of_property_present(r5_core->np, "sram")) in zynqmp_r5_get_sram_banks()
961 return -EINVAL; in zynqmp_r5_get_sram_banks()
967 return -ENOMEM; in zynqmp_r5_get_sram_banks()
973 return -EINVAL; in zynqmp_r5_get_sram_banks()
978 ret = -EINVAL; in zynqmp_r5_get_sram_banks()
1004 r5_core->sram = sram; in zynqmp_r5_get_sram_banks()
1005 r5_core->num_sram = num_sram; in zynqmp_r5_get_sram_banks()
1027 for (i = 0; i < cluster->core_count; i++) { in zynqmp_r5_get_tcm_node_from_dt()
1028 r5_core = cluster->r5_cores[i]; in zynqmp_r5_get_tcm_node_from_dt()
1029 dev = r5_core->dev; in zynqmp_r5_get_tcm_node_from_dt()
1030 np = r5_core->np; in zynqmp_r5_get_tcm_node_from_dt()
1032 pd_count = of_count_phandle_with_args(np, "power-domains", in zynqmp_r5_get_tcm_node_from_dt()
1033 "#power-domain-cells"); in zynqmp_r5_get_tcm_node_from_dt()
1036 dev_err(dev, "invalid power-domains property, %d\n", pd_count); in zynqmp_r5_get_tcm_node_from_dt()
1037 return -EINVAL; in zynqmp_r5_get_tcm_node_from_dt()
1040 /* First entry in power-domains list is for r5 core, rest for TCM. */ in zynqmp_r5_get_tcm_node_from_dt()
1041 tcm_bank_count = pd_count - 1; in zynqmp_r5_get_tcm_node_from_dt()
1045 return -EINVAL; in zynqmp_r5_get_tcm_node_from_dt()
1048 r5_core->tcm_banks = devm_kcalloc(dev, tcm_bank_count, in zynqmp_r5_get_tcm_node_from_dt()
1051 if (!r5_core->tcm_banks) in zynqmp_r5_get_tcm_node_from_dt()
1052 return -ENOMEM; in zynqmp_r5_get_tcm_node_from_dt()
1054 r5_core->tcm_bank_count = tcm_bank_count; in zynqmp_r5_get_tcm_node_from_dt()
1059 return -ENOMEM; in zynqmp_r5_get_tcm_node_from_dt()
1061 r5_core->tcm_banks[j] = tcm; in zynqmp_r5_get_tcm_node_from_dt()
1063 /* Get power-domains id of TCM. */ in zynqmp_r5_get_tcm_node_from_dt()
1064 ret = of_parse_phandle_with_args(np, "power-domains", in zynqmp_r5_get_tcm_node_from_dt()
1065 "#power-domain-cells", in zynqmp_r5_get_tcm_node_from_dt()
1068 dev_err(r5_core->dev, in zynqmp_r5_get_tcm_node_from_dt()
1073 tcm->pm_domain_id = out_args.args[0]; in zynqmp_r5_get_tcm_node_from_dt()
1085 * so convert 64-bits into 32-bits. This will discard in zynqmp_r5_get_tcm_node_from_dt()
1086 * any unwanted upper 32-bits. in zynqmp_r5_get_tcm_node_from_dt()
1088 tcm->da = (u32)abs_addr; in zynqmp_r5_get_tcm_node_from_dt()
1089 tcm->size = (u32)size; in zynqmp_r5_get_tcm_node_from_dt()
1095 return -EINVAL; in zynqmp_r5_get_tcm_node_from_dt()
1098 tcm->addr = (u32)res->start; in zynqmp_r5_get_tcm_node_from_dt()
1099 tcm->bank_name = (char *)res->name; in zynqmp_r5_get_tcm_node_from_dt()
1100 res = devm_request_mem_region(dev, tcm->addr, tcm->size, in zynqmp_r5_get_tcm_node_from_dt()
1101 tcm->bank_name); in zynqmp_r5_get_tcm_node_from_dt()
1104 return -EINVAL; in zynqmp_r5_get_tcm_node_from_dt()
1116 * This approach is used as TCM bindings for system-dt is being developed
1125 struct device *dev = cluster->dev; in zynqmp_r5_get_tcm_node()
1130 if (cluster->mode == SPLIT_MODE) { in zynqmp_r5_get_tcm_node()
1139 tcm_bank_count = tcm_bank_count / cluster->core_count; in zynqmp_r5_get_tcm_node()
1147 for (i = 0; i < cluster->core_count; i++) { in zynqmp_r5_get_tcm_node()
1148 r5_core = cluster->r5_cores[i]; in zynqmp_r5_get_tcm_node()
1149 r5_core->tcm_banks = devm_kcalloc(dev, tcm_bank_count, in zynqmp_r5_get_tcm_node()
1152 if (!r5_core->tcm_banks) in zynqmp_r5_get_tcm_node()
1153 return -ENOMEM; in zynqmp_r5_get_tcm_node()
1157 * Use pre-defined TCM reg values. in zynqmp_r5_get_tcm_node()
1161 r5_core->tcm_banks[j] = in zynqmp_r5_get_tcm_node()
1166 r5_core->tcm_bank_count = tcm_bank_count; in zynqmp_r5_get_tcm_node()
1186 struct device *dev = cluster->dev; in zynqmp_r5_core_init()
1188 int ret = -EINVAL, i; in zynqmp_r5_core_init()
1190 r5_core = cluster->r5_cores[0]; in zynqmp_r5_core_init()
1193 if (of_property_present(r5_core->np, "reg")) in zynqmp_r5_core_init()
1195 else if (device_is_compatible(dev, "xlnx,zynqmp-r5fss")) in zynqmp_r5_core_init()
1203 for (i = 0; i < cluster->core_count; i++) { in zynqmp_r5_core_init()
1204 r5_core = cluster->r5_cores[i]; in zynqmp_r5_core_init()
1206 /* Initialize r5 cores with power-domains parsed from dts */ in zynqmp_r5_core_init()
1207 ret = of_property_read_u32_index(r5_core->np, "power-domains", in zynqmp_r5_core_init()
1208 1, &r5_core->pm_domain_id); in zynqmp_r5_core_init()
1210 dev_err(dev, "failed to get power-domains property\n"); in zynqmp_r5_core_init()
1214 ret = zynqmp_pm_set_rpu_mode(r5_core->pm_domain_id, fw_reg_val); in zynqmp_r5_core_init()
1216 dev_err(r5_core->dev, "failed to set RPU mode\n"); in zynqmp_r5_core_init()
1220 if (of_property_present(dev_of_node(dev), "xlnx,tcm-mode") || in zynqmp_r5_core_init()
1221 device_is_compatible(dev, "xlnx,zynqmp-r5fss")) { in zynqmp_r5_core_init()
1222 ret = zynqmp_pm_set_tcm_config(r5_core->pm_domain_id, in zynqmp_r5_core_init()
1225 dev_err(r5_core->dev, "failed to configure TCM\n"); in zynqmp_r5_core_init()
1249 struct device *dev = cluster->dev; in zynqmp_r5_cluster_init()
1258 struct mbox_info *ipi; in zynqmp_r5_cluster_init() local
1260 ret = of_property_read_u32(dev_node, "xlnx,cluster-mode", &cluster_mode); in zynqmp_r5_cluster_init()
1263 * on success returns 0, if not defined then returns -EINVAL, in zynqmp_r5_cluster_init()
1267 if (ret != -EINVAL && ret != 0) { in zynqmp_r5_cluster_init()
1268 dev_err(dev, "Invalid xlnx,cluster-mode property\n"); in zynqmp_r5_cluster_init()
1282 return -EINVAL; in zynqmp_r5_cluster_init()
1285 if (of_property_present(dev_node, "xlnx,tcm-mode")) { in zynqmp_r5_cluster_init()
1286 ret = of_property_read_u32(dev_node, "xlnx,tcm-mode", (u32 *)&tcm_mode); in zynqmp_r5_cluster_init()
1289 } else if (device_is_compatible(dev, "xlnx,zynqmp-r5fss")) { in zynqmp_r5_cluster_init()
1309 return -EINVAL; in zynqmp_r5_cluster_init()
1312 return -EINVAL; in zynqmp_r5_cluster_init()
1320 return -ENOMEM; in zynqmp_r5_cluster_init()
1326 return -ENOMEM; in zynqmp_r5_cluster_init()
1334 ret = -ENODEV; in zynqmp_r5_cluster_init()
1338 child_devs[i] = &child_pdev->dev; in zynqmp_r5_cluster_init()
1341 r5_cores[i] = zynqmp_r5_add_rproc_core(&child_pdev->dev); in zynqmp_r5_cluster_init()
1353 ipi = zynqmp_r5_setup_mbox(&child_pdev->dev); in zynqmp_r5_cluster_init()
1354 if (ipi) { in zynqmp_r5_cluster_init()
1355 r5_cores[i]->ipi = ipi; in zynqmp_r5_cluster_init()
1356 ipi->r5_core = r5_cores[i]; in zynqmp_r5_cluster_init()
1371 cluster->mode = cluster_mode; in zynqmp_r5_cluster_init()
1372 cluster->core_count = core_count; in zynqmp_r5_cluster_init()
1373 cluster->r5_cores = r5_cores; in zynqmp_r5_cluster_init()
1378 cluster->core_count = 0; in zynqmp_r5_cluster_init()
1379 cluster->r5_cores = NULL; in zynqmp_r5_cluster_init()
1385 i = core_count - 1; in zynqmp_r5_cluster_init()
1396 zynqmp_r5_free_mbox(r5_cores[i]->ipi); in zynqmp_r5_cluster_init()
1397 of_reserved_mem_device_release(r5_cores[i]->dev); in zynqmp_r5_cluster_init()
1398 rproc_del(r5_cores[i]->rproc); in zynqmp_r5_cluster_init()
1399 rproc_free(r5_cores[i]->rproc); in zynqmp_r5_cluster_init()
1401 i--; in zynqmp_r5_cluster_init()
1419 for (i = 0; i < cluster->core_count; i++) { in zynqmp_r5_cluster_exit()
1420 r5_core = cluster->r5_cores[i]; in zynqmp_r5_cluster_exit()
1421 zynqmp_r5_free_mbox(r5_core->ipi); in zynqmp_r5_cluster_exit()
1422 iounmap(r5_core->rsc_tbl_va); in zynqmp_r5_cluster_exit()
1423 of_reserved_mem_device_release(r5_core->dev); in zynqmp_r5_cluster_exit()
1424 put_device(r5_core->dev); in zynqmp_r5_cluster_exit()
1425 rproc_del(r5_core->rproc); in zynqmp_r5_cluster_exit()
1426 rproc_free(r5_core->rproc); in zynqmp_r5_cluster_exit()
1429 kfree(cluster->r5_cores); in zynqmp_r5_cluster_exit()
1436 * parse device-tree, initialize hardware and allocate required resources
1446 struct device *dev = &pdev->dev; in zynqmp_r5_remoteproc_probe()
1451 return -ENOMEM; in zynqmp_r5_remoteproc_probe()
1453 cluster->dev = dev; in zynqmp_r5_remoteproc_probe()
1482 { .compatible = "xlnx,versal-net-r52fss", },
1483 { .compatible = "xlnx,versal-r5fss", },
1484 { .compatible = "xlnx,zynqmp-r5fss", },