18c2ecf20Sopenharmony_ciNVIDIA Tegra Hardware Synchronization Primitives (HSP)
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciThe HSP modules are used for the processors to share resources and communicate
48c2ecf20Sopenharmony_citogether. It provides a set of hardware synchronization primitives for
58c2ecf20Sopenharmony_ciinterprocessor communication. So the interprocessor communication (IPC)
68c2ecf20Sopenharmony_ciprotocols can use hardware synchronization primitives, when operating between
78c2ecf20Sopenharmony_citwo processors not in an SMP relationship.
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciThe features that HSP supported are shared mailboxes, shared semaphores,
108c2ecf20Sopenharmony_ciarbitrated semaphores and doorbells.
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciRequired properties:
138c2ecf20Sopenharmony_ci- name : Should be hsp
148c2ecf20Sopenharmony_ci- compatible
158c2ecf20Sopenharmony_ci    Array of strings.
168c2ecf20Sopenharmony_ci    one of:
178c2ecf20Sopenharmony_ci    - "nvidia,tegra186-hsp"
188c2ecf20Sopenharmony_ci    - "nvidia,tegra194-hsp", "nvidia,tegra186-hsp"
198c2ecf20Sopenharmony_ci- reg : Offset and length of the register set for the device.
208c2ecf20Sopenharmony_ci- interrupt-names
218c2ecf20Sopenharmony_ci    Array of strings.
228c2ecf20Sopenharmony_ci    Contains a list of names for the interrupts described by the interrupt
238c2ecf20Sopenharmony_ci    property. May contain the following entries, in any order:
248c2ecf20Sopenharmony_ci    - "doorbell"
258c2ecf20Sopenharmony_ci    - "sharedN", where 'N' is a number from zero up to the number of
268c2ecf20Sopenharmony_ci      external interrupts supported by the HSP instance minus one.
278c2ecf20Sopenharmony_ci    Users of this binding MUST look up entries in the interrupt property
288c2ecf20Sopenharmony_ci    by name, using this interrupt-names property to do so.
298c2ecf20Sopenharmony_ci- interrupts
308c2ecf20Sopenharmony_ci    Array of interrupt specifiers.
318c2ecf20Sopenharmony_ci    Must contain one entry per entry in the interrupt-names property,
328c2ecf20Sopenharmony_ci    in a matching order.
338c2ecf20Sopenharmony_ci- #mbox-cells : Should be 2.
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciThe mbox specifier of the "mboxes" property in the client node should contain
368c2ecf20Sopenharmony_citwo cells. The first cell determines the HSP type and the second cell is used
378c2ecf20Sopenharmony_cito identify the mailbox that the client is going to use.
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciFor doorbells, the second cell specifies the index of the doorbell to use.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciFor shared mailboxes, the second cell is composed of two fields:
428c2ecf20Sopenharmony_ci- bits 31..24:
438c2ecf20Sopenharmony_ci    A bit mask of flags that further specify how the shared mailbox will be
448c2ecf20Sopenharmony_ci    used. Valid flags are:
458c2ecf20Sopenharmony_ci    - bit 31:
468c2ecf20Sopenharmony_ci        Defines the direction of the mailbox. If set, the mailbox will be used
478c2ecf20Sopenharmony_ci        as a producer (i.e. used to send data). If cleared, the mailbox is the
488c2ecf20Sopenharmony_ci        consumer of data sent by a producer.
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci- bits 23.. 0:
518c2ecf20Sopenharmony_ci    The index of the shared mailbox to use. The number of available mailboxes
528c2ecf20Sopenharmony_ci    may vary by instance of the HSP block and SoC generation.
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciThe following file contains definitions that can be used to construct mailbox
558c2ecf20Sopenharmony_cispecifiers:
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci    <dt-bindings/mailbox/tegra186-hsp.h>
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciExample:
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cihsp_top0: hsp@3c00000 {
628c2ecf20Sopenharmony_ci	compatible = "nvidia,tegra186-hsp";
638c2ecf20Sopenharmony_ci	reg = <0x0 0x03c00000 0x0 0xa0000>;
648c2ecf20Sopenharmony_ci	interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
658c2ecf20Sopenharmony_ci	interrupt-names = "doorbell";
668c2ecf20Sopenharmony_ci	#mbox-cells = <2>;
678c2ecf20Sopenharmony_ci};
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ciclient {
708c2ecf20Sopenharmony_ci	...
718c2ecf20Sopenharmony_ci	mboxes = <&hsp_top0 TEGRA_HSP_MBOX_TYPE_DB TEGRA_HSP_DB_MASTER_XXX>;
728c2ecf20Sopenharmony_ci};
73