2022-06-01 12:01:15

by Neal Liu

[permalink] [raw]
Subject: [PATCH 0/5] Add Aspeed crypto driver for hardware acceleration

Aspeed Hash and Crypto Engine (HACE) is designed to accelerate the
throughput of hash data digest, encryption and decryption.

These patches aim to add Aspeed hash & crypto driver support.
The hash & crypto driver also pass the run-time self tests that
take place at algorithm registration.

Neal Liu (5):
crypto: aspeed: Add HACE hash driver
dt-bindings: clock: Add AST2600 HACE reset definition
ARM: dts: aspeed: Add HACE device controller node
dt-bindings: crypto: add documentation for aspeed hace
crypto: aspeed: add HACE crypto driver

.../bindings/crypto/aspeed,hace.yaml | 58 +
MAINTAINERS | 7 +
arch/arm/boot/dts/aspeed-g6.dtsi | 9 +
drivers/crypto/Kconfig | 1 +
drivers/crypto/Makefile | 1 +
drivers/crypto/aspeed/Kconfig | 38 +
drivers/crypto/aspeed/Makefile | 8 +
drivers/crypto/aspeed/aspeed-hace-crypto.c | 1019 +++++++++++++
drivers/crypto/aspeed/aspeed-hace-hash.c | 1335 +++++++++++++++++
drivers/crypto/aspeed/aspeed-hace.c | 305 ++++
drivers/crypto/aspeed/aspeed-hace.h | 286 ++++
include/dt-bindings/clock/ast2600-clock.h | 1 +
12 files changed, 3068 insertions(+)
create mode 100644 Documentation/devicetree/bindings/crypto/aspeed,hace.yaml
create mode 100644 drivers/crypto/aspeed/Kconfig
create mode 100644 drivers/crypto/aspeed/Makefile
create mode 100644 drivers/crypto/aspeed/aspeed-hace-crypto.c
create mode 100644 drivers/crypto/aspeed/aspeed-hace-hash.c
create mode 100644 drivers/crypto/aspeed/aspeed-hace.c
create mode 100644 drivers/crypto/aspeed/aspeed-hace.h

--
2.25.1



2022-06-01 17:51:09

by Neal Liu

[permalink] [raw]
Subject: [PATCH 3/5] ARM: dts: aspeed: Add HACE device controller node

Add hace node to device tree for AST2600.

Signed-off-by: Neal Liu <[email protected]>
Signed-off-by: Johnny Huang <[email protected]>
---
arch/arm/boot/dts/aspeed-g6.dtsi | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi
index 3d5ce9da42c3..553fea1ffaa4 100644
--- a/arch/arm/boot/dts/aspeed-g6.dtsi
+++ b/arch/arm/boot/dts/aspeed-g6.dtsi
@@ -304,6 +304,15 @@ apb {
#size-cells = <1>;
ranges;

+ hace: hace@1e6d0000 {
+ compatible = "aspeed,ast2600-hace";
+ reg = <0x1e6d0000 0x200>;
+ interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&syscon ASPEED_CLK_GATE_YCLK>;
+ clock-names = "yclk";
+ resets = <&syscon ASPEED_RESET_HACE>;
+ };
+
syscon: syscon@1e6e2000 {
compatible = "aspeed,ast2600-scu", "syscon", "simple-mfd";
reg = <0x1e6e2000 0x1000>;
--
2.25.1


2022-06-01 19:05:15

by Neal Liu

[permalink] [raw]
Subject: [PATCH 4/5] dt-bindings: crypto: add documentation for aspeed hace

Add device tree binding documentation for the Aspeed Hash
and Crypto Engines (HACE) Controller.

Signed-off-by: Neal Liu <[email protected]>
Signed-off-by: Johnny Huang <[email protected]>
---
.../bindings/crypto/aspeed,hace.yaml | 58 +++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 Documentation/devicetree/bindings/crypto/aspeed,hace.yaml

diff --git a/Documentation/devicetree/bindings/crypto/aspeed,hace.yaml b/Documentation/devicetree/bindings/crypto/aspeed,hace.yaml
new file mode 100644
index 000000000000..36b4ad0dc7fa
--- /dev/null
+++ b/Documentation/devicetree/bindings/crypto/aspeed,hace.yaml
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/crypto/aspeed,hace.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ASPEED HACE hash and crypto Hardware Accelerator Device Tree Bindings
+
+maintainers:
+ - Neal Liu <[email protected]>
+
+description: |
+ The Hash and Crypto Engine (HACE) is designed to accelerate the throughput
+ of hash data digest, encryption, and decryption. Basically, HACE can be
+ divided into two independently engines - Hash Engine and Crypto Engine.
+
+properties:
+ compatible:
+ enum:
+ - aspeed,ast2500-hace
+ - aspeed,ast2600-hace
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+ clock-names:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ resets:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - clock-names
+ - interrupts
+ - resets
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/ast2600-clock.h>
+ hace: hace@1e6d0000 {
+ compatible = "aspeed,ast2600-hace";
+ reg = <0x1e6d0000 0x200>;
+ interrupts = <4>;
+ clocks = <&syscon ASPEED_CLK_GATE_YCLK>;
+ clock-names = "yclk";
+ resets = <&syscon ASPEED_RESET_HACE>;
+ };
--
2.25.1


2022-06-01 19:14:47

by Neal Liu

[permalink] [raw]
Subject: RE: [PATCH 4/5] dt-bindings: crypto: add documentation for aspeed hace

> On 01/06/2022 07:42, Neal Liu wrote:
> > Add device tree binding documentation for the Aspeed Hash and Crypto
> > Engines (HACE) Controller.
> >
> > Signed-off-by: Neal Liu <[email protected]>
> > Signed-off-by: Johnny Huang <[email protected]>
> > ---
> > .../bindings/crypto/aspeed,hace.yaml | 58
> +++++++++++++++++++
> > 1 file changed, 58 insertions(+)
> > create mode 100644
> > Documentation/devicetree/bindings/crypto/aspeed,hace.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/crypto/aspeed,hace.yaml
> > b/Documentation/devicetree/bindings/crypto/aspeed,hace.yaml
> > new file mode 100644
> > index 000000000000..36b4ad0dc7fa
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/crypto/aspeed,hace.yaml
>
> Filename should be rather from the first compatible, so
> "aspeed,ast2500-hace.yaml"
>
Got it, I'll revise it as you suggested.

> > @@ -0,0 +1,58 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/crypto/aspeed,hace.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: ASPEED HACE hash and crypto Hardware Accelerator Device Tree
> > +Bindings
>
> s/Device Tree Bindings//
>
Got it, I'll revise it as you suggested.

> > +
> > +maintainers:
> > + - Neal Liu <[email protected]>
> > +
> > +description: |
> > + The Hash and Crypto Engine (HACE) is designed to accelerate the
> > +throughput
> > + of hash data digest, encryption, and decryption. Basically, HACE
> > +can be
> > + divided into two independently engines - Hash Engine and Crypto Engine.
> > +
> > +properties:
> > + compatible:
> > + enum:
> > + - aspeed,ast2500-hace
> > + - aspeed,ast2600-hace
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + clocks:
> > + maxItems: 1
> > +
> > + clock-names:
> > + maxItems: 1
>
> You need to list clock names, however usually it does not make sense to have
> names for just one main device clock.
>
I think list clock-names is optional, I'll remove it from required list.

> > +
> > + interrupts:
> > + maxItems: 1
> > +
> > + resets:
> > + maxItems: 1
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - clocks
> > + - clock-names
> > + - interrupts
> > + - resets
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + #include <dt-bindings/clock/ast2600-clock.h>
> > + hace: hace@1e6d0000 {
>
> Generic node names so "crypto".
>
Got it, I'll revise it as you suggested.

> > + compatible = "aspeed,ast2600-hace";
> > + reg = <0x1e6d0000 0x200>;
> > + interrupts = <4>;
> > + clocks = <&syscon ASPEED_CLK_GATE_YCLK>;
> > + clock-names = "yclk";
> > + resets = <&syscon ASPEED_RESET_HACE>;
> > + };
>
>
> Best regards,
> Krzysztof