# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/crypto/starfive,jh7110-crypto.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: StarFive Cryptographic Module

maintainers:
  - Jia Jie Ho <jiajie.ho@starfivetech.com>
  - William Qiu <william.qiu@starfivetech.com>

properties:
  compatible:
    enum:
      - starfive,jh7110-crypto
      - starfive,jh8100-crypto

  reg:
    maxItems: 1

  clocks:
    items:
      - description: Hardware reference clock
      - description: AHB reference clock

  clock-names:
    items:
      - const: hclk
      - const: ahb

  interrupts:
    minItems: 1
    items:
      - description: SHA2 module irq
      - description: SM3 module irq

  resets:
    maxItems: 1

  dmas:
    items:
      - description: TX DMA channel
      - description: RX DMA channel

  dma-names:
    items:
      - const: tx
      - const: rx

required:
  - compatible
  - reg
  - clocks
  - clock-names
  - resets
  - dmas
  - dma-names

additionalProperties: false

allOf:
  - if:
      properties:
        compatible:
          const: starfive,jh7110-crypto

    then:
      properties:
        interrupts:
          maxItems: 1

  - if:
      properties:
        compatible:
          const: starfive,jh8100-crypto

    then:
      properties:
        interrupts:
          minItems: 2

examples:
  - |
    crypto: crypto@16000000 {
        compatible = "starfive,jh7110-crypto";
        reg = <0x16000000 0x4000>;
        clocks = <&clk 15>, <&clk 16>;
        clock-names = "hclk", "ahb";
        interrupts = <28>;
        resets = <&reset 3>;
        dmas = <&dma 1 2>,
               <&dma 0 2>;
        dma-names = "tx", "rx";
    };
...
