mbox series

[v3,0/2] Add support for Texas Instruments DTHE V2 crypto accelerator

Message ID 20250502121253.456974-2-t-pratham@ti.com
Headers show
Series Add support for Texas Instruments DTHE V2 crypto accelerator | expand

Message

T Pratham May 2, 2025, 11:51 a.m. UTC
This series adds support for TI DTHE V2 crypto accelerator. DTHE V2 is a
new crypto accelerator which contains multiple crypto IPs [1].
This series implements support for ECB and CBC modes of AES for the AES
Engine of the DTHE, using skcipher APIs of the kernel.

Tested with:
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y

and tcrypt,
sudo modprobe tcrypt mode=500 sec=1

Signed-off-by: T Pratham <t-pratham@ti.com>
---
[1]: Section 14.6.3 (DMA Control Registers -> DMASS_DTHE)
Link: https://www.ti.com/lit/ug/sprujb4/sprujb4.pdf

Change log:
v3:
 - Corrected dt-bindings reg length is too long error
 - Converted AES driver code to use crypto_engine APIs for using
   internal crypto queue instead of mutex.
 - Removed calls to skcipher_request_complete in paths not returning
   -EINPROGRESS before.
 - Added missing KConfig import, which was accidentally removed in v2.

v2:
 - Corrected dt-bindings syntax errors and other review comments in v1.
 - Completely changed driver code structure, splitting code into
   multiple files

Link to previous versions:
v2: https://lore.kernel.org/all/20250411091321.2925308-1-t-pratham@ti.com/
v1: https://lore.kernel.org/all/20250206-dthe-v2-aes-v1-0-1e86cf683928@ti.com/
---
T Pratham (2):
  dt-bindings: crypto: Add binding for TI DTHE V2 driver
  crypto: ti: Add driver for DTHE V2 AES Engine (ECB, CBC)

 .../devicetree/bindings/crypto/ti,dthev2.yaml |  55 +++
 MAINTAINERS                                   |   7 +
 drivers/crypto/Kconfig                        |   1 +
 drivers/crypto/Makefile                       |   1 +
 drivers/crypto/ti/Kconfig                     |  13 +
 drivers/crypto/ti/Makefile                    |   3 +
 drivers/crypto/ti/dthev2-aes.c                | 414 ++++++++++++++++++
 drivers/crypto/ti/dthev2-common.c             | 220 ++++++++++
 drivers/crypto/ti/dthev2-common.h             | 110 +++++
 9 files changed, 824 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/ti,dthev2.yaml
 create mode 100644 drivers/crypto/ti/Kconfig
 create mode 100644 drivers/crypto/ti/Makefile
 create mode 100644 drivers/crypto/ti/dthev2-aes.c
 create mode 100644 drivers/crypto/ti/dthev2-common.c
 create mode 100644 drivers/crypto/ti/dthev2-common.h

Comments

Krzysztof Kozlowski May 4, 2025, 5:17 p.m. UTC | #1
On Fri, May 02, 2025 at 05:21:16PM GMT, T Pratham wrote:
> Add DT binding for Texas Instruments DTHE V2 crypto accelerator.
> 
> DTHE V2 is introduced as a part of TI AM62L SoC and can currently be
> only found in it.
> 
> Signed-off-by: T Pratham <t-pratham@ti.com>
> ---
>  .../devicetree/bindings/crypto/ti,dthev2.yaml | 55 +++++++++++++++++++

Filename: nothing improved.

>  MAINTAINERS                                   |  6 ++
>  2 files changed, 61 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/crypto/ti,dthev2.yaml
> 
> diff --git a/Documentation/devicetree/bindings/crypto/ti,dthev2.yaml b/Documentation/devicetree/bindings/crypto/ti,dthev2.yaml
> new file mode 100644
> index 000000000000..68ed9923eebb
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/crypto/ti,dthev2.yaml
> @@ -0,0 +1,55 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/crypto/ti,dthev2.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: K3 SoC DTHE V2 crypto module
> +
> +maintainers:
> +  - T Pratham <t-pratham@ti.com>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - ti,am62l-dthev2
> +
> +  reg:
> +    maxItems: 1
> +
> +  dmas:
> +    items:
> +      - description: AES Engine RX DMA Channel
> +      - description: AES Engine TX DMA Channel
> +      - description: SHA Engine TX DMA Channel
> +
> +  dma-names:
> +    items:
> +      - const: rx
> +      - const: tx1
> +      - const: tx2
> +
> +required:
> +  - compatible
> +  - reg
> +  - dmas
> +  - dma-names
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    cbass_main {

soc or whatever is reasonable, but follow DTS coding style.

I already asked to match coding style, although about wrapping :/

> +        #address-cells = <2>;
> +        #size-cells = <2>;
> +
> +        crypto@40800000 {
> +          compatible = "ti,am62l-dthev2";
> +          reg = <0x00 0x40800000 0x00 0x10000>;
> +
> +          dmas = <&main_bcdma 0 0 0x4700 0>,
> +                <&main_bcdma 0 0 0xc701 0>,
> +                <&main_bcdma 0 0 0xc700 0>;

Looks misaligned, again, see DTS coding style

> +          dma-names = "rx", "tx1", "tx2";
> +        };

Best regards,
Krzysztof