Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH 1/2] Device tree registration and property names changes
@ 2024-09-04  3:11 Pavitrakumar M
  2024-09-04  3:11 ` [PATCH 2/2] SPAcc DT bindings Pavitrakumar M
  2024-09-04  6:09 ` [PATCH 1/2] Device tree registration and property names changes Krzysztof Kozlowski
  0 siblings, 2 replies; 5+ messages in thread
From: Pavitrakumar M @ 2024-09-04  3:11 UTC (permalink / raw)
  To: herbert, robh, linux-crypto
  Cc: Ruud.Derwig, manjunath.hadli, bhoomikak, Pavitrakumar M

This patch fixes Device tree registrations, DT property names and counter width
checks.

Signed-off-by: Bhoomika K <bhoomikak@vayavyalabs.com>
Signed-off-by: Pavitrakumar M <pavitrakumarm@vayavyalabs.com>
Acked-by: Ruud Derwig <Ruud.Derwig@synopsys.com>
---
 drivers/crypto/dwc-spacc/Kconfig          |  2 +-
 drivers/crypto/dwc-spacc/spacc_core.c     |  4 +-
 drivers/crypto/dwc-spacc/spacc_device.c   | 64 ++++++++---------------
 drivers/crypto/dwc-spacc/spacc_device.h   |  3 +-
 drivers/crypto/dwc-spacc/spacc_skcipher.c | 29 +++++-----
 5 files changed, 40 insertions(+), 62 deletions(-)

diff --git a/drivers/crypto/dwc-spacc/Kconfig b/drivers/crypto/dwc-spacc/Kconfig
index 9eb41a295f9d..bc44c2a61fe7 100644
--- a/drivers/crypto/dwc-spacc/Kconfig
+++ b/drivers/crypto/dwc-spacc/Kconfig
@@ -3,7 +3,7 @@
 config CRYPTO_DEV_SPACC
 	tristate "Support for dw_spacc Security protocol accelerators"
 	depends on HAS_DMA
-	default m
+	default n
 
 	help
 	  This enables support for the HASH/CRYP/AEAD hw accelerator which can be found
diff --git a/drivers/crypto/dwc-spacc/spacc_core.c b/drivers/crypto/dwc-spacc/spacc_core.c
index 1da7cdd93e78..d48e4b9a56af 100644
--- a/drivers/crypto/dwc-spacc/spacc_core.c
+++ b/drivers/crypto/dwc-spacc/spacc_core.c
@@ -1,9 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#include <linux/of_device.h>
+#include <crypto/skcipher.h>
+#include <linux/of.h>
 #include <linux/vmalloc.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
+#include <linux/dma-mapping.h>
 #include "spacc_hal.h"
 #include "spacc_core.h"
 
diff --git a/drivers/crypto/dwc-spacc/spacc_device.c b/drivers/crypto/dwc-spacc/spacc_device.c
index 964ccdf294e3..332703daffef 100644
--- a/drivers/crypto/dwc-spacc/spacc_device.c
+++ b/drivers/crypto/dwc-spacc/spacc_device.c
@@ -25,9 +25,14 @@ void spacc_stat_process(struct spacc_device *spacc)
 	tasklet_schedule(&priv->pop_jobs);
 }
 
+static const struct of_device_id snps_spacc_id[] = {
+	{.compatible = "snps,dwc-spacc" },
+	{ /*sentinel */        }
+};
+
+MODULE_DEVICE_TABLE(of, snps_spacc_id);
 
-int spacc_probe(struct platform_device *pdev,
-		const struct of_device_id snps_spacc_id[])
+int spacc_probe(struct platform_device *pdev)
 {
 	int spacc_idx = -1;
 	struct resource *mem;
@@ -37,29 +42,14 @@ int spacc_probe(struct platform_device *pdev,
 	int spacc_priority = -1;
 	struct spacc_priv *priv;
 	int x = 0, err, oldmode, irq_num;
-	const struct of_device_id *match, *id;
 	u64 oldtimer = 100000, timer = 100000;
 
-	if (pdev->dev.of_node) {
-		id = of_match_node(snps_spacc_id, pdev->dev.of_node);
-		if (!id) {
-			dev_err(&pdev->dev, "DT node did not match\n");
-			return -EINVAL;
-		}
-	}
-
 	/* Initialize DDT DMA pools based on this device's resources */
 	if (pdu_mem_init(&pdev->dev)) {
 		dev_err(&pdev->dev, "Could not initialize DMA pools\n");
 		return -ENOMEM;
 	}
 
-	match = of_match_device(of_match_ptr(snps_spacc_id), &pdev->dev);
-	if (!match) {
-		dev_err(&pdev->dev, "SPAcc dtb missing");
-		return -ENODEV;
-	}
-
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!mem) {
 		dev_err(&pdev->dev, "no memory resource for spacc\n");
@@ -74,52 +64,52 @@ int spacc_probe(struct platform_device *pdev,
 	}
 
 	/* Read spacc priority and index and save inside priv.spacc.config */
-	if (of_property_read_u32(pdev->dev.of_node, "spacc_priority",
+	if (of_property_read_u32(pdev->dev.of_node, "spacc-priority",
 				 &spacc_priority)) {
-		dev_err(&pdev->dev, "No vspacc priority specified\n");
+		dev_err(&pdev->dev, "No virtual spacc priority specified\n");
 		err = -EINVAL;
 		goto free_ddt_mem_pool;
 	}
 
 	if (spacc_priority < 0 && spacc_priority > VSPACC_PRIORITY_MAX) {
-		dev_err(&pdev->dev, "Invalid vspacc priority\n");
+		dev_err(&pdev->dev, "Invalid virtual spacc priority\n");
 		err = -EINVAL;
 		goto free_ddt_mem_pool;
 	}
 	priv->spacc.config.priority = spacc_priority;
 
-	if (of_property_read_u32(pdev->dev.of_node, "spacc_index",
+	if (of_property_read_u32(pdev->dev.of_node, "spacc-index",
 				 &spacc_idx)) {
-		dev_err(&pdev->dev, "No vspacc index specified\n");
+		dev_err(&pdev->dev, "No virtual spacc index specified\n");
 		err = -EINVAL;
 		goto free_ddt_mem_pool;
 	}
 	priv->spacc.config.idx = spacc_idx;
 
-	if (of_property_read_u32(pdev->dev.of_node, "spacc_endian",
+	if (of_property_read_u32(pdev->dev.of_node, "spacc-endian",
 				 &spacc_endian)) {
-		dev_dbg(&pdev->dev, "No spacc_endian specified\n");
+		dev_dbg(&pdev->dev, "No spacc endian specified\n");
 		dev_dbg(&pdev->dev, "Default spacc Endianness (0==little)\n");
 		spacc_endian = 0;
 	}
 	priv->spacc.config.spacc_endian = spacc_endian;
 
-	if (of_property_read_u64(pdev->dev.of_node, "oldtimer",
+	if (of_property_read_u64(pdev->dev.of_node, "spacc-oldtimer",
 				 &oldtimer)) {
-		dev_dbg(&pdev->dev, "No oldtimer specified\n");
+		dev_dbg(&pdev->dev, "No spacc oldtimer specified\n");
 		dev_dbg(&pdev->dev, "Default oldtimer (100000)\n");
 		oldtimer = 100000;
 	}
 	priv->spacc.config.oldtimer = oldtimer;
 
-	if (of_property_read_u64(pdev->dev.of_node, "timer", &timer)) {
-		dev_dbg(&pdev->dev, "No timer specified\n");
+	if (of_property_read_u64(pdev->dev.of_node, "spacc-timer", &timer)) {
+		dev_dbg(&pdev->dev, "No spacc timer specified\n");
 		dev_dbg(&pdev->dev, "Default timer (100000)\n");
 		timer = 100000;
 	}
 	priv->spacc.config.timer = timer;
 
-	baseaddr = devm_ioremap_resource(&pdev->dev, mem);
+	baseaddr = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);
 	if (IS_ERR(baseaddr)) {
 		dev_err(&pdev->dev, "unable to map iomem\n");
 		err = PTR_ERR(baseaddr);
@@ -127,12 +117,6 @@ int spacc_probe(struct platform_device *pdev,
 	}
 
 	pdu_get_version(baseaddr, &info);
-	if (pdev->dev.platform_data) {
-		struct pdu_info *parent_info = pdev->dev.platform_data;
-
-		memcpy(&info.pdu_config, &parent_info->pdu_config,
-		       sizeof(info.pdu_config));
-	}
 
 	dev_dbg(&pdev->dev, "EPN %04X : virt [%d]\n",
 				info.spacc_version.project,
@@ -273,18 +257,12 @@ static void spacc_unregister_algs(void)
 #endif
 }
 
-static const struct of_device_id snps_spacc_id[] = {
-	{.compatible = "snps-dwc-spacc" },
-	{ /*sentinel */        }
-};
-
-MODULE_DEVICE_TABLE(of, snps_spacc_id);
 
 static int spacc_crypto_probe(struct platform_device *pdev)
 {
 	int rc;
 
-	rc = spacc_probe(pdev, snps_spacc_id);
+	rc = spacc_probe(pdev);
 	if (rc < 0)
 		goto err;
 
@@ -326,7 +304,7 @@ static struct platform_driver spacc_driver = {
 	.remove = spacc_crypto_remove,
 	.driver = {
 		.name  = "spacc",
-		.of_match_table = of_match_ptr(snps_spacc_id),
+		.of_match_table = snps_spacc_id,
 		.owner = THIS_MODULE,
 	},
 };
diff --git a/drivers/crypto/dwc-spacc/spacc_device.h b/drivers/crypto/dwc-spacc/spacc_device.h
index be7fde25046b..e6a34dc20eba 100644
--- a/drivers/crypto/dwc-spacc/spacc_device.h
+++ b/drivers/crypto/dwc-spacc/spacc_device.h
@@ -224,8 +224,7 @@ int spacc_unregister_aead_algs(void);
 int probe_ciphers(struct platform_device *spacc_pdev);
 int spacc_unregister_cipher_algs(void);
 
-int spacc_probe(struct platform_device *pdev,
-		const struct of_device_id snps_spacc_id[]);
+int spacc_probe(struct platform_device *pdev);
 
 irqreturn_t spacc_irq_handler(int irq, void *dev);
 #endif
diff --git a/drivers/crypto/dwc-spacc/spacc_skcipher.c b/drivers/crypto/dwc-spacc/spacc_skcipher.c
index 1ef7c665188f..8410ad9d9910 100644
--- a/drivers/crypto/dwc-spacc/spacc_skcipher.c
+++ b/drivers/crypto/dwc-spacc/spacc_skcipher.c
@@ -401,41 +401,40 @@ static int spacc_cipher_process(struct skcipher_request *req, int enc_dec)
 			return ret;
 		}
 	}
-
 	if (salg->mode->id == CRYPTO_MODE_AES_CTR ||
 	    salg->mode->id == CRYPTO_MODE_SM4_CTR) {
 		/* copy the IV to local buffer */
 		for (i = 0; i < 16; i++)
 			ivc1[i] = req->iv[i];
 
-		/* 64-bit counter width */
-		if (readl(device_h->regmap + SPACC_REG_VERSION_EXT_3) & (0x3)) {
+		/* 32-bit counter width */
+		if (readl(device_h->regmap + SPACC_REG_VERSION_EXT_3) & (0x2)) {
 
-			for (i = 8; i < 16; i++) {
-				num_iv64 <<= 8;
-				num_iv64 |= ivc1[i];
+			for (i = 12; i < 16; i++) {
+				num_iv <<= 8;
+				num_iv |= ivc1[i];
 			}
 
-			diff64 = SPACC_CTR_IV_MAX64 - num_iv64;
+			diff = SPACC_CTR_IV_MAX32 - num_iv;
 
-			if (len > diff64) {
+			if (len > diff) {
 				name = salg->calg->cra_name;
 				ret = spacc_skcipher_fallback(name,
 							      req, enc_dec);
 				return ret;
 			}
-		/* 32-bit counter width */
+		/* 64-bit counter width */
 		} else if (readl(device_h->regmap + SPACC_REG_VERSION_EXT_3)
-			& (0x2)) {
+			& (0x3)) {
 
-			for (i = 12; i < 16; i++) {
-				num_iv <<= 8;
-				num_iv |= ivc1[i];
+			for (i = 8; i < 16; i++) {
+				num_iv64 <<= 8;
+				num_iv64 |= ivc1[i];
 			}
 
-			diff = SPACC_CTR_IV_MAX32 - num_iv;
+			diff64 = SPACC_CTR_IV_MAX64 - num_iv64;
 
-			if (len > diff) {
+			if (len > diff64) {
 				name = salg->calg->cra_name;
 				ret = spacc_skcipher_fallback(name,
 							      req, enc_dec);

base-commit: 3c44d31cb34ce4eb8311a2e73634d57702948230
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] SPAcc DT bindings
  2024-09-04  3:11 [PATCH 1/2] Device tree registration and property names changes Pavitrakumar M
@ 2024-09-04  3:11 ` Pavitrakumar M
  2024-09-04  6:08   ` Krzysztof Kozlowski
  2024-09-04  6:09 ` [PATCH 1/2] Device tree registration and property names changes Krzysztof Kozlowski
  1 sibling, 1 reply; 5+ messages in thread
From: Pavitrakumar M @ 2024-09-04  3:11 UTC (permalink / raw)
  To: herbert, robh, linux-crypto
  Cc: Ruud.Derwig, manjunath.hadli, bhoomikak, Pavitrakumar M

Signed-off-by: Bhoomika K <bhoomikak@vayavyalabs.com>
Signed-off-by: Pavitrakumar M <pavitrakumarm@vayavyalabs.com>
Acked-by: Ruud Derwig <Ruud.Derwig@synopsys.com>
---
 .../bindings/crypto/snps,dwc-spacc.yaml       | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/snps,dwc-spacc.yaml

diff --git a/Documentation/devicetree/bindings/crypto/snps,dwc-spacc.yaml b/Documentation/devicetree/bindings/crypto/snps,dwc-spacc.yaml
new file mode 100644
index 000000000000..4432defbe268
--- /dev/null
+++ b/Documentation/devicetree/bindings/crypto/snps,dwc-spacc.yaml
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/crypto/snps,dwc-spacc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys Security Protocol Accelerator(SPAcc) Hardware Crypto Engine
+
+maintainers:
+  - Ruud Derwig <Ruud.Derwig@synopsys.com>
+
+description:
+  DWC Synopsys Security Protocol Accelerator(SPAcc) Hardware Crypto Engine is
+  a crypto IP, designed by Synopsis, that can accelerate cryptographic
+  operations.
+
+properties:
+  compatible:
+    const: snps,dwc-spacc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  mac-mode:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    spacc: spacc@400000000 {
+            compatible = "snps,dwc-spacc";
+            reg = <0x0000000400000000 0x0003FFFF>;
+            interrupts = <0 89 4>;
+     };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] SPAcc DT bindings
  2024-09-04  3:11 ` [PATCH 2/2] SPAcc DT bindings Pavitrakumar M
@ 2024-09-04  6:08   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-04  6:08 UTC (permalink / raw)
  To: Pavitrakumar M, herbert, robh, linux-crypto
  Cc: Ruud.Derwig, manjunath.hadli, bhoomikak

On 04/09/2024 05:11, Pavitrakumar M wrote:
> Signed-off-by: Bhoomika K <bhoomikak@vayavyalabs.com>
> Signed-off-by: Pavitrakumar M <pavitrakumarm@vayavyalabs.com>
> Acked-by: Ruud Derwig <Ruud.Derwig@synopsys.com>

Please run scripts/checkpatch.pl and fix reported warnings. Then please
run `scripts/checkpatch.pl --strict` and (probably) fix more warnings.
Some warnings can be ignored, especially from --strict run, but the code
here looks like it needs a fix. Feel free to get in touch if the warning
is not clear.

Please use subject prefixes matching the subsystem. You can get them for
example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
your patch is touching. For bindings, the preferred subjects are
explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC. It might happen, that command when run on an older
kernel, gives you outdated entries. Therefore please be sure you base
your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of
people, so fix your workflow. Tools might also fail if you work on some
ancient tree (don't, instead use mainline) or work on fork of kernel
(don't, instead use mainline). Just use b4 and everything should be
fine, although remember about `b4 prep --auto-to-cc` if you added new
patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be
tested by automated tooling. Performing review on untested code might be
a waste of time.

Please kindly resend and include all necessary To/Cc entries.
</form letter>


> ---
>  .../bindings/crypto/snps,dwc-spacc.yaml       | 43 +++++++++++++++++++
>  1 file changed, 43 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/crypto/snps,dwc-spacc.yaml
> 
> diff --git a/Documentation/devicetree/bindings/crypto/snps,dwc-spacc.yaml b/Documentation/devicetree/bindings/crypto/snps,dwc-spacc.yaml
> new file mode 100644
> index 000000000000..4432defbe268
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/crypto/snps,dwc-spacc.yaml
> @@ -0,0 +1,43 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/crypto/snps,dwc-spacc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Synopsys Security Protocol Accelerator(SPAcc) Hardware Crypto Engine
> +
> +maintainers:
> +  - Ruud Derwig <Ruud.Derwig@synopsys.com>
> +
> +description:
> +  DWC Synopsys Security Protocol Accelerator(SPAcc) Hardware Crypto Engine is
> +  a crypto IP, designed by Synopsis, that can accelerate cryptographic
> +  operations.
> +
> +properties:
> +  compatible:
> +    const: snps,dwc-spacc
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  mac-mode:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    spacc: spacc@400000000 {
> +            compatible = "snps,dwc-spacc";
> +            reg = <0x0000000400000000 0x0003FFFF>;
> +            interrupts = <0 89 4>;

Fix indentation (see writing schema) and use proper defines. I am not
reviewing rest.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] Device tree registration and property names changes
  2024-09-04  3:11 [PATCH 1/2] Device tree registration and property names changes Pavitrakumar M
  2024-09-04  3:11 ` [PATCH 2/2] SPAcc DT bindings Pavitrakumar M
@ 2024-09-04  6:09 ` Krzysztof Kozlowski
       [not found]   ` <CALxtO0mREXjvGWYpL5PQUXAJ+v8yT9rHSOn69mfe7EMNz_LnmA@mail.gmail.com>
  1 sibling, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-04  6:09 UTC (permalink / raw)
  To: Pavitrakumar M, herbert, robh, linux-crypto
  Cc: Ruud.Derwig, manjunath.hadli, bhoomikak

On 04/09/2024 05:11, Pavitrakumar M wrote:
> This patch fixes Device tree registrations, DT property names and counter width
> checks.

Please do not use "This commit/patch/change", but imperative mood. See
longer explanation here:
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95

Please wrap commit message according to Linux coding style / submission
process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597


> 
> Signed-off-by: Bhoomika K <bhoomikak@vayavyalabs.com>
> Signed-off-by: Pavitrakumar M <pavitrakumarm@vayavyalabs.com>
> Acked-by: Ruud Derwig <Ruud.Derwig@synopsys.com>
> ---
>  drivers/crypto/dwc-spacc/Kconfig          |  2 +-
>  drivers/crypto/dwc-spacc/spacc_core.c     |  4 +-
>  drivers/crypto/dwc-spacc/spacc_device.c   | 64 ++++++++---------------
>  drivers/crypto/dwc-spacc/spacc_device.h   |  3 +-
>  drivers/crypto/dwc-spacc/spacc_skcipher.c | 29 +++++-----
>  5 files changed, 40 insertions(+), 62 deletions(-)
> 
> diff --git a/drivers/crypto/dwc-spacc/Kconfig b/drivers/crypto/dwc-spacc/Kconfig
> index 9eb41a295f9d..bc44c2a61fe7 100644
> --- a/drivers/crypto/dwc-spacc/Kconfig
> +++ b/drivers/crypto/dwc-spacc/Kconfig
> @@ -3,7 +3,7 @@
>  config CRYPTO_DEV_SPACC
>  	tristate "Support for dw_spacc Security protocol accelerators"
>  	depends on HAS_DMA
> -	default m
> +	default n

How is it related?

>  
>  	help
>  	  This enables support for the HASH/CRYP/AEAD hw accelerator which can be found
> diff --git a/drivers/crypto/dwc-spacc/spacc_core.c b/drivers/crypto/dwc-spacc/spacc_core.c
> index 1da7cdd93e78..d48e4b9a56af 100644
> --- a/drivers/crypto/dwc-spacc/spacc_core.c
> +++ b/drivers/crypto/dwc-spacc/spacc_core.c
> @@ -1,9 +1,11 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> -#include <linux/of_device.h>
> +#include <crypto/skcipher.h>
> +#include <linux/of.h>
>  #include <linux/vmalloc.h>
>  #include <linux/platform_device.h>
>  #include <linux/interrupt.h>
> +#include <linux/dma-mapping.h>
>  #include "spacc_hal.h"
>  #include "spacc_core.h"
>  
> diff --git a/drivers/crypto/dwc-spacc/spacc_device.c b/drivers/crypto/dwc-spacc/spacc_device.c
> index 964ccdf294e3..332703daffef 100644
> --- a/drivers/crypto/dwc-spacc/spacc_device.c
> +++ b/drivers/crypto/dwc-spacc/spacc_device.c
> @@ -25,9 +25,14 @@ void spacc_stat_process(struct spacc_device *spacc)
>  	tasklet_schedule(&priv->pop_jobs);
>  }
>  
> +static const struct of_device_id snps_spacc_id[] = {
> +	{.compatible = "snps,dwc-spacc" },
> +	{ /*sentinel */        }
> +};
> +
> +MODULE_DEVICE_TABLE(of, snps_spacc_id);
>  
> -int spacc_probe(struct platform_device *pdev,
> -		const struct of_device_id snps_spacc_id[])
> +int spacc_probe(struct platform_device *pdev)
>  {
>  	int spacc_idx = -1;
>  	struct resource *mem;
> @@ -37,29 +42,14 @@ int spacc_probe(struct platform_device *pdev,
>  	int spacc_priority = -1;
>  	struct spacc_priv *priv;
>  	int x = 0, err, oldmode, irq_num;
> -	const struct of_device_id *match, *id;
>  	u64 oldtimer = 100000, timer = 100000;
>  
> -	if (pdev->dev.of_node) {
> -		id = of_match_node(snps_spacc_id, pdev->dev.of_node);
> -		if (!id) {
> -			dev_err(&pdev->dev, "DT node did not match\n");
> -			return -EINVAL;
> -		}
> -	}
> -
>  	/* Initialize DDT DMA pools based on this device's resources */
>  	if (pdu_mem_init(&pdev->dev)) {
>  		dev_err(&pdev->dev, "Could not initialize DMA pools\n");
>  		return -ENOMEM;
>  	}
>  
> -	match = of_match_device(of_match_ptr(snps_spacc_id), &pdev->dev);
> -	if (!match) {
> -		dev_err(&pdev->dev, "SPAcc dtb missing");
> -		return -ENODEV;
> -	}
> -
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!mem) {
>  		dev_err(&pdev->dev, "no memory resource for spacc\n");
> @@ -74,52 +64,52 @@ int spacc_probe(struct platform_device *pdev,
>  	}
>  
>  	/* Read spacc priority and index and save inside priv.spacc.config */
> -	if (of_property_read_u32(pdev->dev.of_node, "spacc_priority",
> +	if (of_property_read_u32(pdev->dev.of_node, "spacc-priority",
>  				 &spacc_priority)) {
> -		dev_err(&pdev->dev, "No vspacc priority specified\n");
> +		dev_err(&pdev->dev, "No virtual spacc priority specified\n");
>  		err = -EINVAL;
>  		goto free_ddt_mem_pool;
>  	}
>  
>  	if (spacc_priority < 0 && spacc_priority > VSPACC_PRIORITY_MAX) {
> -		dev_err(&pdev->dev, "Invalid vspacc priority\n");
> +		dev_err(&pdev->dev, "Invalid virtual spacc priority\n");
>  		err = -EINVAL;
>  		goto free_ddt_mem_pool;
>  	}
>  	priv->spacc.config.priority = spacc_priority;
>  
> -	if (of_property_read_u32(pdev->dev.of_node, "spacc_index",
> +	if (of_property_read_u32(pdev->dev.of_node, "spacc-index",
>  				 &spacc_idx)) {
> -		dev_err(&pdev->dev, "No vspacc index specified\n");
> +		dev_err(&pdev->dev, "No virtual spacc index specified\n");
>  		err = -EINVAL;
>  		goto free_ddt_mem_pool;
>  	}
>  	priv->spacc.config.idx = spacc_idx;
>  
> -	if (of_property_read_u32(pdev->dev.of_node, "spacc_endian",
> +	if (of_property_read_u32(pdev->dev.of_node, "spacc-endian",
>  				 &spacc_endian)) {
> -		dev_dbg(&pdev->dev, "No spacc_endian specified\n");
> +		dev_dbg(&pdev->dev, "No spacc endian specified\n");
>  		dev_dbg(&pdev->dev, "Default spacc Endianness (0==little)\n");
>  		spacc_endian = 0;
>  	}
>  	priv->spacc.config.spacc_endian = spacc_endian;
>  
> -	if (of_property_read_u64(pdev->dev.of_node, "oldtimer",
> +	if (of_property_read_u64(pdev->dev.of_node, "spacc-oldtimer",
>  				 &oldtimer)) {
> -		dev_dbg(&pdev->dev, "No oldtimer specified\n");
> +		dev_dbg(&pdev->dev, "No spacc oldtimer specified\n");
>  		dev_dbg(&pdev->dev, "Default oldtimer (100000)\n");
>  		oldtimer = 100000;
>  	}
>  	priv->spacc.config.oldtimer = oldtimer;
>  
> -	if (of_property_read_u64(pdev->dev.of_node, "timer", &timer)) {
> -		dev_dbg(&pdev->dev, "No timer specified\n");
> +	if (of_property_read_u64(pdev->dev.of_node, "spacc-timer", &timer)) {
> +		dev_dbg(&pdev->dev, "No spacc timer specified\n");
>  		dev_dbg(&pdev->dev, "Default timer (100000)\n");
>  		timer = 100000;
>  	}
>  	priv->spacc.config.timer = timer;
>  
> -	baseaddr = devm_ioremap_resource(&pdev->dev, mem);
> +	baseaddr = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);
>  	if (IS_ERR(baseaddr)) {
>  		dev_err(&pdev->dev, "unable to map iomem\n");
>  		err = PTR_ERR(baseaddr);
> @@ -127,12 +117,6 @@ int spacc_probe(struct platform_device *pdev,
>  	}
>  
>  	pdu_get_version(baseaddr, &info);
> -	if (pdev->dev.platform_data) {
> -		struct pdu_info *parent_info = pdev->dev.platform_data;
> -
> -		memcpy(&info.pdu_config, &parent_info->pdu_config,
> -		       sizeof(info.pdu_config));
> -	}
>  
>  	dev_dbg(&pdev->dev, "EPN %04X : virt [%d]\n",
>  				info.spacc_version.project,
> @@ -273,18 +257,12 @@ static void spacc_unregister_algs(void)
>  #endif
>  }
>  
> -static const struct of_device_id snps_spacc_id[] = {
> -	{.compatible = "snps-dwc-spacc" },
> -	{ /*sentinel */        }
> -};
> -
> -MODULE_DEVICE_TABLE(of, snps_spacc_id);
>  
>  static int spacc_crypto_probe(struct platform_device *pdev)
>  {
>  	int rc;
>  
> -	rc = spacc_probe(pdev, snps_spacc_id);
> +	rc = spacc_probe(pdev);
>  	if (rc < 0)
>  		goto err;
>  
> @@ -326,7 +304,7 @@ static struct platform_driver spacc_driver = {
>  	.remove = spacc_crypto_remove,
>  	.driver = {
>  		.name  = "spacc",
> -		.of_match_table = of_match_ptr(snps_spacc_id),
> +		.of_match_table = snps_spacc_id,
>  		.owner = THIS_MODULE,
>  	},
>  };
> diff --git a/drivers/crypto/dwc-spacc/spacc_device.h b/drivers/crypto/dwc-spacc/spacc_device.h
> index be7fde25046b..e6a34dc20eba 100644
> --- a/drivers/crypto/dwc-spacc/spacc_device.h
> +++ b/drivers/crypto/dwc-spacc/spacc_device.h
> @@ -224,8 +224,7 @@ int spacc_unregister_aead_algs(void);
>  int probe_ciphers(struct platform_device *spacc_pdev);
>  int spacc_unregister_cipher_algs(void);
>  
> -int spacc_probe(struct platform_device *pdev,
> -		const struct of_device_id snps_spacc_id[]);
> +int spacc_probe(struct platform_device *pdev);
>  
>  irqreturn_t spacc_irq_handler(int irq, void *dev);
>  #endif
> diff --git a/drivers/crypto/dwc-spacc/spacc_skcipher.c b/drivers/crypto/dwc-spacc/spacc_skcipher.c
> index 1ef7c665188f..8410ad9d9910 100644
> --- a/drivers/crypto/dwc-spacc/spacc_skcipher.c
> +++ b/drivers/crypto/dwc-spacc/spacc_skcipher.c
> @@ -401,41 +401,40 @@ static int spacc_cipher_process(struct skcipher_request *req, int enc_dec)
>  			return ret;
>  		}
>  	}
> -
>  	if (salg->mode->id == CRYPTO_MODE_AES_CTR ||
>  	    salg->mode->id == CRYPTO_MODE_SM4_CTR) {
>  		/* copy the IV to local buffer */
>  		for (i = 0; i < 16; i++)
>  			ivc1[i] = req->iv[i];
>  
> -		/* 64-bit counter width */
> -		if (readl(device_h->regmap + SPACC_REG_VERSION_EXT_3) & (0x3)) {
> +		/* 32-bit counter width */
> +		if (readl(device_h->regmap + SPACC_REG_VERSION_EXT_3) & (0x2)) {

Your patch is absolute mess.

You must organize your changes logically. Please read carefully
submitting patches document.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] Device tree registration and property names changes
       [not found]   ` <CALxtO0mREXjvGWYpL5PQUXAJ+v8yT9rHSOn69mfe7EMNz_LnmA@mail.gmail.com>
@ 2024-09-04  7:53     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-04  7:53 UTC (permalink / raw)
  To: Pavitrakumar Managutte
  Cc: herbert, robh, linux-crypto, Ruud.Derwig, manjunath.hadli,
	bhoomikak

On 04/09/2024 09:41, Pavitrakumar Managutte wrote:
> Hi Krzysztof,
>    Today's patch was an incremental fix on the SPAcc driver.
>    Please ignore this as I am pushing the complete driver patchset with the
> DT bindings for review.
>    SPAcc driver was reverted today since it was missing the DT bindings.
>    I have addressed all your concerns in the SPAcc driver patchset which I
> will be pushing today.

So we wasted time reviewing this?  I don't understand. Send finished
work or some finished stages, not something which you immediately
retract the moment people review it.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-04  7:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04  3:11 [PATCH 1/2] Device tree registration and property names changes Pavitrakumar M
2024-09-04  3:11 ` [PATCH 2/2] SPAcc DT bindings Pavitrakumar M
2024-09-04  6:08   ` Krzysztof Kozlowski
2024-09-04  6:09 ` [PATCH 1/2] Device tree registration and property names changes Krzysztof Kozlowski
     [not found]   ` <CALxtO0mREXjvGWYpL5PQUXAJ+v8yT9rHSOn69mfe7EMNz_LnmA@mail.gmail.com>
2024-09-04  7:53     ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox