162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/mailbox/nvidia,tegra186-hsp.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: NVIDIA Tegra Hardware Synchronization Primitives (HSP)
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Thierry Reding <thierry.reding@gmail.com>
1162306a36Sopenharmony_ci  - Jon Hunter <jonathanh@nvidia.com>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cidescription: |
1462306a36Sopenharmony_ci  The HSP modules are used for the processors to share resources and
1562306a36Sopenharmony_ci  communicate together. It provides a set of hardware synchronization
1662306a36Sopenharmony_ci  primitives for interprocessor communication. So the interprocessor
1762306a36Sopenharmony_ci  communication (IPC) protocols can use hardware synchronization
1862306a36Sopenharmony_ci  primitives, when operating between two processors not in an SMP
1962306a36Sopenharmony_ci  relationship.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci  The features that HSP supported are shared mailboxes, shared
2262306a36Sopenharmony_ci  semaphores, arbitrated semaphores and doorbells.
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci  The mbox specifier of the "mboxes" property in the client node should
2562306a36Sopenharmony_ci  contain two cells. The first cell determines the HSP type and the
2662306a36Sopenharmony_ci  second cell is used to identify the mailbox that the client is going
2762306a36Sopenharmony_ci  to use.
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci  For shared mailboxes, the first cell composed of two fields:
3062306a36Sopenharmony_ci    - bits 15..8:
3162306a36Sopenharmony_ci        A bit mask of flags that further specifies the type of shared
3262306a36Sopenharmony_ci        mailbox to be used (based on the data size). If no flag is
3362306a36Sopenharmony_ci        specified then, 32-bit shared mailbox is used.
3462306a36Sopenharmony_ci    - bits 7..0:
3562306a36Sopenharmony_ci        Defines the type of the mailbox to be used. This field should be
3662306a36Sopenharmony_ci        TEGRA_HSP_MBOX_TYPE_SM for shared mailboxes.
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci  For doorbells, the second cell specifies the index of the doorbell to
3962306a36Sopenharmony_ci  use.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci  For shared mailboxes, the second cell is composed of two fields:
4262306a36Sopenharmony_ci    - bits 31..24:
4362306a36Sopenharmony_ci        A bit mask of flags that further specify how the shared mailbox
4462306a36Sopenharmony_ci        will be used. Valid flags are:
4562306a36Sopenharmony_ci          - bit 31:
4662306a36Sopenharmony_ci              Defines the direction of the mailbox. If set, the mailbox
4762306a36Sopenharmony_ci              will be used as a producer (i.e. used to send data). If
4862306a36Sopenharmony_ci              cleared, the mailbox is the consumer of data sent by a
4962306a36Sopenharmony_ci              producer.
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci    - bits 23..0:
5262306a36Sopenharmony_ci        The index of the shared mailbox to use. The number of available
5362306a36Sopenharmony_ci        mailboxes may vary by instance of the HSP block and SoC
5462306a36Sopenharmony_ci        generation.
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci    The following file contains definitions that can be used to
5762306a36Sopenharmony_ci    construct mailbox specifiers:
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci        <dt-bindings/mailbox/tegra186-hsp.h>
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ciproperties:
6262306a36Sopenharmony_ci  $nodename:
6362306a36Sopenharmony_ci    pattern: "^hsp@[0-9a-f]+$"
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci  compatible:
6662306a36Sopenharmony_ci    oneOf:
6762306a36Sopenharmony_ci      - const: nvidia,tegra186-hsp
6862306a36Sopenharmony_ci      - const: nvidia,tegra194-hsp
6962306a36Sopenharmony_ci      - const: nvidia,tegra264-hsp
7062306a36Sopenharmony_ci      - items:
7162306a36Sopenharmony_ci          - const: nvidia,tegra234-hsp
7262306a36Sopenharmony_ci          - const: nvidia,tegra194-hsp
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci  reg:
7562306a36Sopenharmony_ci    maxItems: 1
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci  interrupts:
7862306a36Sopenharmony_ci    minItems: 1
7962306a36Sopenharmony_ci    maxItems: 9
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci  interrupt-names:
8262306a36Sopenharmony_ci    oneOf:
8362306a36Sopenharmony_ci      # shared interrupts are optional
8462306a36Sopenharmony_ci      - items:
8562306a36Sopenharmony_ci          - const: doorbell
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci      - items:
8862306a36Sopenharmony_ci          - const: doorbell
8962306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
9062306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
9162306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
9262306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
9362306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
9462306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
9562306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
9662306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci      - items:
9962306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
10062306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
10162306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
10262306a36Sopenharmony_ci          - pattern: "^shared[0-7]$"
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci  "#mbox-cells":
10562306a36Sopenharmony_ci    const: 2
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ciadditionalProperties: false
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ciexamples:
11062306a36Sopenharmony_ci  - |
11162306a36Sopenharmony_ci    #include <dt-bindings/interrupt-controller/arm-gic.h>
11262306a36Sopenharmony_ci    #include <dt-bindings/mailbox/tegra186-hsp.h>
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci    hsp_top0: hsp@3c00000 {
11562306a36Sopenharmony_ci        compatible = "nvidia,tegra186-hsp";
11662306a36Sopenharmony_ci        reg = <0x03c00000 0xa0000>;
11762306a36Sopenharmony_ci        interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
11862306a36Sopenharmony_ci        interrupt-names = "doorbell";
11962306a36Sopenharmony_ci        #mbox-cells = <2>;
12062306a36Sopenharmony_ci    };
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci    client {
12362306a36Sopenharmony_ci        mboxes = <&hsp_top0 TEGRA_HSP_MBOX_TYPE_DB TEGRA_HSP_DB_MASTER_CCPLEX>;
12462306a36Sopenharmony_ci    };
125