Lines Matching +full:crypto +full:- +full:engine

1 // SPDX-License-Identifier: GPL-2.0
5 * Support for StarFive hardware cryptographic engine.
10 #include <crypto/engine.h>
11 #include "jh7110-cryp.h"
25 #define DRIVER_NAME "jh7110-crypto"
42 if (!ctx->cryp) { in starfive_cryp_find_dev()
47 ctx->cryp = cryp; in starfive_cryp_find_dev()
49 cryp = ctx->cryp; in starfive_cryp_find_dev()
61 " 0 - Disabled\n"
62 " other - Enabled");
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()
88 dma_release_channel(cryp->tx); in starfive_dma_cleanup()
89 dma_release_channel(cryp->rx); in starfive_dma_cleanup()
98 cryp = devm_kzalloc(&pdev->dev, sizeof(*cryp), GFP_KERNEL); in starfive_cryp_probe()
100 return -ENOMEM; in starfive_cryp_probe()
103 cryp->dev = &pdev->dev; in starfive_cryp_probe()
105 cryp->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in starfive_cryp_probe()
106 if (IS_ERR(cryp->base)) in starfive_cryp_probe()
107 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->base), in starfive_cryp_probe()
110 cryp->phys_base = res->start; in starfive_cryp_probe()
111 cryp->dma_maxburst = 32; in starfive_cryp_probe()
112 cryp->side_chan = side_chan; in starfive_cryp_probe()
114 cryp->hclk = devm_clk_get(&pdev->dev, "hclk"); in starfive_cryp_probe()
115 if (IS_ERR(cryp->hclk)) in starfive_cryp_probe()
116 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->hclk), in starfive_cryp_probe()
119 cryp->ahb = devm_clk_get(&pdev->dev, "ahb"); in starfive_cryp_probe()
120 if (IS_ERR(cryp->ahb)) in starfive_cryp_probe()
121 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->ahb), in starfive_cryp_probe()
124 cryp->rst = devm_reset_control_get_shared(cryp->dev, NULL); in starfive_cryp_probe()
125 if (IS_ERR(cryp->rst)) in starfive_cryp_probe()
126 return dev_err_probe(&pdev->dev, PTR_ERR(cryp->rst), in starfive_cryp_probe()
129 clk_prepare_enable(cryp->hclk); in starfive_cryp_probe()
130 clk_prepare_enable(cryp->ahb); in starfive_cryp_probe()
131 reset_control_deassert(cryp->rst); in starfive_cryp_probe()
134 list_add(&cryp->list, &dev_list.dev_list); in starfive_cryp_probe()
141 /* Initialize crypto engine */ in starfive_cryp_probe()
142 cryp->engine = crypto_engine_alloc_init(&pdev->dev, 1); in starfive_cryp_probe()
143 if (!cryp->engine) { in starfive_cryp_probe()
144 ret = -ENOMEM; in starfive_cryp_probe()
148 ret = crypto_engine_start(cryp->engine); in starfive_cryp_probe()
171 crypto_engine_exit(cryp->engine); in starfive_cryp_probe()
176 list_del(&cryp->list); in starfive_cryp_probe()
179 clk_disable_unprepare(cryp->hclk); in starfive_cryp_probe()
180 clk_disable_unprepare(cryp->ahb); in starfive_cryp_probe()
181 reset_control_assert(cryp->rst); in starfive_cryp_probe()
194 crypto_engine_exit(cryp->engine); in starfive_cryp_remove()
199 list_del(&cryp->list); in starfive_cryp_remove()
202 clk_disable_unprepare(cryp->hclk); in starfive_cryp_remove()
203 clk_disable_unprepare(cryp->ahb); in starfive_cryp_remove()
204 reset_control_assert(cryp->rst); in starfive_cryp_remove()
208 { .compatible = "starfive,jh7110-crypto", .data = NULL},