linux-sunxi.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] crypto: Allwinner D1 crypto support
@ 2022-12-31 22:01 Samuel Holland
  2022-12-31 22:01 ` [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Samuel Holland @ 2022-12-31 22:01 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S . Miller, Chen-Yu Tsai,
	Jernej Skrabec, Krzysztof Kozlowski, Rob Herring
  Cc: Samuel Holland, Albert Ou, Conor Dooley, Palmer Dabbelt,
	Paul Walmsley, devicetree, linux-arm-kernel, linux-crypto,
	linux-kernel, linux-riscv, linux-sunxi

This series finishes adding crypto support for the Allwinner D1 SoC. The
driver patch from v1 was merged, but not the binding[1]. This turned out
to be a good thing, because I later found that the TRNG needed another
clock reference in the devicetree. That is fixed in v2. I include the DT
update here too, since the SoC DT has been on the list for a while[2].

[1]: https://lore.kernel.org/all/20211119051026.13049-1-samuel@sholland.org/T/
[2]: https://lore.kernel.org/lkml/20221208090237.20572-1-samuel@sholland.org/

Changes in v2:
 - Add TRNG clock

Samuel Holland (3):
  dt-bindings: crypto: sun8i-ce: Add compatible for D1
  crypto: sun8i-ce - Add TRNG clock to the D1 variant
  riscv: dts: allwinner: d1: Add crypto engine node

 .../bindings/crypto/allwinner,sun8i-ce.yaml   | 33 ++++++++++++++-----
 .../boot/dts/allwinner/sunxi-d1s-t113.dtsi    | 12 +++++++
 .../crypto/allwinner/sun8i-ce/sun8i-ce-core.c |  1 +
 drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h  |  2 +-
 4 files changed, 39 insertions(+), 9 deletions(-)

-- 
2.37.4


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

* [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1
  2022-12-31 22:01 [PATCH v2 0/3] crypto: Allwinner D1 crypto support Samuel Holland
@ 2022-12-31 22:01 ` Samuel Holland
  2023-01-01 15:57   ` Krzysztof Kozlowski
                     ` (2 more replies)
  2022-12-31 22:01 ` [PATCH v2 2/3] crypto: sun8i-ce - Add TRNG clock to the D1 variant Samuel Holland
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 15+ messages in thread
From: Samuel Holland @ 2022-12-31 22:01 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S . Miller, Chen-Yu Tsai,
	Jernej Skrabec, Krzysztof Kozlowski, Rob Herring
  Cc: Samuel Holland, Albert Ou, Conor Dooley, Palmer Dabbelt,
	Paul Walmsley, devicetree, linux-arm-kernel, linux-crypto,
	linux-kernel, linux-riscv, linux-sunxi

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

It also requires the internal RC oscillator to be enabled for the TRNG
to return data, presumably because noise from the oscillator is used as
an entropy source. This is likely the case for earlier variants as well,
but it really only matters for H616 and newer SoCs, as H6 provides no
way to disable the internal oscillator.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---
I noticed that the vendor driver has code to explicitly enable IOSC when
using the TRNG on A83T (search SS_TRNG_OSC_ADDR), but that is covered by
a different binding/driver in mainline.

Changes in v2:
 - Add TRNG clock

 .../bindings/crypto/allwinner,sun8i-ce.yaml   | 33 ++++++++++++++-----
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/allwinner,sun8i-ce.yaml b/Documentation/devicetree/bindings/crypto/allwinner,sun8i-ce.yaml
index 026a9f9e1aeb..4287678aa79f 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
@@ -29,6 +30,7 @@ properties:
       - description: Bus clock
       - description: Module clock
       - description: MBus clock
+      - description: TRNG clock (RC oscillator)
     minItems: 2
 
   clock-names:
@@ -36,6 +38,7 @@ properties:
       - const: bus
       - const: mod
       - const: ram
+      - const: trng
     minItems: 2
 
   resets:
@@ -44,19 +47,33 @@ properties:
 if:
   properties:
     compatible:
-      const: allwinner,sun50i-h6-crypto
+      enum:
+        - allwinner,sun20i-d1-crypto
 then:
   properties:
     clocks:
-      minItems: 3
+      minItems: 4
     clock-names:
-      minItems: 3
+      minItems: 4
 else:
-  properties:
-    clocks:
-      maxItems: 2
-    clock-names:
-      maxItems: 2
+  if:
+    properties:
+      compatible:
+        const: allwinner,sun50i-h6-crypto
+  then:
+    properties:
+      clocks:
+        minItems: 3
+        maxItems: 3
+      clock-names:
+        minItems: 3
+        maxItems: 3
+  else:
+    properties:
+      clocks:
+        maxItems: 2
+      clock-names:
+        maxItems: 2
 
 required:
   - compatible
-- 
2.37.4


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

* [PATCH v2 2/3] crypto: sun8i-ce - Add TRNG clock to the D1 variant
  2022-12-31 22:01 [PATCH v2 0/3] crypto: Allwinner D1 crypto support Samuel Holland
  2022-12-31 22:01 ` [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
@ 2022-12-31 22:01 ` Samuel Holland
  2023-01-05 16:29   ` Jernej Škrabec
  2023-01-06  8:18   ` Corentin Labbe
  2022-12-31 22:01 ` [PATCH v2 3/3] riscv: dts: allwinner: d1: Add crypto engine node Samuel Holland
  2023-01-13  8:40 ` [PATCH v2 0/3] crypto: Allwinner D1 crypto support Herbert Xu
  3 siblings, 2 replies; 15+ messages in thread
From: Samuel Holland @ 2022-12-31 22:01 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S . Miller, Chen-Yu Tsai,
	Jernej Skrabec, Krzysztof Kozlowski, Rob Herring
  Cc: Samuel Holland, Albert Ou, Conor Dooley, Palmer Dabbelt,
	Paul Walmsley, devicetree, linux-arm-kernel, linux-crypto,
	linux-kernel, linux-riscv, linux-sunxi

At least the D1 variant requires a separate clock for the TRNG.
Without this clock enabled, reading from /dev/hwrng reports:

   sun8i-ce 3040000.crypto: DMA timeout for TRNG (tm=96) on flow 3

Experimentation shows that the necessary clock is the SoC's internal
RC oscillator. This makes sense, as noise from the oscillator can be
used as a source of entropy.

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

Changes in v2:
 - New patch for v2

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

diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
index 9f6594699835..a6865ff4d400 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
@@ -118,6 +118,7 @@ static const struct ce_variant ce_d1_variant = {
 		{ "bus", 0, 200000000 },
 		{ "mod", 300000000, 0 },
 		{ "ram", 0, 400000000 },
+		{ "trng", 0, 0 },
 		},
 	.esr = ESR_D1,
 	.prng = CE_ALG_PRNG,
diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h
index 8177aaba4434..27029fb77e29 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h
@@ -105,7 +105,7 @@
 
 #define MAX_SG 8
 
-#define CE_MAX_CLOCKS 3
+#define CE_MAX_CLOCKS 4
 
 #define MAXFLOW 4
 
-- 
2.37.4


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

* [PATCH v2 3/3] riscv: dts: allwinner: d1: Add crypto engine node
  2022-12-31 22:01 [PATCH v2 0/3] crypto: Allwinner D1 crypto support Samuel Holland
  2022-12-31 22:01 ` [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
  2022-12-31 22:01 ` [PATCH v2 2/3] crypto: sun8i-ce - Add TRNG clock to the D1 variant Samuel Holland
@ 2022-12-31 22:01 ` Samuel Holland
  2023-01-05 16:30   ` Jernej Škrabec
                     ` (2 more replies)
  2023-01-13  8:40 ` [PATCH v2 0/3] crypto: Allwinner D1 crypto support Herbert Xu
  3 siblings, 3 replies; 15+ messages in thread
From: Samuel Holland @ 2022-12-31 22:01 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S . Miller, Chen-Yu Tsai,
	Jernej Skrabec, Krzysztof Kozlowski, Rob Herring
  Cc: Samuel Holland, Albert Ou, Conor Dooley, Palmer Dabbelt,
	Paul Walmsley, devicetree, linux-arm-kernel, linux-crypto,
	linux-kernel, linux-riscv, linux-sunxi

D1 contains a crypto engine which is supported by the sun8i-ce driver.

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

Changes in v2:
 - New patch for v2

 arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
index dff363a3c934..b30b4b1465f6 100644
--- a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
+++ b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
@@ -378,6 +378,18 @@ sid: efuse@3006000 {
 			#size-cells = <1>;
 		};
 
+		crypto: crypto@3040000 {
+			compatible = "allwinner,sun20i-d1-crypto";
+			reg = <0x3040000 0x800>;
+			interrupts = <SOC_PERIPHERAL_IRQ(52) IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_CE>,
+				 <&ccu CLK_CE>,
+				 <&ccu CLK_MBUS_CE>,
+				 <&rtc CLK_IOSC>;
+			clock-names = "bus", "mod", "ram", "trng";
+			resets = <&ccu RST_BUS_CE>;
+		};
+
 		mbus: dram-controller@3102000 {
 			compatible = "allwinner,sun20i-d1-mbus";
 			reg = <0x3102000 0x1000>,
-- 
2.37.4


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

* Re: [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1
  2022-12-31 22:01 ` [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
@ 2023-01-01 15:57   ` Krzysztof Kozlowski
  2023-01-06  8:20   ` Corentin Labbe
  2023-01-13  3:51   ` Herbert Xu
  2 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-01 15:57 UTC (permalink / raw)
  To: Samuel Holland, Corentin Labbe, Herbert Xu, David S . Miller,
	Chen-Yu Tsai, Jernej Skrabec, Krzysztof Kozlowski, Rob Herring
  Cc: Albert Ou, Conor Dooley, Palmer Dabbelt, Paul Walmsley,
	devicetree, linux-arm-kernel, linux-crypto, linux-kernel,
	linux-riscv, linux-sunxi

On 31/12/2022 23:01, 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.
> 
> It also requires the internal RC oscillator to be enabled for the TRNG
> to return data, presumably because noise from the oscillator is used as
> an entropy source. This is likely the case for earlier variants as well,
> but it really only matters for H616 and newer SoCs, as H6 provides no
> way to disable the internal oscillator.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH v2 2/3] crypto: sun8i-ce - Add TRNG clock to the D1 variant
  2022-12-31 22:01 ` [PATCH v2 2/3] crypto: sun8i-ce - Add TRNG clock to the D1 variant Samuel Holland
@ 2023-01-05 16:29   ` Jernej Škrabec
  2023-01-06  8:18   ` Corentin Labbe
  1 sibling, 0 replies; 15+ messages in thread
From: Jernej Škrabec @ 2023-01-05 16:29 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S . Miller, Chen-Yu Tsai,
	Krzysztof Kozlowski, Rob Herring, Samuel Holland
  Cc: Samuel Holland, Albert Ou, Conor Dooley, Palmer Dabbelt,
	Paul Walmsley, devicetree, linux-arm-kernel, linux-crypto,
	linux-kernel, linux-riscv, linux-sunxi

Dne sobota, 31. december 2022 ob 23:01:44 CET je Samuel Holland napisal(a):
> At least the D1 variant requires a separate clock for the TRNG.
> Without this clock enabled, reading from /dev/hwrng reports:
> 
>    sun8i-ce 3040000.crypto: DMA timeout for TRNG (tm=96) on flow 3
> 
> Experimentation shows that the necessary clock is the SoC's internal
> RC oscillator. This makes sense, as noise from the oscillator can be
> used as a source of entropy.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej



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

* Re: [PATCH v2 3/3] riscv: dts: allwinner: d1: Add crypto engine node
  2022-12-31 22:01 ` [PATCH v2 3/3] riscv: dts: allwinner: d1: Add crypto engine node Samuel Holland
@ 2023-01-05 16:30   ` Jernej Škrabec
  2023-03-07 20:55   ` Palmer Dabbelt
  2023-03-14 20:35   ` Jernej Škrabec
  2 siblings, 0 replies; 15+ messages in thread
From: Jernej Škrabec @ 2023-01-05 16:30 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S . Miller, Chen-Yu Tsai,
	Krzysztof Kozlowski, Rob Herring, Samuel Holland
  Cc: Samuel Holland, Albert Ou, Conor Dooley, Palmer Dabbelt,
	Paul Walmsley, devicetree, linux-arm-kernel, linux-crypto,
	linux-kernel, linux-riscv, linux-sunxi

Dne sobota, 31. december 2022 ob 23:01:45 CET je Samuel Holland napisal(a):
> D1 contains a crypto engine which is supported by the sun8i-ce driver.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej



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

* Re: [PATCH v2 2/3] crypto: sun8i-ce - Add TRNG clock to the D1 variant
  2022-12-31 22:01 ` [PATCH v2 2/3] crypto: sun8i-ce - Add TRNG clock to the D1 variant Samuel Holland
  2023-01-05 16:29   ` Jernej Škrabec
@ 2023-01-06  8:18   ` Corentin Labbe
  1 sibling, 0 replies; 15+ messages in thread
From: Corentin Labbe @ 2023-01-06  8:18 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Herbert Xu, David S . Miller, Chen-Yu Tsai, Jernej Skrabec,
	Krzysztof Kozlowski, Rob Herring, Albert Ou, Conor Dooley,
	Palmer Dabbelt, Paul Walmsley, devicetree, linux-arm-kernel,
	linux-crypto, linux-kernel, linux-riscv, linux-sunxi

Le Sat, Dec 31, 2022 at 04:01:44PM -0600, Samuel Holland a écrit :
> At least the D1 variant requires a separate clock for the TRNG.
> Without this clock enabled, reading from /dev/hwrng reports:
> 
>    sun8i-ce 3040000.crypto: DMA timeout for TRNG (tm=96) on flow 3
> 
> Experimentation shows that the necessary clock is the SoC's internal
> RC oscillator. This makes sense, as noise from the oscillator can be
> used as a source of entropy.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 

Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Thanks

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

* Re: [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1
  2022-12-31 22:01 ` [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
  2023-01-01 15:57   ` Krzysztof Kozlowski
@ 2023-01-06  8:20   ` Corentin Labbe
  2023-01-13  3:51   ` Herbert Xu
  2 siblings, 0 replies; 15+ messages in thread
From: Corentin Labbe @ 2023-01-06  8:20 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Herbert Xu, David S . Miller, Chen-Yu Tsai, Jernej Skrabec,
	Krzysztof Kozlowski, Rob Herring, Albert Ou, Conor Dooley,
	Palmer Dabbelt, Paul Walmsley, devicetree, linux-arm-kernel,
	linux-crypto, linux-kernel, linux-riscv, linux-sunxi

Le Sat, Dec 31, 2022 at 04:01:43PM -0600, Samuel Holland a écrit :
> D1 has a crypto engine similar to the one in other Allwinner SoCs.
> Like H6, it has a separate MBUS clock gate.
> 
> It also requires the internal RC oscillator to be enabled for the TRNG
> to return data, presumably because noise from the oscillator is used as
> an entropy source. This is likely the case for earlier variants as well,
> but it really only matters for H616 and newer SoCs, as H6 provides no
> way to disable the internal oscillator.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> I noticed that the vendor driver has code to explicitly enable IOSC when
> using the TRNG on A83T (search SS_TRNG_OSC_ADDR), but that is covered by
> a different binding/driver in mainline.
> 
> Changes in v2:
>  - Add TRNG clock
> 
>  .../bindings/crypto/allwinner,sun8i-ce.yaml   | 33 ++++++++++++++-----
>  1 file changed, 25 insertions(+), 8 deletions(-)
> 

Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Thanks

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

* Re: [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1
  2022-12-31 22:01 ` [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
  2023-01-01 15:57   ` Krzysztof Kozlowski
  2023-01-06  8:20   ` Corentin Labbe
@ 2023-01-13  3:51   ` Herbert Xu
  2023-01-13  8:33     ` Krzysztof Kozlowski
  2 siblings, 1 reply; 15+ messages in thread
From: Herbert Xu @ 2023-01-13  3:51 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Corentin Labbe, David S . Miller, Chen-Yu Tsai, Jernej Skrabec,
	Krzysztof Kozlowski, Rob Herring, Albert Ou, Conor Dooley,
	Palmer Dabbelt, Paul Walmsley, devicetree, linux-arm-kernel,
	linux-crypto, linux-kernel, linux-riscv, linux-sunxi

On Sat, Dec 31, 2022 at 04:01:43PM -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.
> 
> It also requires the internal RC oscillator to be enabled for the TRNG
> to return data, presumably because noise from the oscillator is used as
> an entropy source. This is likely the case for earlier variants as well,
> but it really only matters for H616 and newer SoCs, as H6 provides no
> way to disable the internal oscillator.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> I noticed that the vendor driver has code to explicitly enable IOSC when
> using the TRNG on A83T (search SS_TRNG_OSC_ADDR), but that is covered by
> a different binding/driver in mainline.
> 
> Changes in v2:
>  - Add TRNG clock
> 
>  .../bindings/crypto/allwinner,sun8i-ce.yaml   | 33 ++++++++++++++-----
>  1 file changed, 25 insertions(+), 8 deletions(-)

This doesn't have an ack from Rob Herring.  Would you like me
to apply just the crypto patch by itself?

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] 15+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1
  2023-01-13  3:51   ` Herbert Xu
@ 2023-01-13  8:33     ` Krzysztof Kozlowski
  2023-01-13  8:37       ` Herbert Xu
  0 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-13  8:33 UTC (permalink / raw)
  To: Herbert Xu, Samuel Holland
  Cc: Corentin Labbe, David S . Miller, Chen-Yu Tsai, Jernej Skrabec,
	Krzysztof Kozlowski, Rob Herring, Albert Ou, Conor Dooley,
	Palmer Dabbelt, Paul Walmsley, devicetree, linux-arm-kernel,
	linux-crypto, linux-kernel, linux-riscv, linux-sunxi

On 13/01/2023 04:51, Herbert Xu wrote:
> On Sat, Dec 31, 2022 at 04:01:43PM -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.
>>
>> It also requires the internal RC oscillator to be enabled for the TRNG
>> to return data, presumably because noise from the oscillator is used as
>> an entropy source. This is likely the case for earlier variants as well,
>> but it really only matters for H616 and newer SoCs, as H6 provides no
>> way to disable the internal oscillator.
>>
>> Signed-off-by: Samuel Holland <samuel@sholland.org>
>> ---
>> I noticed that the vendor driver has code to explicitly enable IOSC when
>> using the TRNG on A83T (search SS_TRNG_OSC_ADDR), but that is covered by
>> a different binding/driver in mainline.
>>
>> Changes in v2:
>>  - Add TRNG clock
>>
>>  .../bindings/crypto/allwinner,sun8i-ce.yaml   | 33 ++++++++++++++-----
>>  1 file changed, 25 insertions(+), 8 deletions(-)
> 
> This doesn't have an ack from Rob Herring.  Would you like me
> to apply just the crypto patch by itself?

But it has my Reviewed-by, which is equivalent. Please take it via
crypto with the driver change.

Best regards,
Krzysztof


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

* Re: [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1
  2023-01-13  8:33     ` Krzysztof Kozlowski
@ 2023-01-13  8:37       ` Herbert Xu
  0 siblings, 0 replies; 15+ messages in thread
From: Herbert Xu @ 2023-01-13  8:37 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Samuel Holland, Corentin Labbe, David S . Miller, Chen-Yu Tsai,
	Jernej Skrabec, Krzysztof Kozlowski, Rob Herring, Albert Ou,
	Conor Dooley, Palmer Dabbelt, Paul Walmsley, devicetree,
	linux-arm-kernel, linux-crypto, linux-kernel, linux-riscv,
	linux-sunxi

On Fri, Jan 13, 2023 at 09:33:32AM +0100, Krzysztof Kozlowski wrote:
>
> But it has my Reviewed-by, which is equivalent. Please take it via
> crypto with the driver change.

Thanks for the clarification.  I'll take patches 1+2 then.  Patch
3 doesn't apply to cryptodev as the file doesn't exist in my tree.

Cheers,
-- 
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] 15+ messages in thread

* Re: [PATCH v2 0/3] crypto: Allwinner D1 crypto support
  2022-12-31 22:01 [PATCH v2 0/3] crypto: Allwinner D1 crypto support Samuel Holland
                   ` (2 preceding siblings ...)
  2022-12-31 22:01 ` [PATCH v2 3/3] riscv: dts: allwinner: d1: Add crypto engine node Samuel Holland
@ 2023-01-13  8:40 ` Herbert Xu
  3 siblings, 0 replies; 15+ messages in thread
From: Herbert Xu @ 2023-01-13  8:40 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Corentin Labbe, David S . Miller, Chen-Yu Tsai, Jernej Skrabec,
	Krzysztof Kozlowski, Rob Herring, Albert Ou, Conor Dooley,
	Palmer Dabbelt, Paul Walmsley, devicetree, linux-arm-kernel,
	linux-crypto, linux-kernel, linux-riscv, linux-sunxi

On Sat, Dec 31, 2022 at 04:01:42PM -0600, Samuel Holland wrote:
> This series finishes adding crypto support for the Allwinner D1 SoC. The
> driver patch from v1 was merged, but not the binding[1]. This turned out
> to be a good thing, because I later found that the TRNG needed another
> clock reference in the devicetree. That is fixed in v2. I include the DT
> update here too, since the SoC DT has been on the list for a while[2].
> 
> [1]: https://lore.kernel.org/all/20211119051026.13049-1-samuel@sholland.org/T/
> [2]: https://lore.kernel.org/lkml/20221208090237.20572-1-samuel@sholland.org/
> 
> Changes in v2:
>  - Add TRNG clock
> 
> Samuel Holland (3):
>   dt-bindings: crypto: sun8i-ce: Add compatible for D1
>   crypto: sun8i-ce - Add TRNG clock to the D1 variant
>   riscv: dts: allwinner: d1: Add crypto engine node
> 
>  .../bindings/crypto/allwinner,sun8i-ce.yaml   | 33 ++++++++++++++-----
>  .../boot/dts/allwinner/sunxi-d1s-t113.dtsi    | 12 +++++++
>  .../crypto/allwinner/sun8i-ce/sun8i-ce-core.c |  1 +
>  drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h  |  2 +-
>  4 files changed, 39 insertions(+), 9 deletions(-)
> 
> -- 
> 2.37.4

Patches 1-2 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] 15+ messages in thread

* Re: [PATCH v2 3/3] riscv: dts: allwinner: d1: Add crypto engine node
  2022-12-31 22:01 ` [PATCH v2 3/3] riscv: dts: allwinner: d1: Add crypto engine node Samuel Holland
  2023-01-05 16:30   ` Jernej Škrabec
@ 2023-03-07 20:55   ` Palmer Dabbelt
  2023-03-14 20:35   ` Jernej Škrabec
  2 siblings, 0 replies; 15+ messages in thread
From: Palmer Dabbelt @ 2023-03-07 20:55 UTC (permalink / raw)
  To: samuel
  Cc: clabbe.montjoie, herbert, davem, wens, jernej.skrabec,
	krzysztof.kozlowski+dt, robh+dt, samuel, aou, Conor Dooley,
	Paul Walmsley, devicetree, linux-arm-kernel, linux-crypto,
	linux-kernel, linux-riscv, linux-sunxi

On Sat, 31 Dec 2022 14:01:45 PST (-0800), samuel@sholland.org wrote:
> D1 contains a crypto engine which is supported by the sun8i-ce driver.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
>
> Changes in v2:
>  - New patch for v2
>
>  arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
> index dff363a3c934..b30b4b1465f6 100644
> --- a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
> +++ b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
> @@ -378,6 +378,18 @@ sid: efuse@3006000 {
>  			#size-cells = <1>;
>  		};
>
> +		crypto: crypto@3040000 {
> +			compatible = "allwinner,sun20i-d1-crypto";
> +			reg = <0x3040000 0x800>;
> +			interrupts = <SOC_PERIPHERAL_IRQ(52) IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&ccu CLK_BUS_CE>,
> +				 <&ccu CLK_CE>,
> +				 <&ccu CLK_MBUS_CE>,
> +				 <&rtc CLK_IOSC>;
> +			clock-names = "bus", "mod", "ram", "trng";
> +			resets = <&ccu RST_BUS_CE>;
> +		};
> +
>  		mbus: dram-controller@3102000 {
>  			compatible = "allwinner,sun20i-d1-mbus";
>  			reg = <0x3102000 0x1000>,

Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

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

* Re: [PATCH v2 3/3] riscv: dts: allwinner: d1: Add crypto engine node
  2022-12-31 22:01 ` [PATCH v2 3/3] riscv: dts: allwinner: d1: Add crypto engine node Samuel Holland
  2023-01-05 16:30   ` Jernej Škrabec
  2023-03-07 20:55   ` Palmer Dabbelt
@ 2023-03-14 20:35   ` Jernej Škrabec
  2 siblings, 0 replies; 15+ messages in thread
From: Jernej Škrabec @ 2023-03-14 20:35 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S . Miller, Chen-Yu Tsai,
	Krzysztof Kozlowski, Rob Herring, Samuel Holland
  Cc: Samuel Holland, Albert Ou, Conor Dooley, Palmer Dabbelt,
	Paul Walmsley, devicetree, linux-arm-kernel, linux-crypto,
	linux-kernel, linux-riscv, linux-sunxi

Dne sobota, 31. december 2022 ob 23:01:45 CET je Samuel Holland napisal(a):
> D1 contains a crypto engine which is supported by the sun8i-ce driver.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Applied patch 3, thanks!

Best regards,
Jernej



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

end of thread, other threads:[~2023-03-14 20:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-31 22:01 [PATCH v2 0/3] crypto: Allwinner D1 crypto support Samuel Holland
2022-12-31 22:01 ` [PATCH v2 1/3] dt-bindings: crypto: sun8i-ce: Add compatible for D1 Samuel Holland
2023-01-01 15:57   ` Krzysztof Kozlowski
2023-01-06  8:20   ` Corentin Labbe
2023-01-13  3:51   ` Herbert Xu
2023-01-13  8:33     ` Krzysztof Kozlowski
2023-01-13  8:37       ` Herbert Xu
2022-12-31 22:01 ` [PATCH v2 2/3] crypto: sun8i-ce - Add TRNG clock to the D1 variant Samuel Holland
2023-01-05 16:29   ` Jernej Škrabec
2023-01-06  8:18   ` Corentin Labbe
2022-12-31 22:01 ` [PATCH v2 3/3] riscv: dts: allwinner: d1: Add crypto engine node Samuel Holland
2023-01-05 16:30   ` Jernej Škrabec
2023-03-07 20:55   ` Palmer Dabbelt
2023-03-14 20:35   ` Jernej Škrabec
2023-01-13  8:40 ` [PATCH v2 0/3] crypto: Allwinner D1 crypto support Herbert Xu

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).