Lines Matching +full:device +full:- +full:sram
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>
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
46 * @da: device address
48 * @pm_domain_id: Power-domains id of memory bank for firmware to turn on/off
60 * struct zynqmp_sram_bank - sram bank description
62 * @sram_res: sram address region information
63 * @da: device address of sram
98 * @magic_num: 32-bit magic number.
113 * compatibility with device-tree that does not have TCM information.
134 * @sram: Array of sram memories assigned to this core
135 * @num_sram: number of sram for this core
136 * @dev: device of RPU instance
137 * @np: device node of RPU instance
147 struct zynqmp_sram_bank *sram; member
149 struct device *dev;
162 * @dev: r5f subsystem cluster device node
168 struct device *dev;
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
207 rproc = ipi->r5_core->rproc; 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
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
258 * @cdev: child node device
263 static struct mbox_info *zynqmp_r5_setup_mbox(struct device *cdev) 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()
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()
298 INIT_WORK(&ipi->mbox_work, handle_event_notified); in zynqmp_r5_setup_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()
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()
334 ipi = r5_core->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()
367 * from 0xFFFF_0000 (HIVEC) which is mapped in the OCM (On-Chip Memory) 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()
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()
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()
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()
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()
516 struct zynqmp_sram_bank *sram; in add_sram_carveouts() local
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
609 struct device *dev; in add_tcm_banks()
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()
706 * @rproc: Device node of each rproc
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
739 * @rproc: Device node of each rproc
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()
883 * @cdev: Device node of each r5 core
887 static struct zynqmp_r5_core *zynqmp_r5_add_rproc_core(struct device *cdev) in zynqmp_r5_add_rproc_core()
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()
914 dev_err(cdev, "can't get device node for r5 core\n"); 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()
948 struct zynqmp_sram_bank *sram; in zynqmp_r5_get_sram_banks() local
953 /* "sram" is optional property. Do not fail, if unavailable. */ in zynqmp_r5_get_sram_banks()
954 if (!of_property_present(r5_core->np, "sram")) in zynqmp_r5_get_sram_banks()
957 num_sram = of_property_count_elems_of_size(np, "sram", sizeof(phandle)); in zynqmp_r5_get_sram_banks()
959 dev_err(dev, "Invalid sram property, ret = %d\n", in zynqmp_r5_get_sram_banks()
961 return -EINVAL; in zynqmp_r5_get_sram_banks()
964 sram = devm_kcalloc(dev, num_sram, in zynqmp_r5_get_sram_banks()
966 if (!sram) in zynqmp_r5_get_sram_banks()
967 return -ENOMEM; in zynqmp_r5_get_sram_banks()
970 sram_np = of_parse_phandle(np, "sram", i); in zynqmp_r5_get_sram_banks()
972 dev_err(dev, "failed to get sram %d phandle\n", i); in zynqmp_r5_get_sram_banks()
973 return -EINVAL; in zynqmp_r5_get_sram_banks()
977 dev_err(dev, "sram device not available\n"); in zynqmp_r5_get_sram_banks()
978 ret = -EINVAL; in zynqmp_r5_get_sram_banks()
982 ret = of_address_to_resource(sram_np, 0, &sram[i].sram_res); in zynqmp_r5_get_sram_banks()
988 /* Get SRAM device address */ in zynqmp_r5_get_sram_banks()
995 sram[i].da = (u32)abs_addr; in zynqmp_r5_get_sram_banks()
999 dev_dbg(dev, "sram %d: name=%s, addr=0x%llx, da=0x%x, size=0x%llx\n", in zynqmp_r5_get_sram_banks()
1000 i, sram[i].sram_res.name, sram[i].sram_res.start, in zynqmp_r5_get_sram_banks()
1001 sram[i].da, resource_size(&sram[i].sram_res)); 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()
1025 struct device *dev; in zynqmp_r5_get_tcm_node_from_dt()
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()
1254 struct device **child_devs; in zynqmp_r5_cluster_init()
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()
1318 child_devs = kcalloc(core_count, sizeof(struct device *), GFP_KERNEL); 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()
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
1439 * @pdev: domain platform device for R5 cluster
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()
1469 dev_err_probe(dev, ret, "Invalid r5f subsystem device tree\n"); in zynqmp_r5_remoteproc_probe()
1482 { .compatible = "xlnx,versal-net-r52fss", },
1483 { .compatible = "xlnx,versal-r5fss", },
1484 { .compatible = "xlnx,zynqmp-r5fss", },