• Home
  • Raw
  • Download

Lines Matching refs:mc

27 	struct meson_dev *mc = (struct meson_dev *)data;  in meson_irq_handler()  local
32 if (mc->irqs[flow] == irq) { in meson_irq_handler()
33 p = readl(mc->base + ((0x04 + flow) << 2)); in meson_irq_handler()
35 writel_relaxed(0xF, mc->base + ((0x4 + flow) << 2)); in meson_irq_handler()
36 mc->chanlist[flow].status = 1; in meson_irq_handler()
37 complete(&mc->chanlist[flow].complete); in meson_irq_handler()
40 dev_err(mc->dev, "%s %d Got irq for flow %d but ctrl is empty\n", __func__, irq, flow); in meson_irq_handler()
44 dev_err(mc->dev, "%s %d from unknown irq\n", __func__, irq); in meson_irq_handler()
110 struct meson_dev *mc __maybe_unused = seq->private; in meson_debugfs_show()
116 mc->chanlist[i].stat_req); in meson_debugfs_show()
139 static void meson_free_chanlist(struct meson_dev *mc, int i) in meson_free_chanlist() argument
142 crypto_engine_exit(mc->chanlist[i].engine); in meson_free_chanlist()
143 if (mc->chanlist[i].tl) in meson_free_chanlist()
144 dma_free_coherent(mc->dev, sizeof(struct meson_desc) * MAXDESC, in meson_free_chanlist()
145 mc->chanlist[i].tl, in meson_free_chanlist()
146 mc->chanlist[i].t_phy); in meson_free_chanlist()
154 static int meson_allocate_chanlist(struct meson_dev *mc) in meson_allocate_chanlist() argument
158 mc->chanlist = devm_kcalloc(mc->dev, MAXFLOW, in meson_allocate_chanlist()
160 if (!mc->chanlist) in meson_allocate_chanlist()
164 init_completion(&mc->chanlist[i].complete); in meson_allocate_chanlist()
166 mc->chanlist[i].engine = crypto_engine_alloc_init(mc->dev, true); in meson_allocate_chanlist()
167 if (!mc->chanlist[i].engine) { in meson_allocate_chanlist()
168 dev_err(mc->dev, "Cannot allocate engine\n"); in meson_allocate_chanlist()
173 err = crypto_engine_start(mc->chanlist[i].engine); in meson_allocate_chanlist()
175 dev_err(mc->dev, "Cannot start engine\n"); in meson_allocate_chanlist()
178 mc->chanlist[i].tl = dma_alloc_coherent(mc->dev, in meson_allocate_chanlist()
180 &mc->chanlist[i].t_phy, in meson_allocate_chanlist()
182 if (!mc->chanlist[i].tl) { in meson_allocate_chanlist()
189 meson_free_chanlist(mc, i); in meson_allocate_chanlist()
193 static int meson_register_algs(struct meson_dev *mc) in meson_register_algs() argument
198 mc_algs[i].mc = mc; in meson_register_algs()
203 dev_err(mc->dev, "Fail to register %s\n", in meson_register_algs()
205 mc_algs[i].mc = NULL; in meson_register_algs()
215 static void meson_unregister_algs(struct meson_dev *mc) in meson_unregister_algs() argument
220 if (!mc_algs[i].mc) in meson_unregister_algs()
232 struct meson_dev *mc; in meson_crypto_probe() local
235 mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL); in meson_crypto_probe()
236 if (!mc) in meson_crypto_probe()
239 mc->dev = &pdev->dev; in meson_crypto_probe()
240 platform_set_drvdata(pdev, mc); in meson_crypto_probe()
242 mc->base = devm_platform_ioremap_resource(pdev, 0); in meson_crypto_probe()
243 if (IS_ERR(mc->base)) { in meson_crypto_probe()
244 err = PTR_ERR(mc->base); in meson_crypto_probe()
248 mc->busclk = devm_clk_get(&pdev->dev, "blkmv"); in meson_crypto_probe()
249 if (IS_ERR(mc->busclk)) { in meson_crypto_probe()
250 err = PTR_ERR(mc->busclk); in meson_crypto_probe()
256 mc->irqs[i] = platform_get_irq(pdev, i); in meson_crypto_probe()
257 if (mc->irqs[i] < 0) in meson_crypto_probe()
258 return mc->irqs[i]; in meson_crypto_probe()
260 err = devm_request_irq(&pdev->dev, mc->irqs[i], meson_irq_handler, 0, in meson_crypto_probe()
261 "gxl-crypto", mc); in meson_crypto_probe()
263 dev_err(mc->dev, "Cannot request IRQ for flow %d\n", i); in meson_crypto_probe()
268 err = clk_prepare_enable(mc->busclk); in meson_crypto_probe()
274 err = meson_allocate_chanlist(mc); in meson_crypto_probe()
278 err = meson_register_algs(mc); in meson_crypto_probe()
286 debugfs_create_file("stats", 0444, dbgfs_dir, mc, &meson_debugfs_fops); in meson_crypto_probe()
289 mc->dbgfs_dir = dbgfs_dir; in meson_crypto_probe()
295 meson_unregister_algs(mc); in meson_crypto_probe()
297 meson_free_chanlist(mc, MAXFLOW - 1); in meson_crypto_probe()
298 clk_disable_unprepare(mc->busclk); in meson_crypto_probe()
304 struct meson_dev *mc = platform_get_drvdata(pdev); in meson_crypto_remove() local
307 debugfs_remove_recursive(mc->dbgfs_dir); in meson_crypto_remove()
310 meson_unregister_algs(mc); in meson_crypto_remove()
312 meson_free_chanlist(mc, MAXFLOW - 1); in meson_crypto_remove()
314 clk_disable_unprepare(mc->busclk); in meson_crypto_remove()