18c2ecf20Sopenharmony_ciOMAP2+ and K3 Mailbox
28c2ecf20Sopenharmony_ci=====================
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ciThe OMAP mailbox hardware facilitates communication between different processors
58c2ecf20Sopenharmony_ciusing a queued mailbox interrupt mechanism. The IP block is external to the
68c2ecf20Sopenharmony_civarious processor subsystems and is connected on an interconnect bus. The
78c2ecf20Sopenharmony_cicommunication is achieved through a set of registers for message storage and
88c2ecf20Sopenharmony_ciinterrupt configuration registers.
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciEach mailbox IP block/cluster has a certain number of h/w fifo queues and output
118c2ecf20Sopenharmony_ciinterrupt lines. An output interrupt line is routed to an interrupt controller
128c2ecf20Sopenharmony_ciwithin a processor subsystem, and there can be more than one line going to a
138c2ecf20Sopenharmony_cispecific processor's interrupt controller. The interrupt line connections are
148c2ecf20Sopenharmony_cifixed for an instance and are dictated by the IP integration into the SoC
158c2ecf20Sopenharmony_ci(excluding the SoCs that have a Interrupt Crossbar IP). Each interrupt line is
168c2ecf20Sopenharmony_ciprogrammable through a set of interrupt configuration registers, and have a rx
178c2ecf20Sopenharmony_ciand tx interrupt source per h/w fifo. Communication between different processors
188c2ecf20Sopenharmony_ciis achieved through the appropriate programming of the rx and tx interrupt
198c2ecf20Sopenharmony_cisources on the appropriate interrupt lines.
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciThe number of h/w fifo queues and interrupt lines dictate the usable registers.
228c2ecf20Sopenharmony_ciAll the current OMAP SoCs except for the newest DRA7xx SoC has a single IP
238c2ecf20Sopenharmony_ciinstance. DRA7xx has multiple instances with different number of h/w fifo queues
248c2ecf20Sopenharmony_ciand interrupt lines between different instances. The interrupt lines can also be
258c2ecf20Sopenharmony_cirouted to different processor sub-systems on DRA7xx as they are routed through
268c2ecf20Sopenharmony_cithe Crossbar, a kind of interrupt router/multiplexer. The K3 AM65x and J721E
278c2ecf20Sopenharmony_ciSoCs has each of these instances form a cluster and combine multiple clusters
288c2ecf20Sopenharmony_ciinto a single IP block present within the Main NavSS. The interrupt lines from
298c2ecf20Sopenharmony_ciall these clusters are multiplexed and routed to different processor subsystems
308c2ecf20Sopenharmony_ciover a limited number of common interrupt output lines of an Interrupt Router.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciMailbox Device Node:
338c2ecf20Sopenharmony_ci====================
348c2ecf20Sopenharmony_ciA Mailbox device node is used to represent a Mailbox IP instance/cluster within
358c2ecf20Sopenharmony_cia SoC. The sub-mailboxes are represented as child nodes of this parent node.
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciRequired properties:
388c2ecf20Sopenharmony_ci--------------------
398c2ecf20Sopenharmony_ci- compatible:		Should be one of the following,
408c2ecf20Sopenharmony_ci			    "ti,omap2-mailbox" for OMAP2420, OMAP2430 SoCs
418c2ecf20Sopenharmony_ci			    "ti,omap3-mailbox" for OMAP3430, OMAP3630 SoCs
428c2ecf20Sopenharmony_ci			    "ti,omap4-mailbox" for OMAP44xx, OMAP54xx, AM33xx,
438c2ecf20Sopenharmony_ci						   AM43xx and DRA7xx SoCs
448c2ecf20Sopenharmony_ci			    "ti,am654-mailbox" for K3 AM65x and J721E SoCs
458c2ecf20Sopenharmony_ci- reg:			Contains the mailbox register address range (base
468c2ecf20Sopenharmony_ci			address and length)
478c2ecf20Sopenharmony_ci- interrupts:		Contains the interrupt information for the mailbox
488c2ecf20Sopenharmony_ci			device. The format is dependent on which interrupt
498c2ecf20Sopenharmony_ci			controller the Mailbox device uses
508c2ecf20Sopenharmony_ci- #mbox-cells:		Common mailbox binding property to identify the number
518c2ecf20Sopenharmony_ci			of cells required for the mailbox specifier. Should be
528c2ecf20Sopenharmony_ci			1
538c2ecf20Sopenharmony_ci- ti,mbox-num-users:	Number of targets (processor devices) that the mailbox
548c2ecf20Sopenharmony_ci			device can interrupt
558c2ecf20Sopenharmony_ci- ti,mbox-num-fifos:	Number of h/w fifo queues within the mailbox IP block
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciSoC-specific Required properties:
588c2ecf20Sopenharmony_ci---------------------------------
598c2ecf20Sopenharmony_ciThe following are mandatory properties for the OMAP architecture based SoCs
608c2ecf20Sopenharmony_cionly:
618c2ecf20Sopenharmony_ci- ti,hwmods:		Name of the hwmod associated with the mailbox. This
628c2ecf20Sopenharmony_ci			should be defined in the mailbox node only if the node
638c2ecf20Sopenharmony_ci			is not defined as a child node of a corresponding sysc
648c2ecf20Sopenharmony_ci			interconnect node.
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ciThe following are mandatory properties for the K3 AM65x and J721E SoCs only:
678c2ecf20Sopenharmony_ci- interrupt-parent:	Should contain a phandle to the TI-SCI interrupt
688c2ecf20Sopenharmony_ci			controller node that is used to dynamically program
698c2ecf20Sopenharmony_ci			the interrupt routes between the IP and the main GIC
708c2ecf20Sopenharmony_ci			controllers. See the following binding for additional
718c2ecf20Sopenharmony_ci			details,
728c2ecf20Sopenharmony_ci			Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ciChild Nodes:
758c2ecf20Sopenharmony_ci============
768c2ecf20Sopenharmony_ciA child node is used for representing the actual sub-mailbox device that is
778c2ecf20Sopenharmony_ciused for the communication between the host processor and a remote processor.
788c2ecf20Sopenharmony_ciEach child node should have a unique node name across all the different
798c2ecf20Sopenharmony_cimailbox device nodes.
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ciRequired properties:
828c2ecf20Sopenharmony_ci--------------------
838c2ecf20Sopenharmony_ci- ti,mbox-tx:		sub-mailbox descriptor property defining a Tx fifo
848c2ecf20Sopenharmony_ci- ti,mbox-rx:		sub-mailbox descriptor property defining a Rx fifo
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ciSub-mailbox Descriptor Data
878c2ecf20Sopenharmony_ci---------------------------
888c2ecf20Sopenharmony_ciEach of the above ti,mbox-tx and ti,mbox-rx properties should have 3 cells of
898c2ecf20Sopenharmony_cidata that represent the following:
908c2ecf20Sopenharmony_ci    Cell #1 (fifo_id) - mailbox fifo id used either for transmitting
918c2ecf20Sopenharmony_ci                        (ti,mbox-tx) or for receiving (ti,mbox-rx)
928c2ecf20Sopenharmony_ci    Cell #2 (irq_id)  - irq identifier index number to use from the parent's
938c2ecf20Sopenharmony_ci                        interrupts data. Should be 0 for most of the cases, a
948c2ecf20Sopenharmony_ci                        positive index value is seen only on mailboxes that have
958c2ecf20Sopenharmony_ci                        multiple interrupt lines connected to the MPU processor.
968c2ecf20Sopenharmony_ci    Cell #3 (usr_id)  - mailbox user id for identifying the interrupt line
978c2ecf20Sopenharmony_ci                        associated with generating a tx/rx fifo interrupt.
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ciOptional Properties:
1008c2ecf20Sopenharmony_ci--------------------
1018c2ecf20Sopenharmony_ci- ti,mbox-send-noirq:   Quirk flag to allow the client user of this sub-mailbox
1028c2ecf20Sopenharmony_ci                        to send messages without triggering a Tx ready interrupt,
1038c2ecf20Sopenharmony_ci                        and to control the Tx ticker. Should be used only on
1048c2ecf20Sopenharmony_ci                        sub-mailboxes used to communicate with WkupM3 remote
1058c2ecf20Sopenharmony_ci                        processor on AM33xx/AM43xx SoCs.
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ciMailbox Users:
1088c2ecf20Sopenharmony_ci==============
1098c2ecf20Sopenharmony_ciA device needing to communicate with a target processor device should specify
1108c2ecf20Sopenharmony_cithem using the common mailbox binding properties, "mboxes" and the optional
1118c2ecf20Sopenharmony_ci"mbox-names" (please see Documentation/devicetree/bindings/mailbox/mailbox.txt
1128c2ecf20Sopenharmony_cifor details). Each value of the mboxes property should contain a phandle to the
1138c2ecf20Sopenharmony_cimailbox controller device node and an args specifier that will be the phandle to
1148c2ecf20Sopenharmony_cithe intended sub-mailbox child node to be used for communication. The equivalent
1158c2ecf20Sopenharmony_ci"mbox-names" property value can be used to give a name to the communication channel
1168c2ecf20Sopenharmony_cito be used by the client user.
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ciExample:
1208c2ecf20Sopenharmony_ci--------
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci1. /* OMAP4 */
1238c2ecf20Sopenharmony_cimailbox: mailbox@4a0f4000 {
1248c2ecf20Sopenharmony_ci	compatible = "ti,omap4-mailbox";
1258c2ecf20Sopenharmony_ci	reg = <0x4a0f4000 0x200>;
1268c2ecf20Sopenharmony_ci	interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
1278c2ecf20Sopenharmony_ci	ti,hwmods = "mailbox";
1288c2ecf20Sopenharmony_ci	#mbox-cells = <1>;
1298c2ecf20Sopenharmony_ci	ti,mbox-num-users = <3>;
1308c2ecf20Sopenharmony_ci	ti,mbox-num-fifos = <8>;
1318c2ecf20Sopenharmony_ci	mbox_ipu: mbox_ipu {
1328c2ecf20Sopenharmony_ci		ti,mbox-tx = <0 0 0>;
1338c2ecf20Sopenharmony_ci		ti,mbox-rx = <1 0 0>;
1348c2ecf20Sopenharmony_ci	};
1358c2ecf20Sopenharmony_ci	mbox_dsp: mbox_dsp {
1368c2ecf20Sopenharmony_ci		ti,mbox-tx = <3 0 0>;
1378c2ecf20Sopenharmony_ci		ti,mbox-rx = <2 0 0>;
1388c2ecf20Sopenharmony_ci	};
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_cidsp {
1428c2ecf20Sopenharmony_ci	...
1438c2ecf20Sopenharmony_ci	mboxes = <&mailbox &mbox_dsp>;
1448c2ecf20Sopenharmony_ci	...
1458c2ecf20Sopenharmony_ci};
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci2. /* AM33xx */
1488c2ecf20Sopenharmony_cimailbox: mailbox@480c8000 {
1498c2ecf20Sopenharmony_ci	compatible = "ti,omap4-mailbox";
1508c2ecf20Sopenharmony_ci	reg = <0x480C8000 0x200>;
1518c2ecf20Sopenharmony_ci	interrupts = <77>;
1528c2ecf20Sopenharmony_ci	ti,hwmods = "mailbox";
1538c2ecf20Sopenharmony_ci	#mbox-cells = <1>;
1548c2ecf20Sopenharmony_ci	ti,mbox-num-users = <4>;
1558c2ecf20Sopenharmony_ci	ti,mbox-num-fifos = <8>;
1568c2ecf20Sopenharmony_ci	mbox_wkupm3: wkup_m3 {
1578c2ecf20Sopenharmony_ci		ti,mbox-tx = <0 0 0>;
1588c2ecf20Sopenharmony_ci		ti,mbox-rx = <0 0 3>;
1598c2ecf20Sopenharmony_ci	};
1608c2ecf20Sopenharmony_ci};
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci3. /* AM65x */
1638c2ecf20Sopenharmony_ci&cbass_main {
1648c2ecf20Sopenharmony_ci	cbass_main_navss: interconnect0 {
1658c2ecf20Sopenharmony_ci		mailbox0_cluster0: mailbox@31f80000 {
1668c2ecf20Sopenharmony_ci			compatible = "ti,am654-mailbox";
1678c2ecf20Sopenharmony_ci			reg = <0x00 0x31f80000 0x00 0x200>;
1688c2ecf20Sopenharmony_ci			#mbox-cells = <1>;
1698c2ecf20Sopenharmony_ci			ti,mbox-num-users = <4>;
1708c2ecf20Sopenharmony_ci			ti,mbox-num-fifos = <16>;
1718c2ecf20Sopenharmony_ci			interrupt-parent = <&intr_main_navss>;
1728c2ecf20Sopenharmony_ci			interrupts = <164 0>;
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci			mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
1758c2ecf20Sopenharmony_ci				ti,mbox-tx = <1 0 0>;
1768c2ecf20Sopenharmony_ci				ti,mbox-rx = <0 0 0>;
1778c2ecf20Sopenharmony_ci			};
1788c2ecf20Sopenharmony_ci		};
1798c2ecf20Sopenharmony_ci	};
1808c2ecf20Sopenharmony_ci};
181