diff mbox series

[3/6] drivers:crypto:qce: Enable support for crypto engine on sdm845.

Message ID 20201117134714.3456446-4-thara.gopinath@linaro.org
State Superseded
Headers show
Series Enable Qualcomm Crypto Engine on sdm845 | expand

Commit Message

Thara Gopinath Nov. 17, 2020, 1:47 p.m. UTC
Add support Qualcomm Crypto Engine accelerated encryption and
authentication algorithms on sdm845.

Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
---
 drivers/crypto/qce/core.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Bjorn Andersson Nov. 18, 2020, 4:02 a.m. UTC | #1
On Tue 17 Nov 07:47 CST 2020, Thara Gopinath wrote:

> Add support Qualcomm Crypto Engine accelerated encryption and
> authentication algorithms on sdm845.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
> ---
>  drivers/crypto/qce/core.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
> index ea616b7259ae..67c3ca13e55b 100644
> --- a/drivers/crypto/qce/core.c
> +++ b/drivers/crypto/qce/core.c
> @@ -160,7 +160,21 @@ static int qce_check_version(struct qce_device *qce)
>  		return -ENODEV;
>  
>  	qce->burst_size = QCE_BAM_BURST_SIZE;
> -	qce->pipe_pair_id = 1;
> +
> +	/*
> +	 * Rx and tx pipes are treated as a pair inside CE.
> +	 * Pipe pair number depended on the actual BAM dma pipe
> +	 * that is used for transfers. The BAM dma pipes are passed
> +	 * from the device tree and used to derive the pipe pair
> +	 * id in the CE driver as follows.
> +	 * 	BAM dma pipes(rx, tx)		CE pipe pair id
> +	 *		0,1				0
> +	 *		2,3				1
> +	 *		4,5				2
> +	 *		6,7				3
> +	 *		...
> +	 */
> +	qce->pipe_pair_id = qce->dma.rxchan->chan_id >> 1;
>  
>  	dev_dbg(qce->dev, "Crypto device found, version %d.%d.%d\n",
>  		major, minor, step);
> @@ -261,6 +275,7 @@ static int qce_crypto_remove(struct platform_device *pdev)
>  
>  static const struct of_device_id qce_crypto_of_match[] = {
>  	{ .compatible = "qcom,crypto-v5.1", },
> +	{ .compatible = "qcom,crypto-v5.4", },
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, qce_crypto_of_match);
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index ea616b7259ae..67c3ca13e55b 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -160,7 +160,21 @@  static int qce_check_version(struct qce_device *qce)
 		return -ENODEV;
 
 	qce->burst_size = QCE_BAM_BURST_SIZE;
-	qce->pipe_pair_id = 1;
+
+	/*
+	 * Rx and tx pipes are treated as a pair inside CE.
+	 * Pipe pair number depended on the actual BAM dma pipe
+	 * that is used for transfers. The BAM dma pipes are passed
+	 * from the device tree and used to derive the pipe pair
+	 * id in the CE driver as follows.
+	 * 	BAM dma pipes(rx, tx)		CE pipe pair id
+	 *		0,1				0
+	 *		2,3				1
+	 *		4,5				2
+	 *		6,7				3
+	 *		...
+	 */
+	qce->pipe_pair_id = qce->dma.rxchan->chan_id >> 1;
 
 	dev_dbg(qce->dev, "Crypto device found, version %d.%d.%d\n",
 		major, minor, step);
@@ -261,6 +275,7 @@  static int qce_crypto_remove(struct platform_device *pdev)
 
 static const struct of_device_id qce_crypto_of_match[] = {
 	{ .compatible = "qcom,crypto-v5.1", },
+	{ .compatible = "qcom,crypto-v5.4", },
 	{}
 };
 MODULE_DEVICE_TABLE(of, qce_crypto_of_match);