Re: [PATCH 01/11] crypto: qce - Add support for crypto address read

From: Sricharan Ramabadhran
Date: Wed Feb 21 2024 - 13:03:36 EST




On 12/14/2023 5:12 PM, Md Sadre Alam wrote:
Get crypto base address from DT. This will use for
command descriptor support for crypto register r/w
via BAM/DMA

Signed-off-by: Md Sadre Alam <quic_mdalam@xxxxxxxxxxx>
---
drivers/crypto/qce/core.c | 9 +++++++++
drivers/crypto/qce/core.h | 1 +
2 files changed, 10 insertions(+)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index 28b5fd823827..5af0dc40738a 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -192,6 +192,7 @@ static int qce_crypto_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct qce_device *qce;
+ struct resource *res;
int ret;
qce = devm_kzalloc(dev, sizeof(*qce), GFP_KERNEL);
@@ -205,6 +206,14 @@ static int qce_crypto_probe(struct platform_device *pdev)
if (IS_ERR(qce->base))
return PTR_ERR(qce->base);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

Can this be combined with devm_platform_get_and_ioremap_resource ?
+ if (!res)
+ return -ENOMEM;
+ qce->base_dma = dma_map_resource(dev, res->start, resource_size(res),
+ DMA_BIDIRECTIONAL, 0);

unmap in remove and error cases ?

Regards,
Sricharan