Commit 7467147e authored by Jia Jie Ho's avatar Jia Jie Ho Committed by Herbert Xu

crypto: starfive - Use dma for aes requests

Convert AES module to use dma for data transfers to reduce cpu load and
compatible with future variants.
Signed-off-by: default avatarJia Jie Ho <jiajie.ho@starfivetech.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent a05c821e
...@@ -14,6 +14,10 @@ config CRYPTO_DEV_JH7110 ...@@ -14,6 +14,10 @@ config CRYPTO_DEV_JH7110
select CRYPTO_RSA select CRYPTO_RSA
select CRYPTO_AES select CRYPTO_AES
select CRYPTO_CCM select CRYPTO_CCM
select CRYPTO_GCM
select CRYPTO_ECB
select CRYPTO_CBC
select CRYPTO_CTR
help help
Support for StarFive JH7110 crypto hardware acceleration engine. Support for StarFive JH7110 crypto hardware acceleration engine.
This module provides acceleration for public key algo, This module provides acceleration for public key algo,
......
This diff is collapsed.
...@@ -89,28 +89,10 @@ static void starfive_dma_cleanup(struct starfive_cryp_dev *cryp) ...@@ -89,28 +89,10 @@ static void starfive_dma_cleanup(struct starfive_cryp_dev *cryp)
dma_release_channel(cryp->rx); dma_release_channel(cryp->rx);
} }
static irqreturn_t starfive_cryp_irq(int irq, void *priv)
{
u32 status;
u32 mask;
struct starfive_cryp_dev *cryp = (struct starfive_cryp_dev *)priv;
mask = readl(cryp->base + STARFIVE_IE_MASK_OFFSET);
status = readl(cryp->base + STARFIVE_IE_FLAG_OFFSET);
if (status & STARFIVE_IE_FLAG_AES_DONE) {
mask |= STARFIVE_IE_MASK_AES_DONE;
writel(mask, cryp->base + STARFIVE_IE_MASK_OFFSET);
tasklet_schedule(&cryp->aes_done);
}
return IRQ_HANDLED;
}
static int starfive_cryp_probe(struct platform_device *pdev) static int starfive_cryp_probe(struct platform_device *pdev)
{ {
struct starfive_cryp_dev *cryp; struct starfive_cryp_dev *cryp;
struct resource *res; struct resource *res;
int irq;
int ret; int ret;
cryp = devm_kzalloc(&pdev->dev, sizeof(*cryp), GFP_KERNEL); cryp = devm_kzalloc(&pdev->dev, sizeof(*cryp), GFP_KERNEL);
...@@ -125,8 +107,6 @@ static int starfive_cryp_probe(struct platform_device *pdev) ...@@ -125,8 +107,6 @@ static int starfive_cryp_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(cryp->base), return dev_err_probe(&pdev->dev, PTR_ERR(cryp->base),
"Error remapping memory for platform device\n"); "Error remapping memory for platform device\n");
tasklet_init(&cryp->aes_done, starfive_aes_done_task, (unsigned long)cryp);
cryp->phys_base = res->start; cryp->phys_base = res->start;
cryp->dma_maxburst = 32; cryp->dma_maxburst = 32;
cryp->side_chan = side_chan; cryp->side_chan = side_chan;
...@@ -146,16 +126,6 @@ static int starfive_cryp_probe(struct platform_device *pdev) ...@@ -146,16 +126,6 @@ static int starfive_cryp_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(cryp->rst), return dev_err_probe(&pdev->dev, PTR_ERR(cryp->rst),
"Error getting hardware reset line\n"); "Error getting hardware reset line\n");
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
ret = devm_request_irq(&pdev->dev, irq, starfive_cryp_irq, 0, pdev->name,
(void *)cryp);
if (ret)
return dev_err_probe(&pdev->dev, ret,
"Failed to register interrupt handler\n");
clk_prepare_enable(cryp->hclk); clk_prepare_enable(cryp->hclk);
clk_prepare_enable(cryp->ahb); clk_prepare_enable(cryp->ahb);
reset_control_deassert(cryp->rst); reset_control_deassert(cryp->rst);
...@@ -212,8 +182,6 @@ static int starfive_cryp_probe(struct platform_device *pdev) ...@@ -212,8 +182,6 @@ static int starfive_cryp_probe(struct platform_device *pdev)
clk_disable_unprepare(cryp->ahb); clk_disable_unprepare(cryp->ahb);
reset_control_assert(cryp->rst); reset_control_assert(cryp->rst);
tasklet_kill(&cryp->aes_done);
return ret; return ret;
} }
...@@ -225,8 +193,6 @@ static void starfive_cryp_remove(struct platform_device *pdev) ...@@ -225,8 +193,6 @@ static void starfive_cryp_remove(struct platform_device *pdev)
starfive_hash_unregister_algs(); starfive_hash_unregister_algs();
starfive_rsa_unregister_algs(); starfive_rsa_unregister_algs();
tasklet_kill(&cryp->aes_done);
crypto_engine_stop(cryp->engine); crypto_engine_stop(cryp->engine);
crypto_engine_exit(cryp->engine); crypto_engine_exit(cryp->engine);
......
...@@ -169,6 +169,7 @@ struct starfive_cryp_ctx { ...@@ -169,6 +169,7 @@ struct starfive_cryp_ctx {
struct crypto_akcipher *akcipher_fbk; struct crypto_akcipher *akcipher_fbk;
struct crypto_ahash *ahash_fbk; struct crypto_ahash *ahash_fbk;
struct crypto_aead *aead_fbk; struct crypto_aead *aead_fbk;
struct crypto_skcipher *skcipher_fbk;
}; };
struct starfive_cryp_dev { struct starfive_cryp_dev {
...@@ -186,10 +187,7 @@ struct starfive_cryp_dev { ...@@ -186,10 +187,7 @@ struct starfive_cryp_dev {
struct dma_chan *rx; struct dma_chan *rx;
struct dma_slave_config cfg_in; struct dma_slave_config cfg_in;
struct dma_slave_config cfg_out; struct dma_slave_config cfg_out;
struct scatter_walk in_walk;
struct scatter_walk out_walk;
struct crypto_engine *engine; struct crypto_engine *engine;
struct tasklet_struct aes_done;
struct completion dma_done; struct completion dma_done;
size_t assoclen; size_t assoclen;
size_t total_in; size_t total_in;
...@@ -237,6 +235,4 @@ void starfive_rsa_unregister_algs(void); ...@@ -237,6 +235,4 @@ void starfive_rsa_unregister_algs(void);
int starfive_aes_register_algs(void); int starfive_aes_register_algs(void);
void starfive_aes_unregister_algs(void); void starfive_aes_unregister_algs(void);
void starfive_aes_done_task(unsigned long param);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment