Lines Matching +full:jz4770 +full:- +full:vpu +full:- +full:rproc
1 // SPDX-License-Identifier: GPL-2.0+
33 "Auto-boot the remote processor [default=false]");
53 * struct vpu - Ingenic VPU remoteproc private structure
55 * @clks: pointers to the VPU and AUX clocks
61 struct vpu { struct
69 static int ingenic_rproc_prepare(struct rproc *rproc) in ingenic_rproc_prepare() argument
71 struct vpu *vpu = rproc->priv; in ingenic_rproc_prepare() argument
75 ret = clk_bulk_prepare_enable(ARRAY_SIZE(vpu->clks), vpu->clks); in ingenic_rproc_prepare()
77 dev_err(vpu->dev, "Unable to start clocks: %d\n", ret); in ingenic_rproc_prepare()
82 static int ingenic_rproc_unprepare(struct rproc *rproc) in ingenic_rproc_unprepare() argument
84 struct vpu *vpu = rproc->priv; in ingenic_rproc_unprepare() local
86 clk_bulk_disable_unprepare(ARRAY_SIZE(vpu->clks), vpu->clks); in ingenic_rproc_unprepare()
91 static int ingenic_rproc_start(struct rproc *rproc) in ingenic_rproc_start() argument
93 struct vpu *vpu = rproc->priv; in ingenic_rproc_start() local
96 enable_irq(vpu->irq); in ingenic_rproc_start()
100 writel(ctrl, vpu->aux_base + REG_AUX_CTRL); in ingenic_rproc_start()
105 static int ingenic_rproc_stop(struct rproc *rproc) in ingenic_rproc_stop() argument
107 struct vpu *vpu = rproc->priv; in ingenic_rproc_stop() local
109 disable_irq(vpu->irq); in ingenic_rproc_stop()
112 writel(AUX_CTRL_SW_RESET, vpu->aux_base + REG_AUX_CTRL); in ingenic_rproc_stop()
117 static void ingenic_rproc_kick(struct rproc *rproc, int vqid) in ingenic_rproc_kick() argument
119 struct vpu *vpu = rproc->priv; in ingenic_rproc_kick() local
121 writel(vqid, vpu->aux_base + REG_CORE_MSG); in ingenic_rproc_kick()
124 static void *ingenic_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem) in ingenic_rproc_da_to_va() argument
126 struct vpu *vpu = rproc->priv; in ingenic_rproc_da_to_va() local
131 const struct vpu_mem_info *info = &vpu->mem_info[i]; in ingenic_rproc_da_to_va()
132 const struct vpu_mem_map *map = info->map; in ingenic_rproc_da_to_va()
134 if (da >= map->da && (da + len) < (map->da + info->len)) { in ingenic_rproc_da_to_va()
135 va = info->base + (da - map->da); in ingenic_rproc_da_to_va()
154 struct rproc *rproc = data; in vpu_interrupt() local
155 struct vpu *vpu = rproc->priv; in vpu_interrupt() local
158 vring = readl(vpu->aux_base + REG_AUX_MSG); in vpu_interrupt()
161 writel(0, vpu->aux_base + REG_AUX_MSG_ACK); in vpu_interrupt()
163 return rproc_vq_interrupt(rproc, vring); in vpu_interrupt()
168 struct device *dev = &pdev->dev; in ingenic_rproc_probe()
170 struct rproc *rproc; in ingenic_rproc_probe() local
171 struct vpu *vpu; in ingenic_rproc_probe() local
175 rproc = devm_rproc_alloc(dev, "ingenic-vpu", in ingenic_rproc_probe()
176 &ingenic_rproc_ops, NULL, sizeof(*vpu)); in ingenic_rproc_probe()
177 if (!rproc) in ingenic_rproc_probe()
178 return -ENOMEM; in ingenic_rproc_probe()
180 rproc->auto_boot = auto_boot; in ingenic_rproc_probe()
182 vpu = rproc->priv; in ingenic_rproc_probe()
183 vpu->dev = &pdev->dev; in ingenic_rproc_probe()
184 platform_set_drvdata(pdev, vpu); in ingenic_rproc_probe()
187 vpu->aux_base = devm_ioremap_resource(dev, mem); in ingenic_rproc_probe()
188 if (IS_ERR(vpu->aux_base)) { in ingenic_rproc_probe()
190 return PTR_ERR(vpu->aux_base); in ingenic_rproc_probe()
197 vpu->mem_info[i].base = devm_ioremap_resource(dev, mem); in ingenic_rproc_probe()
198 if (IS_ERR(vpu->mem_info[i].base)) { in ingenic_rproc_probe()
199 ret = PTR_ERR(vpu->mem_info[i].base); in ingenic_rproc_probe()
204 vpu->mem_info[i].len = resource_size(mem); in ingenic_rproc_probe()
205 vpu->mem_info[i].map = &vpu_mem_map[i]; in ingenic_rproc_probe()
208 vpu->clks[0].id = "vpu"; in ingenic_rproc_probe()
209 vpu->clks[1].id = "aux"; in ingenic_rproc_probe()
211 ret = devm_clk_bulk_get(dev, ARRAY_SIZE(vpu->clks), vpu->clks); in ingenic_rproc_probe()
217 vpu->irq = platform_get_irq(pdev, 0); in ingenic_rproc_probe()
218 if (vpu->irq < 0) in ingenic_rproc_probe()
219 return vpu->irq; in ingenic_rproc_probe()
221 ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, IRQF_NO_AUTOEN, in ingenic_rproc_probe()
222 "VPU", rproc); in ingenic_rproc_probe()
228 ret = devm_rproc_add(dev, rproc); in ingenic_rproc_probe()
238 { .compatible = "ingenic,jz4770-vpu-rproc", },
246 .name = "ingenic-vpu",