Lines Matching full:crc

104 	struct stm32_crc *crc;  in stm32_crc_get_next_crc()  local
107 crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); in stm32_crc_get_next_crc()
108 if (crc) in stm32_crc_get_next_crc()
109 list_move_tail(&crc->list, &crc_list.dev_list); in stm32_crc_get_next_crc()
112 return crc; in stm32_crc_get_next_crc()
119 struct stm32_crc *crc; in stm32_crc_init() local
122 crc = stm32_crc_get_next_crc(); in stm32_crc_init()
123 if (!crc) in stm32_crc_init()
126 pm_runtime_get_sync(crc->dev); in stm32_crc_init()
128 spin_lock_irqsave(&crc->lock, flags); in stm32_crc_init()
131 writel_relaxed(bitrev32(mctx->key), crc->regs + CRC_INIT); in stm32_crc_init()
132 writel_relaxed(bitrev32(mctx->poly), crc->regs + CRC_POL); in stm32_crc_init()
134 crc->regs + CRC_CR); in stm32_crc_init()
137 ctx->partial = readl_relaxed(crc->regs + CRC_DR); in stm32_crc_init()
139 spin_unlock_irqrestore(&crc->lock, flags); in stm32_crc_init()
141 pm_runtime_mark_last_busy(crc->dev); in stm32_crc_init()
142 pm_runtime_put_autosuspend(crc->dev); in stm32_crc_init()
152 struct stm32_crc *crc; in burst_update() local
154 crc = stm32_crc_get_next_crc(); in burst_update()
155 if (!crc) in burst_update()
158 pm_runtime_get_sync(crc->dev); in burst_update()
160 if (!spin_trylock(&crc->lock)) { in burst_update()
171 * Restore previously calculated CRC for this context as init value in burst_update()
176 writel_relaxed(bitrev32(ctx->partial), crc->regs + CRC_INIT); in burst_update()
177 writel_relaxed(bitrev32(mctx->poly), crc->regs + CRC_POL); in burst_update()
179 crc->regs + CRC_CR); in burst_update()
184 crc->regs + CRC_CR); in burst_update()
186 writeb_relaxed(*d8++, crc->regs + CRC_DR); in burst_update()
191 crc->regs + CRC_CR); in burst_update()
195 writel_relaxed(*((u32 *)d8), crc->regs + CRC_DR); in burst_update()
200 crc->regs + CRC_CR); in burst_update()
202 writeb_relaxed(*d8++, crc->regs + CRC_DR); in burst_update()
206 ctx->partial = readl_relaxed(crc->regs + CRC_DR); in burst_update()
208 spin_unlock(&crc->lock); in burst_update()
211 pm_runtime_mark_last_busy(crc->dev); in burst_update()
212 pm_runtime_put_autosuspend(crc->dev); in burst_update()
247 /* Send computed CRC */ in stm32_crc_final()
270 /* CRC-32 */
292 /* CRC-32Castagnoli */
319 struct stm32_crc *crc; in stm32_crc_probe() local
322 crc = devm_kzalloc(dev, sizeof(*crc), GFP_KERNEL); in stm32_crc_probe()
323 if (!crc) in stm32_crc_probe()
326 crc->dev = dev; in stm32_crc_probe()
328 crc->regs = devm_platform_ioremap_resource(pdev, 0); in stm32_crc_probe()
329 if (IS_ERR(crc->regs)) { in stm32_crc_probe()
330 dev_err(dev, "Cannot map CRC IO\n"); in stm32_crc_probe()
331 return PTR_ERR(crc->regs); in stm32_crc_probe()
334 crc->clk = devm_clk_get(dev, NULL); in stm32_crc_probe()
335 if (IS_ERR(crc->clk)) { in stm32_crc_probe()
337 return PTR_ERR(crc->clk); in stm32_crc_probe()
340 ret = clk_prepare_enable(crc->clk); in stm32_crc_probe()
342 dev_err(crc->dev, "Failed to enable clock\n"); in stm32_crc_probe()
354 spin_lock_init(&crc->lock); in stm32_crc_probe()
356 platform_set_drvdata(pdev, crc); in stm32_crc_probe()
359 list_add(&crc->list, &crc_list.dev_list); in stm32_crc_probe()
368 clk_disable_unprepare(crc->clk); in stm32_crc_probe()
384 struct stm32_crc *crc = platform_get_drvdata(pdev); in stm32_crc_remove() local
385 int ret = pm_runtime_get_sync(crc->dev); in stm32_crc_remove()
388 pm_runtime_put_noidle(crc->dev); in stm32_crc_remove()
393 list_del(&crc->list); in stm32_crc_remove()
401 pm_runtime_disable(crc->dev); in stm32_crc_remove()
402 pm_runtime_put_noidle(crc->dev); in stm32_crc_remove()
404 clk_disable_unprepare(crc->clk); in stm32_crc_remove()
411 struct stm32_crc *crc = dev_get_drvdata(dev); in stm32_crc_suspend() local
418 clk_unprepare(crc->clk); in stm32_crc_suspend()
425 struct stm32_crc *crc = dev_get_drvdata(dev); in stm32_crc_resume() local
428 ret = clk_prepare(crc->clk); in stm32_crc_resume()
430 dev_err(crc->dev, "Failed to prepare clock\n"); in stm32_crc_resume()
439 struct stm32_crc *crc = dev_get_drvdata(dev); in stm32_crc_runtime_suspend() local
441 clk_disable(crc->clk); in stm32_crc_runtime_suspend()
448 struct stm32_crc *crc = dev_get_drvdata(dev); in stm32_crc_runtime_resume() local
451 ret = clk_enable(crc->clk); in stm32_crc_runtime_resume()
453 dev_err(crc->dev, "Failed to enable clock\n"); in stm32_crc_runtime_resume()
468 { .compatible = "st,stm32f7-crc", },