Lines Matching +full:meson8 +full:- +full:secbus2

1 // SPDX-License-Identifier: GPL-2.0-or-later
60 struct meson_mx_ao_arc_rproc_priv *priv = rproc->priv; in meson_mx_ao_arc_rproc_start()
65 ret = clk_prepare_enable(priv->arc_pclk); in meson_mx_ao_arc_rproc_start()
70 priv->sram_pa >> 14); in meson_mx_ao_arc_rproc_start()
71 writel(tmp, priv->remap_base + AO_REMAP_REG0); in meson_mx_ao_arc_rproc_start()
78 * same. (At least) For Meson8 and newer that bit must not be set. in meson_mx_ao_arc_rproc_start()
80 writel(0x0, priv->remap_base + AO_REMAP_REG1); in meson_mx_ao_arc_rproc_start()
82 regmap_update_bits(priv->secbus2_regmap, AO_SECURE_REG0, in meson_mx_ao_arc_rproc_start()
85 priv->sram_pa >> 12)); in meson_mx_ao_arc_rproc_start()
87 ret = reset_control_reset(priv->arc_reset); in meson_mx_ao_arc_rproc_start()
89 clk_disable_unprepare(priv->arc_pclk); in meson_mx_ao_arc_rproc_start()
100 translated_sram_addr = priv->sram_pa - MESON_AO_RPROC_MEMORY_OFFSET; in meson_mx_ao_arc_rproc_start()
105 writel(tmp, priv->cpu_base + AO_CPU_CNTL); in meson_mx_ao_arc_rproc_start()
114 struct meson_mx_ao_arc_rproc_priv *priv = rproc->priv; in meson_mx_ao_arc_rproc_stop()
116 writel(AO_CPU_CNTL_HALT, priv->cpu_base + AO_CPU_CNTL); in meson_mx_ao_arc_rproc_stop()
118 clk_disable_unprepare(priv->arc_pclk); in meson_mx_ao_arc_rproc_stop()
126 struct meson_mx_ao_arc_rproc_priv *priv = rproc->priv; in meson_mx_ao_arc_rproc_da_to_va()
129 if ((da + len) > priv->sram_size) in meson_mx_ao_arc_rproc_da_to_va()
132 return (void *)priv->sram_va + da; in meson_mx_ao_arc_rproc_da_to_va()
147 struct device *dev = &pdev->dev; in meson_mx_ao_arc_rproc_probe()
152 device_property_read_string(dev, "firmware-name", &fw_name); in meson_mx_ao_arc_rproc_probe()
154 rproc = devm_rproc_alloc(dev, "meson-mx-ao-arc", in meson_mx_ao_arc_rproc_probe()
158 return -ENOMEM; in meson_mx_ao_arc_rproc_probe()
160 rproc->has_iommu = false; in meson_mx_ao_arc_rproc_probe()
161 priv = rproc->priv; in meson_mx_ao_arc_rproc_probe()
163 priv->sram_pool = of_gen_pool_get(dev->of_node, "sram", 0); in meson_mx_ao_arc_rproc_probe()
164 if (!priv->sram_pool) { in meson_mx_ao_arc_rproc_probe()
166 return -ENODEV; in meson_mx_ao_arc_rproc_probe()
169 priv->sram_size = gen_pool_avail(priv->sram_pool); in meson_mx_ao_arc_rproc_probe()
171 priv->sram_va = gen_pool_alloc(priv->sram_pool, priv->sram_size); in meson_mx_ao_arc_rproc_probe()
172 if (!priv->sram_va) { in meson_mx_ao_arc_rproc_probe()
174 return -ENOMEM; in meson_mx_ao_arc_rproc_probe()
177 priv->sram_pa = gen_pool_virt_to_phys(priv->sram_pool, priv->sram_va); in meson_mx_ao_arc_rproc_probe()
178 if (priv->sram_pa & ~MESON_AO_RPROC_SRAM_USABLE_BITS) { in meson_mx_ao_arc_rproc_probe()
180 ret = -EINVAL; in meson_mx_ao_arc_rproc_probe()
184 priv->secbus2_regmap = syscon_regmap_lookup_by_phandle(dev->of_node, in meson_mx_ao_arc_rproc_probe()
185 "amlogic,secbus2"); in meson_mx_ao_arc_rproc_probe()
186 if (IS_ERR(priv->secbus2_regmap)) { in meson_mx_ao_arc_rproc_probe()
187 dev_err(dev, "Failed to find SECBUS2 regmap\n"); in meson_mx_ao_arc_rproc_probe()
188 ret = PTR_ERR(priv->secbus2_regmap); in meson_mx_ao_arc_rproc_probe()
192 priv->remap_base = devm_platform_ioremap_resource_byname(pdev, "remap"); in meson_mx_ao_arc_rproc_probe()
193 if (IS_ERR(priv->remap_base)) { in meson_mx_ao_arc_rproc_probe()
194 ret = PTR_ERR(priv->remap_base); in meson_mx_ao_arc_rproc_probe()
198 priv->cpu_base = devm_platform_ioremap_resource_byname(pdev, "cpu"); in meson_mx_ao_arc_rproc_probe()
199 if (IS_ERR(priv->cpu_base)) { in meson_mx_ao_arc_rproc_probe()
200 ret = PTR_ERR(priv->cpu_base); in meson_mx_ao_arc_rproc_probe()
204 priv->arc_reset = devm_reset_control_get_exclusive(dev, NULL); in meson_mx_ao_arc_rproc_probe()
205 if (IS_ERR(priv->arc_reset)) { in meson_mx_ao_arc_rproc_probe()
207 ret = PTR_ERR(priv->arc_reset); in meson_mx_ao_arc_rproc_probe()
211 priv->arc_pclk = devm_clk_get(dev, NULL); in meson_mx_ao_arc_rproc_probe()
212 if (IS_ERR(priv->arc_pclk)) { in meson_mx_ao_arc_rproc_probe()
214 ret = PTR_ERR(priv->arc_pclk); in meson_mx_ao_arc_rproc_probe()
227 gen_pool_free(priv->sram_pool, priv->sram_va, priv->sram_size); in meson_mx_ao_arc_rproc_probe()
234 struct meson_mx_ao_arc_rproc_priv *priv = rproc->priv; in meson_mx_ao_arc_rproc_remove()
237 gen_pool_free(priv->sram_pool, priv->sram_va, priv->sram_size); in meson_mx_ao_arc_rproc_remove()
241 { .compatible = "amlogic,meson8-ao-arc" },
242 { .compatible = "amlogic,meson8b-ao-arc" },
251 .name = "meson-mx-ao-arc-rproc",