Lines Matching refs:cryp

11 #include "jh7110-cryp.h"
39 struct starfive_cryp_dev *cryp = NULL, *tmp;
42 if (!ctx->cryp) {
44 cryp = tmp;
47 ctx->cryp = cryp;
49 cryp = ctx->cryp;
54 return cryp;
64 static int starfive_dma_init(struct starfive_cryp_dev *cryp)
71 cryp->tx = dma_request_chan(cryp->dev, "tx");
72 if (IS_ERR(cryp->tx))
73 return dev_err_probe(cryp->dev, PTR_ERR(cryp->tx),
76 cryp->rx = dma_request_chan(cryp->dev, "rx");
77 if (IS_ERR(cryp->rx)) {
78 dma_release_channel(cryp->tx);
79 return dev_err_probe(cryp->dev, PTR_ERR(cryp->rx),
86 static void starfive_dma_cleanup(struct starfive_cryp_dev *cryp)
88 dma_release_channel(cryp->tx);
89 dma_release_channel(cryp->rx);
94 struct starfive_cryp_dev *cryp;
98 cryp = devm_kzalloc(&pdev->dev, sizeof(*cryp), GFP_KERNEL);
99 if (!cryp)
102 platform_set_drvdata(pdev, cryp);
103 cryp->dev = &pdev->dev;
105 cryp->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
106 if (IS_ERR(cryp->base))
107 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->base),
110 cryp->phys_base = res->start;
111 cryp->dma_maxburst = 32;
112 cryp->side_chan = side_chan;
114 cryp->hclk = devm_clk_get(&pdev->dev, "hclk");
115 if (IS_ERR(cryp->hclk))
116 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->hclk),
119 cryp->ahb = devm_clk_get(&pdev->dev, "ahb");
120 if (IS_ERR(cryp->ahb))
121 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->ahb),
124 cryp->rst = devm_reset_control_get_shared(cryp->dev, NULL);
125 if (IS_ERR(cryp->rst))
126 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->rst),
129 clk_prepare_enable(cryp->hclk);
130 clk_prepare_enable(cryp->ahb);
131 reset_control_deassert(cryp->rst);
134 list_add(&cryp->list, &dev_list.dev_list);
137 ret = starfive_dma_init(cryp);
142 cryp->engine = crypto_engine_alloc_init(&pdev->dev, 1);
143 if (!cryp->engine) {
148 ret = crypto_engine_start(cryp->engine);
171 crypto_engine_stop(cryp->engine);
173 crypto_engine_exit(cryp->engine);
175 starfive_dma_cleanup(cryp);
178 list_del(&cryp->list);
181 clk_disable_unprepare(cryp->hclk);
182 clk_disable_unprepare(cryp->ahb);
183 reset_control_assert(cryp->rst);
190 struct starfive_cryp_dev *cryp = platform_get_drvdata(pdev);
196 crypto_engine_stop(cryp->engine);
197 crypto_engine_exit(cryp->engine);
199 starfive_dma_cleanup(cryp);
202 list_del(&cryp->list);
205 clk_disable_unprepare(cryp->hclk);
206 clk_disable_unprepare(cryp->ahb);
207 reset_control_assert(cryp->rst);