devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: crypto: sun8i-ce: Add compatible for D1
@ 2021-11-19  5:10 Samuel Holland
  2021-11-19  5:10 ` [PATCH 2/2] crypto: sun8i-ce: Add support for the D1 variant Samuel Holland
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Samuel Holland @ 2021-11-19  5:10 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S . Miller, linux-crypto
  Cc: Rob Herring, devicetree, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, linux-sunxi, Samuel Holland

D1 has a crypto engine similar to the one in other Allwinner SoCs.
Like H6, it has a separate MBUS clock gate.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 .../devicetree/bindings/crypto/allwinner,sun8i-ce.yaml      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/crypto/allwinner,sun8i-ce.yaml b/Documentation/devicetree/bindings/crypto/allwinner,sun8i-ce.yaml
index 00648f9d9278..d43a8aad8680 100644
--- a/Documentation/devicetree/bindings/crypto/allwinner,sun8i-ce.yaml
+++ b/Documentation/devicetree/bindings/crypto/allwinner,sun8i-ce.yaml
@@ -14,6 +14,7 @@ properties:
     enum:
       - allwinner,sun8i-h3-crypto
       - allwinner,sun8i-r40-crypto
+      - allwinner,sun20i-d1-crypto
       - allwinner,sun50i-a64-crypto
       - allwinner,sun50i-h5-crypto
       - allwinner,sun50i-h6-crypto
@@ -44,7 +45,10 @@ properties:
 if:
   properties:
     compatible:
-      const: allwinner,sun50i-h6-crypto
+      contains:
+        enum:
+          - allwinner,sun20i-d1-crypto
+          - allwinner,sun50i-h6-crypto
 then:
   properties:
     clocks:
-- 
2.32.0


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

* [PATCH 2/2] crypto: sun8i-ce: Add support for the D1 variant
  2021-11-19  5:10 [PATCH 1/2] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
@ 2021-11-19  5:10 ` Samuel Holland
  2021-11-26  5:31   ` Herbert Xu
  2021-11-19  8:29 ` [PATCH 1/2] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Maxime Ripard
  2021-11-29 23:13 ` Rob Herring
  2 siblings, 1 reply; 5+ messages in thread
From: Samuel Holland @ 2021-11-19  5:10 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S . Miller, linux-crypto
  Cc: Rob Herring, devicetree, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, linux-sunxi, Samuel Holland

From: Corentin Labbe <clabbe.montjoie@gmail.com>

The Allwinner D1 SoC has a crypto engine compatible with sun8i-ce.
Add support for it.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 .../crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 21 +++++++++++++++++++
 drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h  |  1 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
index 00194d1d9ae6..d8623c7e0d1d 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
@@ -106,6 +106,24 @@ static const struct ce_variant ce_a64_variant = {
 	.trng = CE_ID_NOTSUPP,
 };
 
+static const struct ce_variant ce_d1_variant = {
+	.alg_cipher = { CE_ALG_AES, CE_ALG_DES, CE_ALG_3DES,
+	},
+	.alg_hash = { CE_ALG_MD5, CE_ALG_SHA1, CE_ALG_SHA224, CE_ALG_SHA256,
+		CE_ALG_SHA384, CE_ALG_SHA512
+	},
+	.op_mode = { CE_OP_ECB, CE_OP_CBC
+	},
+	.ce_clks = {
+		{ "bus", 0, 200000000 },
+		{ "mod", 300000000, 0 },
+		{ "ram", 0, 400000000 },
+		},
+	.esr = ESR_D1,
+	.prng = CE_ALG_PRNG,
+	.trng = CE_ALG_TRNG,
+};
+
 static const struct ce_variant ce_r40_variant = {
 	.alg_cipher = { CE_ALG_AES, CE_ALG_DES, CE_ALG_3DES,
 	},
@@ -192,6 +210,7 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name)
 			dev_err(ce->dev, "CE ERROR: keysram access error for AES\n");
 		break;
 	case ESR_A64:
+	case ESR_D1:
 	case ESR_H5:
 	case ESR_R40:
 		v >>= (flow * 4);
@@ -990,6 +1009,8 @@ static const struct of_device_id sun8i_ce_crypto_of_match_table[] = {
 	  .data = &ce_h3_variant },
 	{ .compatible = "allwinner,sun8i-r40-crypto",
 	  .data = &ce_r40_variant },
+	{ .compatible = "allwinner,sun20i-d1-crypto",
+	  .data = &ce_d1_variant },
 	{ .compatible = "allwinner,sun50i-a64-crypto",
 	  .data = &ce_a64_variant },
 	{ .compatible = "allwinner,sun50i-h5-crypto",
diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h
index cec781d5063c..624a5926f21f 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h
@@ -94,6 +94,7 @@
 #define ESR_R40	2
 #define ESR_H5	3
 #define ESR_H6	4
+#define ESR_D1	5
 
 #define PRNG_DATA_SIZE (160 / 8)
 #define PRNG_SEED_SIZE DIV_ROUND_UP(175, 8)
-- 
2.32.0


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

* Re: [PATCH 1/2] dt-bindings: crypto: sun8i-ce: Add compatible for D1
  2021-11-19  5:10 [PATCH 1/2] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
  2021-11-19  5:10 ` [PATCH 2/2] crypto: sun8i-ce: Add support for the D1 variant Samuel Holland
@ 2021-11-19  8:29 ` Maxime Ripard
  2021-11-29 23:13 ` Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2021-11-19  8:29 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Corentin Labbe, Herbert Xu, David S . Miller, linux-crypto,
	Rob Herring, devicetree, Chen-Yu Tsai, Jernej Skrabec,
	linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

On Thu, Nov 18, 2021 at 11:10:24PM -0600, Samuel Holland wrote:
> D1 has a crypto engine similar to the one in other Allwinner SoCs.
> Like H6, it has a separate MBUS clock gate.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Acked-by: Maxime Ripard <maxime@cerno.tech>

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 2/2] crypto: sun8i-ce: Add support for the D1 variant
  2021-11-19  5:10 ` [PATCH 2/2] crypto: sun8i-ce: Add support for the D1 variant Samuel Holland
@ 2021-11-26  5:31   ` Herbert Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2021-11-26  5:31 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Corentin Labbe, David S . Miller, linux-crypto, Rob Herring,
	devicetree, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec,
	linux-sunxi

On Thu, Nov 18, 2021 at 11:10:25PM -0600, Samuel Holland wrote:
> From: Corentin Labbe <clabbe.montjoie@gmail.com>
> 
> The Allwinner D1 SoC has a crypto engine compatible with sun8i-ce.
> Add support for it.
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  .../crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 21 +++++++++++++++++++
>  drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h  |  1 +
>  2 files changed, 22 insertions(+)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH 1/2] dt-bindings: crypto: sun8i-ce: Add compatible for D1
  2021-11-19  5:10 [PATCH 1/2] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
  2021-11-19  5:10 ` [PATCH 2/2] crypto: sun8i-ce: Add support for the D1 variant Samuel Holland
  2021-11-19  8:29 ` [PATCH 1/2] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Maxime Ripard
@ 2021-11-29 23:13 ` Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2021-11-29 23:13 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Jernej Skrabec, Herbert Xu, linux-crypto, Rob Herring,
	Maxime Ripard, Corentin Labbe, linux-sunxi, Chen-Yu Tsai,
	David S . Miller, devicetree

On Thu, 18 Nov 2021 23:10:24 -0600, Samuel Holland wrote:
> D1 has a crypto engine similar to the one in other Allwinner SoCs.
> Like H6, it has a separate MBUS clock gate.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  .../devicetree/bindings/crypto/allwinner,sun8i-ce.yaml      | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

end of thread, other threads:[~2021-11-29 23:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19  5:10 [PATCH 1/2] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
2021-11-19  5:10 ` [PATCH 2/2] crypto: sun8i-ce: Add support for the D1 variant Samuel Holland
2021-11-26  5:31   ` Herbert Xu
2021-11-19  8:29 ` [PATCH 1/2] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Maxime Ripard
2021-11-29 23:13 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).