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/ti,omap-mailbox.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: TI OMAP2+ and K3 Mailbox devices
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Suman Anna <s-anna@ti.com>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cidescription: |
1362306a36Sopenharmony_ci  The OMAP Mailbox hardware facilitates communication between different
1462306a36Sopenharmony_ci  processors using a queued mailbox interrupt mechanism. The IP block is
1562306a36Sopenharmony_ci  external to the various processor subsystems and is connected on an
1662306a36Sopenharmony_ci  interconnect bus. The communication is achieved through a set of registers
1762306a36Sopenharmony_ci  for message storage and interrupt configuration registers.
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci  Each mailbox IP block/cluster has a certain number of h/w fifo queues and
2062306a36Sopenharmony_ci  output interrupt lines. An output interrupt line is routed to an interrupt
2162306a36Sopenharmony_ci  controller within a processor subsystem, and there can be more than one line
2262306a36Sopenharmony_ci  going to a specific processor's interrupt controller. The interrupt line
2362306a36Sopenharmony_ci  connections are fixed for an instance and are dictated by the IP integration
2462306a36Sopenharmony_ci  into the SoC (excluding the SoCs that have an Interrupt Crossbar or an
2562306a36Sopenharmony_ci  Interrupt Router IP). Each interrupt line is programmable through a set of
2662306a36Sopenharmony_ci  interrupt configuration registers, and have a rx and tx interrupt source per
2762306a36Sopenharmony_ci  h/w fifo. Communication between different processors is achieved through the
2862306a36Sopenharmony_ci  appropriate programming of the rx and tx interrupt sources on the appropriate
2962306a36Sopenharmony_ci  interrupt lines.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci  The number of h/w fifo queues and interrupt lines dictate the usable
3262306a36Sopenharmony_ci  registers. All the current OMAP SoCs except for the newest DRA7xx SoC has a
3362306a36Sopenharmony_ci  single IP instance. DRA7xx has multiple instances with different number of
3462306a36Sopenharmony_ci  h/w fifo queues and interrupt lines between different instances. The interrupt
3562306a36Sopenharmony_ci  lines can also be routed to different processor sub-systems on DRA7xx as they
3662306a36Sopenharmony_ci  are routed through the Crossbar, a kind of interrupt router/multiplexer. The
3762306a36Sopenharmony_ci  K3 AM65x, J721E and J7200 SoCs has each of these instances form a cluster and
3862306a36Sopenharmony_ci  combine multiple clusters into a single IP block present within the Main
3962306a36Sopenharmony_ci  NavSS. The interrupt lines from all these clusters are multiplexed and routed
4062306a36Sopenharmony_ci  to different processor subsystems over a limited number of common interrupt
4162306a36Sopenharmony_ci  output lines of an Interrupt Router. The AM64x SoCS also uses a single IP
4262306a36Sopenharmony_ci  block comprising of multiple clusters, but the number of clusters are
4362306a36Sopenharmony_ci  smaller, and the interrupt output lines are connected directly to various
4462306a36Sopenharmony_ci  processors.
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci  Mailbox Controller Nodes
4762306a36Sopenharmony_ci  =========================
4862306a36Sopenharmony_ci  A Mailbox device node is used to represent a Mailbox IP instance/cluster
4962306a36Sopenharmony_ci  within a SoC. The sub-mailboxes (actual communication channels) are
5062306a36Sopenharmony_ci  represented as child nodes of this parent node.
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci  Mailbox Users
5362306a36Sopenharmony_ci  ==============
5462306a36Sopenharmony_ci  A device needing to communicate with a target processor device should specify
5562306a36Sopenharmony_ci  them using the common mailbox binding properties, "mboxes" and the optional
5662306a36Sopenharmony_ci  "mbox-names" (please see Documentation/devicetree/bindings/mailbox/mailbox.txt
5762306a36Sopenharmony_ci  for details). Each value of the mboxes property should contain a phandle to
5862306a36Sopenharmony_ci  the mailbox controller device node and an args specifier that will be the
5962306a36Sopenharmony_ci  phandle to the intended sub-mailbox child node to be used for communication.
6062306a36Sopenharmony_ci  The equivalent "mbox-names" property value can be used to give a name to the
6162306a36Sopenharmony_ci  communication channel to be used by the client user.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci$defs:
6462306a36Sopenharmony_ci  omap-mbox-descriptor:
6562306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32-array
6662306a36Sopenharmony_ci    description:
6762306a36Sopenharmony_ci      The omap-mbox-descriptor is made of up of 3 cells and represents a single
6862306a36Sopenharmony_ci      uni-directional communication channel. A typical sub-mailbox device uses
6962306a36Sopenharmony_ci      two such channels - one for transmitting (Tx) and one for receiving (Rx).
7062306a36Sopenharmony_ci    items:
7162306a36Sopenharmony_ci      - description:
7262306a36Sopenharmony_ci          mailbox fifo id used either for transmitting on ti,mbox-tx channel or
7362306a36Sopenharmony_ci          for receiving on ti,mbox-rx channel (fifo_id). This is the hardware
7462306a36Sopenharmony_ci          fifo number within a mailbox cluster.
7562306a36Sopenharmony_ci      - description:
7662306a36Sopenharmony_ci          irq identifier index number to use from the parent's interrupts data.
7762306a36Sopenharmony_ci          Should be 0 for most of the cases, a positive index value is seen only
7862306a36Sopenharmony_ci          on mailboxes that have multiple interrupt lines connected to the MPU
7962306a36Sopenharmony_ci          processor (irq_id). This is an index number in the listed interrupts
8062306a36Sopenharmony_ci          property in the DT nodes.
8162306a36Sopenharmony_ci      - description:
8262306a36Sopenharmony_ci          mailbox user id for identifying the interrupt line associated with
8362306a36Sopenharmony_ci          generating a tx/rx fifo interrupt (usr_id). This is the hardware
8462306a36Sopenharmony_ci          user id number within a mailbox cluster.
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci  omap-sub-mailbox:
8762306a36Sopenharmony_ci    type: object
8862306a36Sopenharmony_ci    description:
8962306a36Sopenharmony_ci      The omap-sub-mailbox is a child node within a Mailbox controller device
9062306a36Sopenharmony_ci      node and represents the actual communication channel used to send and
9162306a36Sopenharmony_ci      receive messages between the host processor and a remote processor. Each
9262306a36Sopenharmony_ci      child node should have a unique node name across all the different mailbox
9362306a36Sopenharmony_ci      device nodes.
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci    properties:
9662306a36Sopenharmony_ci      ti,mbox-tx:
9762306a36Sopenharmony_ci        $ref: "#/$defs/omap-mbox-descriptor"
9862306a36Sopenharmony_ci        description: sub-mailbox descriptor property defining a Tx fifo.
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci      ti,mbox-rx:
10162306a36Sopenharmony_ci        $ref: "#/$defs/omap-mbox-descriptor"
10262306a36Sopenharmony_ci        description: sub-mailbox descriptor property defining a Rx fifo.
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci      ti,mbox-send-noirq:
10562306a36Sopenharmony_ci        type: boolean
10662306a36Sopenharmony_ci        description:
10762306a36Sopenharmony_ci          Quirk flag to allow the client user of this sub-mailbox to send
10862306a36Sopenharmony_ci          messages without triggering a Tx ready interrupt, and to control
10962306a36Sopenharmony_ci          the Tx ticker. Should be used only on sub-mailboxes used to
11062306a36Sopenharmony_ci          communicate with WkupM3 remote processor on AM33xx/AM43xx SoCs.
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci    required:
11362306a36Sopenharmony_ci      - ti,mbox-tx
11462306a36Sopenharmony_ci      - ti,mbox-rx
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ciproperties:
11762306a36Sopenharmony_ci  compatible:
11862306a36Sopenharmony_ci    enum:
11962306a36Sopenharmony_ci      - ti,omap2-mailbox # for OMAP2420, OMAP2430 SoCs
12062306a36Sopenharmony_ci      - ti,omap3-mailbox # for OMAP3430, OMAP3630 SoCs
12162306a36Sopenharmony_ci      - ti,omap4-mailbox # for OMAP44xx, OMAP54xx, AM33xx, AM43xx and DRA7xx SoCs
12262306a36Sopenharmony_ci      - ti,am654-mailbox # for K3 AM65x, J721E and J7200 SoCs
12362306a36Sopenharmony_ci      - ti,am64-mailbox  # for K3 AM64x SoCs
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci  reg:
12662306a36Sopenharmony_ci    maxItems: 1
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci  interrupts:
12962306a36Sopenharmony_ci    description:
13062306a36Sopenharmony_ci      Contains the interrupt information for the mailbox device. The format is
13162306a36Sopenharmony_ci      dependent on which interrupt controller the Mailbox device uses. The
13262306a36Sopenharmony_ci      number of interrupts listed will at most be the value specified in
13362306a36Sopenharmony_ci      ti,mbox-num-users property, but is usually limited by the number of
13462306a36Sopenharmony_ci      interrupts reaching the main processor. An interrupt-parent property
13562306a36Sopenharmony_ci      is required on SoCs where the interrupt lines are connected through a
13662306a36Sopenharmony_ci      Interrupt Router before reaching the main processor's GIC.
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci  "#mbox-cells":
13962306a36Sopenharmony_ci    const: 1
14062306a36Sopenharmony_ci    description:
14162306a36Sopenharmony_ci      The specifier is a phandle to an omap-sub-mailbox device.
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci  ti,mbox-num-users:
14462306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
14562306a36Sopenharmony_ci    description:
14662306a36Sopenharmony_ci      Number of targets (processor devices) that the mailbox device can
14762306a36Sopenharmony_ci      interrupt.
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci  ti,mbox-num-fifos:
15062306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
15162306a36Sopenharmony_ci    description: Number of h/w fifo queues within the mailbox IP block.
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci  ti,hwmods:
15462306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/string
15562306a36Sopenharmony_ci    deprecated: true
15662306a36Sopenharmony_ci    description:
15762306a36Sopenharmony_ci      Name of the hwmod associated with the mailbox. This should be defined
15862306a36Sopenharmony_ci      in the mailbox node only if the node is not defined as a child node of
15962306a36Sopenharmony_ci      a corresponding sysc interconnect node.
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci      This property is only needed on some legacy OMAP SoCs which have not
16262306a36Sopenharmony_ci      yet been converted to the ti,sysc interconnect hierarchy, but is
16362306a36Sopenharmony_ci      otherwise considered obsolete.
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_cipatternProperties:
16662306a36Sopenharmony_ci  "^mbox-[a-z0-9-]+$":
16762306a36Sopenharmony_ci    $ref: "#/$defs/omap-sub-mailbox"
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_cirequired:
17062306a36Sopenharmony_ci  - compatible
17162306a36Sopenharmony_ci  - reg
17262306a36Sopenharmony_ci  - interrupts
17362306a36Sopenharmony_ci  - "#mbox-cells"
17462306a36Sopenharmony_ci  - ti,mbox-num-users
17562306a36Sopenharmony_ci  - ti,mbox-num-fifos
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ciallOf:
17862306a36Sopenharmony_ci  - if:
17962306a36Sopenharmony_ci      properties:
18062306a36Sopenharmony_ci        compatible:
18162306a36Sopenharmony_ci          enum:
18262306a36Sopenharmony_ci            - ti,am654-mailbox
18362306a36Sopenharmony_ci            - ti,am64-mailbox
18462306a36Sopenharmony_ci    then:
18562306a36Sopenharmony_ci      properties:
18662306a36Sopenharmony_ci        ti,mbox-num-users:
18762306a36Sopenharmony_ci          const: 4
18862306a36Sopenharmony_ci        ti,mbox-num-fifos:
18962306a36Sopenharmony_ci          const: 16
19062306a36Sopenharmony_ci        interrupts:
19162306a36Sopenharmony_ci          minItems: 1
19262306a36Sopenharmony_ci          maxItems: 4
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci  - if:
19562306a36Sopenharmony_ci      properties:
19662306a36Sopenharmony_ci        compatible:
19762306a36Sopenharmony_ci          enum:
19862306a36Sopenharmony_ci            - ti,omap4-mailbox
19962306a36Sopenharmony_ci    then:
20062306a36Sopenharmony_ci      properties:
20162306a36Sopenharmony_ci        ti,mbox-num-users:
20262306a36Sopenharmony_ci          enum: [3, 4]
20362306a36Sopenharmony_ci        ti,mbox-num-fifos:
20462306a36Sopenharmony_ci          enum: [8, 12]
20562306a36Sopenharmony_ci        interrupts:
20662306a36Sopenharmony_ci          minItems: 1
20762306a36Sopenharmony_ci          maxItems: 4
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci  - if:
21062306a36Sopenharmony_ci      properties:
21162306a36Sopenharmony_ci        compatible:
21262306a36Sopenharmony_ci          enum:
21362306a36Sopenharmony_ci            - ti,omap3-mailbox
21462306a36Sopenharmony_ci    then:
21562306a36Sopenharmony_ci      properties:
21662306a36Sopenharmony_ci        ti,mbox-num-users:
21762306a36Sopenharmony_ci          const: 2
21862306a36Sopenharmony_ci        ti,mbox-num-fifos:
21962306a36Sopenharmony_ci          const: 2
22062306a36Sopenharmony_ci        interrupts:
22162306a36Sopenharmony_ci          minItems: 1
22262306a36Sopenharmony_ci          maxItems: 1
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci  - if:
22562306a36Sopenharmony_ci      properties:
22662306a36Sopenharmony_ci        compatible:
22762306a36Sopenharmony_ci          enum:
22862306a36Sopenharmony_ci            - ti,omap2-mailbox
22962306a36Sopenharmony_ci    then:
23062306a36Sopenharmony_ci      properties:
23162306a36Sopenharmony_ci        ti,mbox-num-users:
23262306a36Sopenharmony_ci          const: 4
23362306a36Sopenharmony_ci        ti,mbox-num-fifos:
23462306a36Sopenharmony_ci          const: 6
23562306a36Sopenharmony_ci        interrupts:
23662306a36Sopenharmony_ci          minItems: 1
23762306a36Sopenharmony_ci          maxItems: 2
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ciadditionalProperties: false
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ciexamples:
24262306a36Sopenharmony_ci  - |
24362306a36Sopenharmony_ci    /* OMAP4 */
24462306a36Sopenharmony_ci    #include <dt-bindings/interrupt-controller/arm-gic.h>
24562306a36Sopenharmony_ci    mailbox: mailbox@4a0f4000 {
24662306a36Sopenharmony_ci        compatible = "ti,omap4-mailbox";
24762306a36Sopenharmony_ci        reg = <0x4a0f4000 0x200>;
24862306a36Sopenharmony_ci        interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
24962306a36Sopenharmony_ci        #mbox-cells = <1>;
25062306a36Sopenharmony_ci        ti,mbox-num-users = <3>;
25162306a36Sopenharmony_ci        ti,mbox-num-fifos = <8>;
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci        mbox_ipu: mbox-ipu {
25462306a36Sopenharmony_ci            ti,mbox-tx = <0 0 0>;
25562306a36Sopenharmony_ci            ti,mbox-rx = <1 0 0>;
25662306a36Sopenharmony_ci        };
25762306a36Sopenharmony_ci        mbox_dsp: mbox-dsp {
25862306a36Sopenharmony_ci            ti,mbox-tx = <3 0 0>;
25962306a36Sopenharmony_ci            ti,mbox-rx = <2 0 0>;
26062306a36Sopenharmony_ci        };
26162306a36Sopenharmony_ci    };
26262306a36Sopenharmony_ci
26362306a36Sopenharmony_ci    dsp {
26462306a36Sopenharmony_ci        mboxes = <&mailbox &mbox_dsp>;
26562306a36Sopenharmony_ci    };
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci  - |
26862306a36Sopenharmony_ci    /* AM33xx */
26962306a36Sopenharmony_ci    mailbox1: mailbox@480c8000 {
27062306a36Sopenharmony_ci        compatible = "ti,omap4-mailbox";
27162306a36Sopenharmony_ci        reg = <0x480c8000 0x200>;
27262306a36Sopenharmony_ci        interrupts = <77>;
27362306a36Sopenharmony_ci        #mbox-cells = <1>;
27462306a36Sopenharmony_ci        ti,mbox-num-users = <4>;
27562306a36Sopenharmony_ci        ti,mbox-num-fifos = <8>;
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci        mbox_wkupm3: mbox-wkup-m3 {
27862306a36Sopenharmony_ci            ti,mbox-tx = <0 0 0>;
27962306a36Sopenharmony_ci            ti,mbox-rx = <0 0 3>;
28062306a36Sopenharmony_ci            ti,mbox-send-noirq;
28162306a36Sopenharmony_ci        };
28262306a36Sopenharmony_ci    };
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci  - |
28562306a36Sopenharmony_ci    /* AM65x */
28662306a36Sopenharmony_ci    mailbox0_cluster0: mailbox@31f80000 {
28762306a36Sopenharmony_ci        compatible = "ti,am654-mailbox";
28862306a36Sopenharmony_ci        reg = <0x31f80000 0x200>;
28962306a36Sopenharmony_ci        #mbox-cells = <1>;
29062306a36Sopenharmony_ci        ti,mbox-num-users = <4>;
29162306a36Sopenharmony_ci        ti,mbox-num-fifos = <16>;
29262306a36Sopenharmony_ci        interrupt-parent = <&intr_main_navss>;
29362306a36Sopenharmony_ci        interrupts = <436>;
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ci        mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
29662306a36Sopenharmony_ci            ti,mbox-tx = <1 0 0>;
29762306a36Sopenharmony_ci            ti,mbox-rx = <0 0 0>;
29862306a36Sopenharmony_ci        };
29962306a36Sopenharmony_ci    };
300