Lines Matching refs:slim_rproc

57 static int slim_clk_get(struct st_slim_rproc *slim_rproc, struct device *dev)  in slim_clk_get()  argument
62 slim_rproc->clks[clk] = of_clk_get(dev->of_node, clk); in slim_clk_get()
63 if (IS_ERR(slim_rproc->clks[clk])) { in slim_clk_get()
64 err = PTR_ERR(slim_rproc->clks[clk]); in slim_clk_get()
67 slim_rproc->clks[clk] = NULL; in slim_clk_get()
76 clk_put(slim_rproc->clks[clk]); in slim_clk_get()
81 static void slim_clk_disable(struct st_slim_rproc *slim_rproc) in slim_clk_disable() argument
85 for (clk = 0; clk < ST_SLIM_MAX_CLK && slim_rproc->clks[clk]; clk++) in slim_clk_disable()
86 clk_disable_unprepare(slim_rproc->clks[clk]); in slim_clk_disable()
89 static int slim_clk_enable(struct st_slim_rproc *slim_rproc) in slim_clk_enable() argument
93 for (clk = 0; clk < ST_SLIM_MAX_CLK && slim_rproc->clks[clk]; clk++) { in slim_clk_enable()
94 ret = clk_prepare_enable(slim_rproc->clks[clk]); in slim_clk_enable()
103 clk_disable_unprepare(slim_rproc->clks[clk]); in slim_clk_enable()
114 struct st_slim_rproc *slim_rproc = rproc->priv; in slim_rproc_start() local
120 writel(val, slim_rproc->slimcore + SLIM_CLK_GATE_OFST); in slim_rproc_start()
123 writel(SLIM_STBUS_SYNC_DIS, slim_rproc->peri + SLIM_STBUS_SYNC_OFST); in slim_rproc_start()
127 slim_rproc->slimcore + SLIM_CLK_GATE_OFST); in slim_rproc_start()
130 writel(~0U, slim_rproc->peri + SLIM_INT_CLR_OFST); in slim_rproc_start()
131 writel(~0U, slim_rproc->peri + SLIM_CMD_CLR_OFST); in slim_rproc_start()
134 writel(~0U, slim_rproc->peri + SLIM_INT_MASK_OFST); in slim_rproc_start()
135 writel(~0U, slim_rproc->peri + SLIM_CMD_MASK_OFST); in slim_rproc_start()
138 writel(SLIM_EN_RUN, slim_rproc->slimcore + SLIM_EN_OFST); in slim_rproc_start()
140 hw_id = readl_relaxed(slim_rproc->slimcore + SLIM_ID_OFST); in slim_rproc_start()
141 hw_ver = readl_relaxed(slim_rproc->slimcore + SLIM_VER_OFST); in slim_rproc_start()
143 fw_rev = readl(slim_rproc->mem[ST_SLIM_DMEM].cpu_addr + in slim_rproc_start()
155 struct st_slim_rproc *slim_rproc = rproc->priv; in slim_rproc_stop() local
159 writel(0UL, slim_rproc->peri + SLIM_INT_MASK_OFST); in slim_rproc_stop()
160 writel(0UL, slim_rproc->peri + SLIM_CMD_MASK_OFST); in slim_rproc_stop()
163 writel(SLIM_CLK_GATE_DIS, slim_rproc->slimcore + SLIM_CLK_GATE_OFST); in slim_rproc_stop()
165 writel(!SLIM_EN_RUN, slim_rproc->slimcore + SLIM_EN_OFST); in slim_rproc_stop()
167 val = readl(slim_rproc->slimcore + SLIM_EN_OFST); in slim_rproc_stop()
178 struct st_slim_rproc *slim_rproc = rproc->priv; in slim_rproc_da_to_va() local
183 if (da != slim_rproc->mem[i].bus_addr) in slim_rproc_da_to_va()
186 if (len <= slim_rproc->mem[i].size) { in slim_rproc_da_to_va()
188 va = (__force void *)slim_rproc->mem[i].cpu_addr; in slim_rproc_da_to_va()
225 struct st_slim_rproc *slim_rproc; in st_slim_rproc_alloc() local
238 fw_name, sizeof(*slim_rproc)); in st_slim_rproc_alloc()
244 slim_rproc = rproc->priv; in st_slim_rproc_alloc()
245 slim_rproc->rproc = rproc; in st_slim_rproc_alloc()
252 slim_rproc->mem[i].cpu_addr = devm_ioremap_resource(dev, res); in st_slim_rproc_alloc()
253 if (IS_ERR(slim_rproc->mem[i].cpu_addr)) { in st_slim_rproc_alloc()
255 err = PTR_ERR(slim_rproc->mem[i].cpu_addr); in st_slim_rproc_alloc()
258 slim_rproc->mem[i].bus_addr = res->start; in st_slim_rproc_alloc()
259 slim_rproc->mem[i].size = resource_size(res); in st_slim_rproc_alloc()
263 slim_rproc->slimcore = devm_ioremap_resource(dev, res); in st_slim_rproc_alloc()
264 if (IS_ERR(slim_rproc->slimcore)) { in st_slim_rproc_alloc()
266 err = PTR_ERR(slim_rproc->slimcore); in st_slim_rproc_alloc()
271 slim_rproc->peri = devm_ioremap_resource(dev, res); in st_slim_rproc_alloc()
272 if (IS_ERR(slim_rproc->peri)) { in st_slim_rproc_alloc()
274 err = PTR_ERR(slim_rproc->peri); in st_slim_rproc_alloc()
278 err = slim_clk_get(slim_rproc, dev); in st_slim_rproc_alloc()
282 err = slim_clk_enable(slim_rproc); in st_slim_rproc_alloc()
295 return slim_rproc; in st_slim_rproc_alloc()
298 slim_clk_disable(slim_rproc); in st_slim_rproc_alloc()
300 for (i = 0; i < ST_SLIM_MAX_CLK && slim_rproc->clks[i]; i++) in st_slim_rproc_alloc()
301 clk_put(slim_rproc->clks[i]); in st_slim_rproc_alloc()
315 void st_slim_rproc_put(struct st_slim_rproc *slim_rproc) in st_slim_rproc_put() argument
319 if (!slim_rproc) in st_slim_rproc_put()
322 slim_clk_disable(slim_rproc); in st_slim_rproc_put()
324 for (clk = 0; clk < ST_SLIM_MAX_CLK && slim_rproc->clks[clk]; clk++) in st_slim_rproc_put()
325 clk_put(slim_rproc->clks[clk]); in st_slim_rproc_put()
327 rproc_del(slim_rproc->rproc); in st_slim_rproc_put()
328 rproc_free(slim_rproc->rproc); in st_slim_rproc_put()