Lines Matching full:cryp

11 #include "jh7110-cryp.h"
39 struct starfive_cryp_dev *cryp = NULL, *tmp; in starfive_cryp_find_dev() local
42 if (!ctx->cryp) { in starfive_cryp_find_dev()
44 cryp = tmp; in starfive_cryp_find_dev()
47 ctx->cryp = cryp; in starfive_cryp_find_dev()
49 cryp = ctx->cryp; in starfive_cryp_find_dev()
54 return cryp; in starfive_cryp_find_dev()
64 static int starfive_dma_init(struct starfive_cryp_dev *cryp) in starfive_dma_init() argument
71 cryp->tx = dma_request_chan(cryp->dev, "tx"); in starfive_dma_init()
72 if (IS_ERR(cryp->tx)) in starfive_dma_init()
73 return dev_err_probe(cryp->dev, PTR_ERR(cryp->tx), in starfive_dma_init()
76 cryp->rx = dma_request_chan(cryp->dev, "rx"); in starfive_dma_init()
77 if (IS_ERR(cryp->rx)) { in starfive_dma_init()
78 dma_release_channel(cryp->tx); in starfive_dma_init()
79 return dev_err_probe(cryp->dev, PTR_ERR(cryp->rx), in starfive_dma_init()
86 static void starfive_dma_cleanup(struct starfive_cryp_dev *cryp) in starfive_dma_cleanup() argument
88 dma_release_channel(cryp->tx); in starfive_dma_cleanup()
89 dma_release_channel(cryp->rx); in starfive_dma_cleanup()
96 struct starfive_cryp_dev *cryp = (struct starfive_cryp_dev *)priv; in starfive_cryp_irq() local
98 mask = readl(cryp->base + STARFIVE_IE_MASK_OFFSET); in starfive_cryp_irq()
99 status = readl(cryp->base + STARFIVE_IE_FLAG_OFFSET); in starfive_cryp_irq()
102 writel(mask, cryp->base + STARFIVE_IE_MASK_OFFSET); in starfive_cryp_irq()
103 tasklet_schedule(&cryp->aes_done); in starfive_cryp_irq()
108 writel(mask, cryp->base + STARFIVE_IE_MASK_OFFSET); in starfive_cryp_irq()
109 tasklet_schedule(&cryp->hash_done); in starfive_cryp_irq()
117 struct starfive_cryp_dev *cryp; in starfive_cryp_probe() local
122 cryp = devm_kzalloc(&pdev->dev, sizeof(*cryp), GFP_KERNEL); in starfive_cryp_probe()
123 if (!cryp) in starfive_cryp_probe()
126 platform_set_drvdata(pdev, cryp); in starfive_cryp_probe()
127 cryp->dev = &pdev->dev; in starfive_cryp_probe()
129 cryp->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in starfive_cryp_probe()
130 if (IS_ERR(cryp->base)) in starfive_cryp_probe()
131 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->base), in starfive_cryp_probe()
134 tasklet_init(&cryp->aes_done, starfive_aes_done_task, (unsigned long)cryp); in starfive_cryp_probe()
135 tasklet_init(&cryp->hash_done, starfive_hash_done_task, (unsigned long)cryp); in starfive_cryp_probe()
137 cryp->phys_base = res->start; in starfive_cryp_probe()
138 cryp->dma_maxburst = 32; in starfive_cryp_probe()
139 cryp->side_chan = side_chan; in starfive_cryp_probe()
141 cryp->hclk = devm_clk_get(&pdev->dev, "hclk"); in starfive_cryp_probe()
142 if (IS_ERR(cryp->hclk)) in starfive_cryp_probe()
143 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->hclk), in starfive_cryp_probe()
146 cryp->ahb = devm_clk_get(&pdev->dev, "ahb"); in starfive_cryp_probe()
147 if (IS_ERR(cryp->ahb)) in starfive_cryp_probe()
148 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->ahb), in starfive_cryp_probe()
151 cryp->rst = devm_reset_control_get_shared(cryp->dev, NULL); in starfive_cryp_probe()
152 if (IS_ERR(cryp->rst)) in starfive_cryp_probe()
153 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->rst), in starfive_cryp_probe()
161 (void *)cryp); in starfive_cryp_probe()
166 clk_prepare_enable(cryp->hclk); in starfive_cryp_probe()
167 clk_prepare_enable(cryp->ahb); in starfive_cryp_probe()
168 reset_control_deassert(cryp->rst); in starfive_cryp_probe()
171 list_add(&cryp->list, &dev_list.dev_list); in starfive_cryp_probe()
174 ret = starfive_dma_init(cryp); in starfive_cryp_probe()
179 cryp->engine = crypto_engine_alloc_init(&pdev->dev, 1); in starfive_cryp_probe()
180 if (!cryp->engine) { in starfive_cryp_probe()
185 ret = crypto_engine_start(cryp->engine); in starfive_cryp_probe()
208 crypto_engine_stop(cryp->engine); in starfive_cryp_probe()
210 crypto_engine_exit(cryp->engine); in starfive_cryp_probe()
212 starfive_dma_cleanup(cryp); in starfive_cryp_probe()
215 list_del(&cryp->list); in starfive_cryp_probe()
218 clk_disable_unprepare(cryp->hclk); in starfive_cryp_probe()
219 clk_disable_unprepare(cryp->ahb); in starfive_cryp_probe()
220 reset_control_assert(cryp->rst); in starfive_cryp_probe()
222 tasklet_kill(&cryp->aes_done); in starfive_cryp_probe()
223 tasklet_kill(&cryp->hash_done); in starfive_cryp_probe()
230 struct starfive_cryp_dev *cryp = platform_get_drvdata(pdev); in starfive_cryp_remove() local
236 tasklet_kill(&cryp->aes_done); in starfive_cryp_remove()
237 tasklet_kill(&cryp->hash_done); in starfive_cryp_remove()
239 crypto_engine_stop(cryp->engine); in starfive_cryp_remove()
240 crypto_engine_exit(cryp->engine); in starfive_cryp_remove()
242 starfive_dma_cleanup(cryp); in starfive_cryp_remove()
245 list_del(&cryp->list); in starfive_cryp_remove()
248 clk_disable_unprepare(cryp->hclk); in starfive_cryp_remove()
249 clk_disable_unprepare(cryp->ahb); in starfive_cryp_remove()
250 reset_control_assert(cryp->rst); in starfive_cryp_remove()