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

title: Qualcomm Shikra Network-On-Chip interconnect

maintainers:
  - Raviteja Laggyshetty <raviteja.laggyshetty@oss.qualcomm.com>

description:
  The Qualcomm Shikra interconnect providers support adjusting the
  bandwidth requirements between the various NoC fabrics.

properties:
  compatible:
    enum:
      - qcom,shikra-config-noc
      - qcom,shikra-mem-noc-core
      - qcom,shikra-sys-noc

  reg:
    maxItems: 1

  clocks:
    minItems: 1
    maxItems: 4

  clock-names:
    minItems: 1
    maxItems: 4

# Child node's properties
patternProperties:
  '^interconnect-[a-z0-9]+$':
    type: object
    description:
      The interconnect providers do not have a separate QoS register space,
      but share parent's space.

    $ref: qcom,rpm-common.yaml#

    properties:
      compatible:
        enum:
          - qcom,shikra-clk-virt
          - qcom,shikra-mc-virt
          - qcom,shikra-mmrt-virt
          - qcom,shikra-mmnrt-virt

    required:
      - compatible

    unevaluatedProperties: false

required:
  - compatible
  - reg

allOf:
  - $ref: qcom,rpm-common.yaml#
  - if:
      properties:
        compatible:
          const: qcom,shikra-mem-noc-core

    then:
      properties:
        clocks:
          items:
            - description: GPU-NoC AXI clock

        clock-names:
          items:
            - const: gpu_axi
      patternProperties:
        '^interconnect-[a-z0-9]+$': false

  - if:
      properties:
        compatible:
          const: qcom,shikra-sys-noc

    then:
      properties:
        clocks:
          items:
            - description: EMAC0-NoC AXI clock.
            - description: EMAC1-NoC AXI clock.
            - description: USB2-NoC AXI clock.
            - description: USB3-NoC AXI clock.

        clock-names:
          items:
            - const: emac0_axi
            - const: emac1_axi
            - const: usb2_axi
            - const: usb3_axi

  - if:
      properties:
        compatible:
          const: qcom,shikra-config-noc

    then:
      properties:
        clocks: false
        clock-names: false
      patternProperties:
        '^interconnect-[a-z0-9]+$': false

unevaluatedProperties: false

examples:
  - |
    interconnect@1880000 {
        compatible = "qcom,shikra-sys-noc";
        reg = <0x01880000 0x6a080>;
        #interconnect-cells = <2>;
        clocks = <&gcc_emac0_axi_sys_noc_clk>,
                 <&gcc_emac1_axi_sys_noc_clk>,
                 <&gcc_sys_noc_usb2_prim_axi_clk>,
                 <&gcc_sys_noc_usb3_prim_axi_clk>;
        clock-names = "emac0_axi",
                      "emac1_axi",
                      "usb2_axi",
                      "usb3_axi";

        interconnect-clk {
            compatible = "qcom,shikra-clk-virt";
            #interconnect-cells = <2>;
        };
    };