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/arm,mhuv2.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: ARM MHUv2 Mailbox Controller
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Tushar Khandelwal <tushar.khandelwal@arm.com>
1162306a36Sopenharmony_ci  - Viresh Kumar <viresh.kumar@linaro.org>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cidescription: |
1462306a36Sopenharmony_ci  The Arm Message Handling Unit (MHU) Version 2 is a mailbox controller that has
1562306a36Sopenharmony_ci  between 1 and 124 channel windows (each 32-bit wide) to provide unidirectional
1662306a36Sopenharmony_ci  communication with remote processor(s), where the number of channel windows
1762306a36Sopenharmony_ci  are implementation dependent.
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci  Given the unidirectional nature of the controller, an MHUv2 mailbox may only
2062306a36Sopenharmony_ci  be written to or read from. If a pair of MHU controllers is implemented
2162306a36Sopenharmony_ci  between two processing elements to provide bidirectional communication, these
2262306a36Sopenharmony_ci  must be specified as two separate mailboxes.
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci  If the interrupts property is present in device tree node, then its treated as
2562306a36Sopenharmony_ci  a "receiver" mailbox, otherwise a "sender".
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci  An MHU controller must be specified along with the supported transport
2862306a36Sopenharmony_ci  protocols. The transport protocols determine the method of data transmission
2962306a36Sopenharmony_ci  as well as the number of provided mailbox channels.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci  Following are the possible transport protocols.
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci  - Data-transfer: Each transfer is made of one or more words, using one or more
3462306a36Sopenharmony_ci    channel windows.
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci  - Doorbell: Each transfer is made up of single bit flag, using any one of the
3762306a36Sopenharmony_ci    bits in a channel window. A channel window can support up to 32 doorbells
3862306a36Sopenharmony_ci    and the entire window shall be used in doorbell protocol.  Optionally, data
3962306a36Sopenharmony_ci    may be transmitted through a shared memory region, wherein the MHU is used
4062306a36Sopenharmony_ci    strictly as an interrupt generation mechanism but that is out of the scope
4162306a36Sopenharmony_ci    of these bindings.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci# We need a select here so we don't match all nodes with 'arm,primecell'
4462306a36Sopenharmony_ciselect:
4562306a36Sopenharmony_ci  properties:
4662306a36Sopenharmony_ci    compatible:
4762306a36Sopenharmony_ci      contains:
4862306a36Sopenharmony_ci        enum:
4962306a36Sopenharmony_ci          - arm,mhuv2-tx
5062306a36Sopenharmony_ci          - arm,mhuv2-rx
5162306a36Sopenharmony_ci  required:
5262306a36Sopenharmony_ci    - compatible
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ciproperties:
5562306a36Sopenharmony_ci  compatible:
5662306a36Sopenharmony_ci    oneOf:
5762306a36Sopenharmony_ci      - description: Sender mode
5862306a36Sopenharmony_ci        items:
5962306a36Sopenharmony_ci          - const: arm,mhuv2-tx
6062306a36Sopenharmony_ci          - const: arm,primecell
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci      - description: Receiver-mode
6362306a36Sopenharmony_ci        items:
6462306a36Sopenharmony_ci          - const: arm,mhuv2-rx
6562306a36Sopenharmony_ci          - const: arm,primecell
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci  reg:
6862306a36Sopenharmony_ci    maxItems: 1
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci  interrupts:
7162306a36Sopenharmony_ci    description: |
7262306a36Sopenharmony_ci      The MHUv2 controller always implements an interrupt in the "receiver"
7362306a36Sopenharmony_ci      mode, while the interrupt in the "sender" mode was not available in the
7462306a36Sopenharmony_ci      version MHUv2.0, but the later versions do have it.
7562306a36Sopenharmony_ci    maxItems: 1
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci  clocks:
7862306a36Sopenharmony_ci    maxItems: 1
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci  clock-names:
8162306a36Sopenharmony_ci    maxItems: 1
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci  arm,mhuv2-protocols:
8462306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32-matrix
8562306a36Sopenharmony_ci    description: |
8662306a36Sopenharmony_ci      The MHUv2 controller may contain up to 124 channel windows (each 32-bit
8762306a36Sopenharmony_ci      wide). The hardware and the DT bindings allows any combination of those to
8862306a36Sopenharmony_ci      be used for various transport protocols.
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci      This property allows a platform to describe how these channel windows are
9162306a36Sopenharmony_ci      used in various transport protocols. The entries in this property shall be
9262306a36Sopenharmony_ci      present as an array of tuples, where each tuple describes details about
9362306a36Sopenharmony_ci      one of the transport protocol being implemented over some channel
9462306a36Sopenharmony_ci      window(s).
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci      The first field of a tuple signifies the transfer protocol, 0 is reserved
9762306a36Sopenharmony_ci      for doorbell protocol, and 1 is reserved for data-transfer protocol.
9862306a36Sopenharmony_ci      Using any other value in the first field of a tuple makes it invalid.
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci      The second field of a tuple signifies the number of channel windows where
10162306a36Sopenharmony_ci      the protocol would be used and should be set to a non zero value. For
10262306a36Sopenharmony_ci      doorbell protocol this field signifies the number of 32-bit channel
10362306a36Sopenharmony_ci      windows that implement the doorbell protocol. For data-transfer protocol,
10462306a36Sopenharmony_ci      this field signifies the number of 32-bit channel windows that implement
10562306a36Sopenharmony_ci      the data-transfer protocol.
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci      The total number of channel windows specified here shouldn't be more than
10862306a36Sopenharmony_ci      the ones implemented by the platform, though one can specify lesser number
10962306a36Sopenharmony_ci      of windows here than what the platform implements.
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci      mhu: mailbox@2b1f0000 {
11262306a36Sopenharmony_ci          ...
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci          arm,mhuv2-protocols = <0 2>, <1 1>, <1 5>, <1 7>;
11562306a36Sopenharmony_ci      }
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci      The above example defines the protocols of an ARM MHUv2 mailbox
11862306a36Sopenharmony_ci      controller, where a total of 15 channel windows are used. The first two
11962306a36Sopenharmony_ci      windows are used in doorbell protocol (64 doorbells), followed by 1, 5 and
12062306a36Sopenharmony_ci      7 windows (separately) used in data-transfer protocol.
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci    minItems: 1
12362306a36Sopenharmony_ci    maxItems: 124
12462306a36Sopenharmony_ci    items:
12562306a36Sopenharmony_ci      items:
12662306a36Sopenharmony_ci        - enum: [ 0, 1 ]
12762306a36Sopenharmony_ci        - minimum: 0
12862306a36Sopenharmony_ci          maximum: 124
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci  '#mbox-cells':
13262306a36Sopenharmony_ci    description: |
13362306a36Sopenharmony_ci      It is always set to 2. The first argument in the consumers 'mboxes'
13462306a36Sopenharmony_ci      property represents the channel window group, which may be used in
13562306a36Sopenharmony_ci      doorbell, or data-transfer protocol, and the second argument (only
13662306a36Sopenharmony_ci      relevant in doorbell protocol, should be 0 otherwise) represents the
13762306a36Sopenharmony_ci      doorbell number within the 32 bit wide channel window.
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci      From the example given above for arm,mhuv2-protocols, here is how a client
14062306a36Sopenharmony_ci      node can reference them.
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci      mboxes = <&mhu 0 5>; // Channel Window Group 0, doorbell 5.
14362306a36Sopenharmony_ci      mboxes = <&mhu 1 7>; // Channel Window Group 1, doorbell 7.
14462306a36Sopenharmony_ci      mboxes = <&mhu 2 0>; // Channel Window Group 2, data transfer protocol with 1 window.
14562306a36Sopenharmony_ci      mboxes = <&mhu 3 0>; // Channel Window Group 3, data transfer protocol with 5 windows.
14662306a36Sopenharmony_ci      mboxes = <&mhu 4 0>; // Channel Window Group 4, data transfer protocol with 7 windows.
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci    const: 2
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ciif:
15162306a36Sopenharmony_ci  # Interrupt is compulsory for receiver
15262306a36Sopenharmony_ci  properties:
15362306a36Sopenharmony_ci    compatible:
15462306a36Sopenharmony_ci      contains:
15562306a36Sopenharmony_ci        const: arm,mhuv2-rx
15662306a36Sopenharmony_cithen:
15762306a36Sopenharmony_ci  required:
15862306a36Sopenharmony_ci    - interrupts
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_cirequired:
16162306a36Sopenharmony_ci  - compatible
16262306a36Sopenharmony_ci  - reg
16362306a36Sopenharmony_ci  - '#mbox-cells'
16462306a36Sopenharmony_ci  - arm,mhuv2-protocols
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ciadditionalProperties: false
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ciexamples:
16962306a36Sopenharmony_ci  # Multiple transport protocols implemented by the mailbox controllers
17062306a36Sopenharmony_ci  - |
17162306a36Sopenharmony_ci    soc {
17262306a36Sopenharmony_ci        #address-cells = <2>;
17362306a36Sopenharmony_ci        #size-cells = <2>;
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci        mhu_tx: mailbox@2b1f0000 {
17662306a36Sopenharmony_ci            #mbox-cells = <2>;
17762306a36Sopenharmony_ci            compatible = "arm,mhuv2-tx", "arm,primecell";
17862306a36Sopenharmony_ci            reg = <0 0x2b1f0000 0 0x1000>;
17962306a36Sopenharmony_ci            clocks = <&clock 0>;
18062306a36Sopenharmony_ci            clock-names = "apb_pclk";
18162306a36Sopenharmony_ci            interrupts = <0 45 4>;
18262306a36Sopenharmony_ci            arm,mhuv2-protocols = <1 5>, <1 2>, <1 5>, <1 7>, <0 2>;
18362306a36Sopenharmony_ci        };
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci        mhu_rx: mailbox@2b1f1000 {
18662306a36Sopenharmony_ci            #mbox-cells = <2>;
18762306a36Sopenharmony_ci            compatible = "arm,mhuv2-rx", "arm,primecell";
18862306a36Sopenharmony_ci            reg = <0 0x2b1f1000 0 0x1000>;
18962306a36Sopenharmony_ci            clocks = <&clock 0>;
19062306a36Sopenharmony_ci            clock-names = "apb_pclk";
19162306a36Sopenharmony_ci            interrupts = <0 46 4>;
19262306a36Sopenharmony_ci            arm,mhuv2-protocols = <1 1>, <1 7>, <0 2>;
19362306a36Sopenharmony_ci        };
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ci        mhu_client: dsp@596e8000 {
19662306a36Sopenharmony_ci            compatible = "fsl,imx8qxp-dsp";
19762306a36Sopenharmony_ci            reg = <0 0x596e8000 0 0x88000>;
19862306a36Sopenharmony_ci            clocks = <&adma_lpcg 0>, <&adma_lpcg 1>, <&adma_lpcg 2>;
19962306a36Sopenharmony_ci            clock-names = "ipg", "ocram", "core";
20062306a36Sopenharmony_ci            power-domains = <&pd 0>, <&pd 1>, <&pd 2>, <&pd 3>;
20162306a36Sopenharmony_ci            mbox-names = "txdb0", "txdb1", "rxdb0", "rxdb1";
20262306a36Sopenharmony_ci            mboxes = <&mhu_tx 2 0>, //data-transfer protocol with 5 windows, mhu-tx
20362306a36Sopenharmony_ci                     <&mhu_tx 3 0>, //data-transfer protocol with 7 windows, mhu-tx
20462306a36Sopenharmony_ci                     <&mhu_rx 2 27>, //doorbell protocol channel 2, doorbell 27, mhu-rx
20562306a36Sopenharmony_ci                     <&mhu_rx 0 0>;  //data-transfer protocol with 1 window, mhu-rx
20662306a36Sopenharmony_ci            memory-region = <&dsp_reserved>;
20762306a36Sopenharmony_ci        };
20862306a36Sopenharmony_ci    };
209