Lines Matching refs:kproc

112 	struct k3_dsp_rproc *kproc = container_of(client, struct k3_dsp_rproc,  in k3_dsp_rproc_mbox_callback()  local
114 struct device *dev = kproc->rproc->dev.parent; in k3_dsp_rproc_mbox_callback()
115 const char *name = kproc->rproc->name; in k3_dsp_rproc_mbox_callback()
135 if (msg > kproc->rproc->max_notifyid) { in k3_dsp_rproc_mbox_callback()
140 if (rproc_vq_interrupt(kproc->rproc, msg) == IRQ_NONE) in k3_dsp_rproc_mbox_callback()
153 struct k3_dsp_rproc *kproc = rproc->priv; in k3_dsp_rproc_kick() local
159 ret = mbox_send_message(kproc->mbox, (void *)msg); in k3_dsp_rproc_kick()
166 static int k3_dsp_rproc_reset(struct k3_dsp_rproc *kproc) in k3_dsp_rproc_reset() argument
168 struct device *dev = kproc->dev; in k3_dsp_rproc_reset()
171 ret = reset_control_assert(kproc->reset); in k3_dsp_rproc_reset()
177 if (kproc->data->uses_lreset) in k3_dsp_rproc_reset()
180 ret = kproc->ti_sci->ops.dev_ops.put_device(kproc->ti_sci, in k3_dsp_rproc_reset()
181 kproc->ti_sci_id); in k3_dsp_rproc_reset()
184 if (reset_control_deassert(kproc->reset)) in k3_dsp_rproc_reset()
192 static int k3_dsp_rproc_release(struct k3_dsp_rproc *kproc) in k3_dsp_rproc_release() argument
194 struct device *dev = kproc->dev; in k3_dsp_rproc_release()
197 if (kproc->data->uses_lreset) in k3_dsp_rproc_release()
200 ret = kproc->ti_sci->ops.dev_ops.get_device(kproc->ti_sci, in k3_dsp_rproc_release()
201 kproc->ti_sci_id); in k3_dsp_rproc_release()
208 ret = reset_control_deassert(kproc->reset); in k3_dsp_rproc_release()
211 if (kproc->ti_sci->ops.dev_ops.put_device(kproc->ti_sci, in k3_dsp_rproc_release()
212 kproc->ti_sci_id)) in k3_dsp_rproc_release()
221 struct k3_dsp_rproc *kproc = rproc->priv; in k3_dsp_rproc_request_mbox() local
222 struct mbox_client *client = &kproc->client; in k3_dsp_rproc_request_mbox()
223 struct device *dev = kproc->dev; in k3_dsp_rproc_request_mbox()
232 kproc->mbox = mbox_request_channel(client, 0); in k3_dsp_rproc_request_mbox()
233 if (IS_ERR(kproc->mbox)) { in k3_dsp_rproc_request_mbox()
236 PTR_ERR(kproc->mbox)); in k3_dsp_rproc_request_mbox()
247 ret = mbox_send_message(kproc->mbox, (void *)RP_MBOX_ECHO_REQUEST); in k3_dsp_rproc_request_mbox()
250 mbox_free_channel(kproc->mbox); in k3_dsp_rproc_request_mbox()
268 struct k3_dsp_rproc *kproc = rproc->priv; in k3_dsp_rproc_prepare() local
269 struct device *dev = kproc->dev; in k3_dsp_rproc_prepare()
272 ret = kproc->ti_sci->ops.dev_ops.get_device(kproc->ti_sci, in k3_dsp_rproc_prepare()
273 kproc->ti_sci_id); in k3_dsp_rproc_prepare()
292 struct k3_dsp_rproc *kproc = rproc->priv; in k3_dsp_rproc_unprepare() local
293 struct device *dev = kproc->dev; in k3_dsp_rproc_unprepare()
296 ret = kproc->ti_sci->ops.dev_ops.put_device(kproc->ti_sci, in k3_dsp_rproc_unprepare()
297 kproc->ti_sci_id); in k3_dsp_rproc_unprepare()
313 struct k3_dsp_rproc *kproc = rproc->priv; in k3_dsp_rproc_start() local
314 struct device *dev = kproc->dev; in k3_dsp_rproc_start()
323 if (boot_addr & (kproc->data->boot_align_addr - 1)) { in k3_dsp_rproc_start()
325 boot_addr, kproc->data->boot_align_addr); in k3_dsp_rproc_start()
331 ret = ti_sci_proc_set_config(kproc->tsp, boot_addr, 0, 0); in k3_dsp_rproc_start()
335 ret = k3_dsp_rproc_release(kproc); in k3_dsp_rproc_start()
342 mbox_free_channel(kproc->mbox); in k3_dsp_rproc_start()
354 struct k3_dsp_rproc *kproc = rproc->priv; in k3_dsp_rproc_stop() local
356 mbox_free_channel(kproc->mbox); in k3_dsp_rproc_stop()
358 k3_dsp_rproc_reset(kproc); in k3_dsp_rproc_stop()
373 struct k3_dsp_rproc *kproc = rproc->priv; in k3_dsp_rproc_attach() local
374 struct device *dev = kproc->dev; in k3_dsp_rproc_attach()
395 struct k3_dsp_rproc *kproc = rproc->priv; in k3_dsp_rproc_detach() local
396 struct device *dev = kproc->dev; in k3_dsp_rproc_detach()
398 mbox_free_channel(kproc->mbox); in k3_dsp_rproc_detach()
416 struct k3_dsp_rproc *kproc = rproc->priv; in k3_dsp_get_loaded_rsc_table() local
417 struct device *dev = kproc->dev; in k3_dsp_get_loaded_rsc_table()
419 if (!kproc->rmem[0].cpu_addr) { in k3_dsp_get_loaded_rsc_table()
432 return (struct resource_table *)kproc->rmem[0].cpu_addr; in k3_dsp_get_loaded_rsc_table()
445 struct k3_dsp_rproc *kproc = rproc->priv; in k3_dsp_rproc_da_to_va() local
455 for (i = 0; i < kproc->num_mems; i++) { in k3_dsp_rproc_da_to_va()
456 bus_addr = kproc->mem[i].bus_addr; in k3_dsp_rproc_da_to_va()
457 dev_addr = kproc->mem[i].dev_addr; in k3_dsp_rproc_da_to_va()
458 size = kproc->mem[i].size; in k3_dsp_rproc_da_to_va()
465 va = kproc->mem[i].cpu_addr + offset; in k3_dsp_rproc_da_to_va()
473 va = kproc->mem[i].cpu_addr + offset; in k3_dsp_rproc_da_to_va()
480 for (i = 0; i < kproc->num_rmems; i++) { in k3_dsp_rproc_da_to_va()
481 dev_addr = kproc->rmem[i].dev_addr; in k3_dsp_rproc_da_to_va()
482 size = kproc->rmem[i].size; in k3_dsp_rproc_da_to_va()
486 va = kproc->rmem[i].cpu_addr + offset; in k3_dsp_rproc_da_to_va()
502 struct k3_dsp_rproc *kproc) in k3_dsp_rproc_of_get_memories() argument
504 const struct k3_dsp_dev_data *data = kproc->data; in k3_dsp_rproc_of_get_memories()
510 num_mems = kproc->data->num_mems; in k3_dsp_rproc_of_get_memories()
511 kproc->mem = devm_kcalloc(kproc->dev, num_mems, in k3_dsp_rproc_of_get_memories()
512 sizeof(*kproc->mem), GFP_KERNEL); in k3_dsp_rproc_of_get_memories()
513 if (!kproc->mem) in k3_dsp_rproc_of_get_memories()
532 kproc->mem[i].cpu_addr = devm_ioremap_wc(dev, res->start, in k3_dsp_rproc_of_get_memories()
534 if (!kproc->mem[i].cpu_addr) { in k3_dsp_rproc_of_get_memories()
539 kproc->mem[i].bus_addr = res->start; in k3_dsp_rproc_of_get_memories()
540 kproc->mem[i].dev_addr = data->mems[i].dev_addr; in k3_dsp_rproc_of_get_memories()
541 kproc->mem[i].size = resource_size(res); in k3_dsp_rproc_of_get_memories()
544 data->mems[i].name, &kproc->mem[i].bus_addr, in k3_dsp_rproc_of_get_memories()
545 kproc->mem[i].size, kproc->mem[i].cpu_addr, in k3_dsp_rproc_of_get_memories()
546 kproc->mem[i].dev_addr); in k3_dsp_rproc_of_get_memories()
548 kproc->num_mems = num_mems; in k3_dsp_rproc_of_get_memories()
553 static int k3_dsp_reserved_mem_init(struct k3_dsp_rproc *kproc) in k3_dsp_reserved_mem_init() argument
555 struct device *dev = kproc->dev; in k3_dsp_reserved_mem_init()
584 kproc->rmem = kcalloc(num_rmems, sizeof(*kproc->rmem), GFP_KERNEL); in k3_dsp_reserved_mem_init()
585 if (!kproc->rmem) { in k3_dsp_reserved_mem_init()
606 kproc->rmem[i].bus_addr = rmem->base; in k3_dsp_reserved_mem_init()
608 kproc->rmem[i].dev_addr = (u32)rmem->base; in k3_dsp_reserved_mem_init()
609 kproc->rmem[i].size = rmem->size; in k3_dsp_reserved_mem_init()
610 kproc->rmem[i].cpu_addr = ioremap_wc(rmem->base, rmem->size); in k3_dsp_reserved_mem_init()
611 if (!kproc->rmem[i].cpu_addr) { in k3_dsp_reserved_mem_init()
619 i + 1, &kproc->rmem[i].bus_addr, in k3_dsp_reserved_mem_init()
620 kproc->rmem[i].size, kproc->rmem[i].cpu_addr, in k3_dsp_reserved_mem_init()
621 kproc->rmem[i].dev_addr); in k3_dsp_reserved_mem_init()
623 kproc->num_rmems = num_rmems; in k3_dsp_reserved_mem_init()
629 iounmap(kproc->rmem[i].cpu_addr); in k3_dsp_reserved_mem_init()
630 kfree(kproc->rmem); in k3_dsp_reserved_mem_init()
632 of_reserved_mem_device_release(kproc->dev); in k3_dsp_reserved_mem_init()
636 static void k3_dsp_reserved_mem_exit(struct k3_dsp_rproc *kproc) in k3_dsp_reserved_mem_exit() argument
640 for (i = 0; i < kproc->num_rmems; i++) in k3_dsp_reserved_mem_exit()
641 iounmap(kproc->rmem[i].cpu_addr); in k3_dsp_reserved_mem_exit()
642 kfree(kproc->rmem); in k3_dsp_reserved_mem_exit()
644 of_reserved_mem_device_release(kproc->dev); in k3_dsp_reserved_mem_exit()
678 struct k3_dsp_rproc *kproc; in k3_dsp_rproc_probe() local
697 sizeof(*kproc)); in k3_dsp_rproc_probe()
707 kproc = rproc->priv; in k3_dsp_rproc_probe()
708 kproc->rproc = rproc; in k3_dsp_rproc_probe()
709 kproc->dev = dev; in k3_dsp_rproc_probe()
710 kproc->data = data; in k3_dsp_rproc_probe()
712 kproc->ti_sci = ti_sci_get_by_phandle(np, "ti,sci"); in k3_dsp_rproc_probe()
713 if (IS_ERR(kproc->ti_sci)) { in k3_dsp_rproc_probe()
714 ret = PTR_ERR(kproc->ti_sci); in k3_dsp_rproc_probe()
719 kproc->ti_sci = NULL; in k3_dsp_rproc_probe()
723 ret = of_property_read_u32(np, "ti,sci-dev-id", &kproc->ti_sci_id); in k3_dsp_rproc_probe()
729 kproc->reset = devm_reset_control_get_exclusive(dev, NULL); in k3_dsp_rproc_probe()
730 if (IS_ERR(kproc->reset)) { in k3_dsp_rproc_probe()
731 ret = PTR_ERR(kproc->reset); in k3_dsp_rproc_probe()
736 kproc->tsp = k3_dsp_rproc_of_get_tsp(dev, kproc->ti_sci); in k3_dsp_rproc_probe()
737 if (IS_ERR(kproc->tsp)) { in k3_dsp_rproc_probe()
740 ret = PTR_ERR(kproc->tsp); in k3_dsp_rproc_probe()
744 ret = ti_sci_proc_request(kproc->tsp); in k3_dsp_rproc_probe()
750 ret = k3_dsp_rproc_of_get_memories(pdev, kproc); in k3_dsp_rproc_probe()
754 ret = k3_dsp_reserved_mem_init(kproc); in k3_dsp_rproc_probe()
760 ret = kproc->ti_sci->ops.dev_ops.is_on(kproc->ti_sci, kproc->ti_sci_id, in k3_dsp_rproc_probe()
788 ret = reset_control_status(kproc->reset); in k3_dsp_rproc_probe()
795 k3_dsp_rproc_reset(kproc); in k3_dsp_rproc_probe()
807 platform_set_drvdata(pdev, kproc); in k3_dsp_rproc_probe()
812 k3_dsp_reserved_mem_exit(kproc); in k3_dsp_rproc_probe()
814 ret1 = ti_sci_proc_release(kproc->tsp); in k3_dsp_rproc_probe()
818 kfree(kproc->tsp); in k3_dsp_rproc_probe()
820 ret1 = ti_sci_put_handle(kproc->ti_sci); in k3_dsp_rproc_probe()
830 struct k3_dsp_rproc *kproc = platform_get_drvdata(pdev); in k3_dsp_rproc_remove() local
831 struct rproc *rproc = kproc->rproc; in k3_dsp_rproc_remove()
843 rproc_del(kproc->rproc); in k3_dsp_rproc_remove()
845 ret = ti_sci_proc_release(kproc->tsp); in k3_dsp_rproc_remove()
849 kfree(kproc->tsp); in k3_dsp_rproc_remove()
851 ret = ti_sci_put_handle(kproc->ti_sci); in k3_dsp_rproc_remove()
855 k3_dsp_reserved_mem_exit(kproc); in k3_dsp_rproc_remove()
856 rproc_free(kproc->rproc); in k3_dsp_rproc_remove()