All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org,
	Mika Liljeberg <mliljeberg@nvidia.com>,
	Mikko Perttunen <mperttunen@nvidia.com>,
	Timo Alho <talho@nvidia.com>,
	linux-serial@vger.kernel.org, Jiri Slaby <jslaby@suse.com>,
	linux-tegra@vger.kernel.org, Pekka Pessi <ppessi@nvidia.com>,
	Jon Hunter <jonathanh@nvidia.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 03/10] dt-bindings: tegra186-hsp: Add shared mailboxes
Date: Mon, 12 Nov 2018 16:18:46 +0100	[thread overview]
Message-ID: <20181112151853.29289-4-thierry.reding@gmail.com> (raw)
In-Reply-To: <20181112151853.29289-1-thierry.reding@gmail.com>

From: Mikko Perttunen <mperttunen@nvidia.com>

Shared mailboxes are a mechanism to transport data from one processor in
the system to another. They are bidirectional links with both a producer
and a consumer. Interrupts are used to let the consumer know when data
was written to the mailbox by the producer, and to let the producer know
when the consumer has read the data from the mailbox. These interrupts
are mapped to one or more "shared interrupts". Typically each processor
in the system owns one of these shared interrupts.

Add documentation to the device tree bindings about how clients can use
mailbox specifiers to request a specific shared mailbox and select which
direction they drive. Also document how to specify the shared interrupts
in addition to the existing doorbell interrupt.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- describe in more detail how the mailbox specifiers are constructed
- encode mailbox direction in the device tree mailbox specifier

Rob,

you had already reviewed this and I've kept your tag for now, even
though there have been slight changes in this. If you don't mind taking
another look to verify that the changes I've made are still okay.

Thanks,
Thierry

 .../bindings/mailbox/nvidia,tegra186-hsp.txt  | 30 +++++++++++++++----
 include/dt-bindings/mailbox/tegra186-hsp.h    | 11 +++++++
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt b/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt
index b99d25fc2f26..ff3eafc5a882 100644
--- a/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt
+++ b/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt
@@ -15,12 +15,15 @@ Required properties:
     Array of strings.
     one of:
     - "nvidia,tegra186-hsp"
+    - "nvidia,tegra194-hsp", "nvidia,tegra186-hsp"
 - reg : Offset and length of the register set for the device.
 - interrupt-names
     Array of strings.
     Contains a list of names for the interrupts described by the interrupt
     property. May contain the following entries, in any order:
     - "doorbell"
+    - "sharedN", where 'N' is a number from zero up to the number of
+      external interrupts supported by the HSP instance minus one.
     Users of this binding MUST look up entries in the interrupt property
     by name, using this interrupt-names property to do so.
 - interrupts
@@ -29,12 +32,29 @@ Required properties:
     in a matching order.
 - #mbox-cells : Should be 2.
 
-The mbox specifier of the "mboxes" property in the client node should
-contain two data. The first one should be the HSP type and the second
-one should be the ID that the client is going to use. Those information
-can be found in the following file.
+The mbox specifier of the "mboxes" property in the client node should contain
+two cells. The first cell determines the HSP type and the second cell is used
+to identify the mailbox that the client is going to use.
 
-- <dt-bindings/mailbox/tegra186-hsp.h>.
+For doorbells, the second cell specifies the index of the doorbell to use.
+
+For shared mailboxes, the second cell is composed of two fields:
+- bits 31..24:
+    A bit mask of flags that further specify how the shared mailbox will be
+    used. Valid flags are:
+    - bit 31:
+        Defines the direction of the mailbox. If set, the mailbox will be used
+        as a producer (i.e. used to send data). If cleared, the mailbox is the
+        consumer of data sent by a producer.
+
+- bits 23.. 0:
+    The index of the shared mailbox to use. The number of available mailboxes
+    may vary by instance of the HSP block and SoC generation.
+
+The following file contains definitions that can be used to construct mailbox
+specifiers:
+
+    <dt-bindings/mailbox/tegra186-hsp.h>
 
 Example:
 
diff --git a/include/dt-bindings/mailbox/tegra186-hsp.h b/include/dt-bindings/mailbox/tegra186-hsp.h
index bcab5b7ca785..3bdec7a84d35 100644
--- a/include/dt-bindings/mailbox/tegra186-hsp.h
+++ b/include/dt-bindings/mailbox/tegra186-hsp.h
@@ -22,4 +22,15 @@
 #define TEGRA_HSP_DB_MASTER_CCPLEX 17
 #define TEGRA_HSP_DB_MASTER_BPMP 19
 
+/*
+ * Shared mailboxes are unidirectional, so the direction needs to be specified
+ * in the device tree.
+ */
+#define TEGRA_HSP_SM_MASK 0x00ffffff
+#define TEGRA_HSP_SM_FLAG_RX (0 << 31)
+#define TEGRA_HSP_SM_FLAG_TX (1 << 31)
+
+#define TEGRA_HSP_SM_RX(x) (TEGRA_HSP_SM_FLAG_RX | ((x) & TEGRA_HSP_SM_MASK))
+#define TEGRA_HSP_SM_TX(x) (TEGRA_HSP_SM_FLAG_TX | ((x) & TEGRA_HSP_SM_MASK))
+
 #endif
-- 
2.19.1

WARNING: multiple messages have this Message-ID (diff)
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 03/10] dt-bindings: tegra186-hsp: Add shared mailboxes
Date: Mon, 12 Nov 2018 16:18:46 +0100	[thread overview]
Message-ID: <20181112151853.29289-4-thierry.reding@gmail.com> (raw)
In-Reply-To: <20181112151853.29289-1-thierry.reding@gmail.com>

From: Mikko Perttunen <mperttunen@nvidia.com>

Shared mailboxes are a mechanism to transport data from one processor in
the system to another. They are bidirectional links with both a producer
and a consumer. Interrupts are used to let the consumer know when data
was written to the mailbox by the producer, and to let the producer know
when the consumer has read the data from the mailbox. These interrupts
are mapped to one or more "shared interrupts". Typically each processor
in the system owns one of these shared interrupts.

Add documentation to the device tree bindings about how clients can use
mailbox specifiers to request a specific shared mailbox and select which
direction they drive. Also document how to specify the shared interrupts
in addition to the existing doorbell interrupt.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- describe in more detail how the mailbox specifiers are constructed
- encode mailbox direction in the device tree mailbox specifier

Rob,

you had already reviewed this and I've kept your tag for now, even
though there have been slight changes in this. If you don't mind taking
another look to verify that the changes I've made are still okay.

Thanks,
Thierry

 .../bindings/mailbox/nvidia,tegra186-hsp.txt  | 30 +++++++++++++++----
 include/dt-bindings/mailbox/tegra186-hsp.h    | 11 +++++++
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt b/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt
index b99d25fc2f26..ff3eafc5a882 100644
--- a/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt
+++ b/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt
@@ -15,12 +15,15 @@ Required properties:
     Array of strings.
     one of:
     - "nvidia,tegra186-hsp"
+    - "nvidia,tegra194-hsp", "nvidia,tegra186-hsp"
 - reg : Offset and length of the register set for the device.
 - interrupt-names
     Array of strings.
     Contains a list of names for the interrupts described by the interrupt
     property. May contain the following entries, in any order:
     - "doorbell"
+    - "sharedN", where 'N' is a number from zero up to the number of
+      external interrupts supported by the HSP instance minus one.
     Users of this binding MUST look up entries in the interrupt property
     by name, using this interrupt-names property to do so.
 - interrupts
@@ -29,12 +32,29 @@ Required properties:
     in a matching order.
 - #mbox-cells : Should be 2.
 
-The mbox specifier of the "mboxes" property in the client node should
-contain two data. The first one should be the HSP type and the second
-one should be the ID that the client is going to use. Those information
-can be found in the following file.
+The mbox specifier of the "mboxes" property in the client node should contain
+two cells. The first cell determines the HSP type and the second cell is used
+to identify the mailbox that the client is going to use.
 
-- <dt-bindings/mailbox/tegra186-hsp.h>.
+For doorbells, the second cell specifies the index of the doorbell to use.
+
+For shared mailboxes, the second cell is composed of two fields:
+- bits 31..24:
+    A bit mask of flags that further specify how the shared mailbox will be
+    used. Valid flags are:
+    - bit 31:
+        Defines the direction of the mailbox. If set, the mailbox will be used
+        as a producer (i.e. used to send data). If cleared, the mailbox is the
+        consumer of data sent by a producer.
+
+- bits 23.. 0:
+    The index of the shared mailbox to use. The number of available mailboxes
+    may vary by instance of the HSP block and SoC generation.
+
+The following file contains definitions that can be used to construct mailbox
+specifiers:
+
+    <dt-bindings/mailbox/tegra186-hsp.h>
 
 Example:
 
diff --git a/include/dt-bindings/mailbox/tegra186-hsp.h b/include/dt-bindings/mailbox/tegra186-hsp.h
index bcab5b7ca785..3bdec7a84d35 100644
--- a/include/dt-bindings/mailbox/tegra186-hsp.h
+++ b/include/dt-bindings/mailbox/tegra186-hsp.h
@@ -22,4 +22,15 @@
 #define TEGRA_HSP_DB_MASTER_CCPLEX 17
 #define TEGRA_HSP_DB_MASTER_BPMP 19
 
+/*
+ * Shared mailboxes are unidirectional, so the direction needs to be specified
+ * in the device tree.
+ */
+#define TEGRA_HSP_SM_MASK 0x00ffffff
+#define TEGRA_HSP_SM_FLAG_RX (0 << 31)
+#define TEGRA_HSP_SM_FLAG_TX (1 << 31)
+
+#define TEGRA_HSP_SM_RX(x) (TEGRA_HSP_SM_FLAG_RX | ((x) & TEGRA_HSP_SM_MASK))
+#define TEGRA_HSP_SM_TX(x) (TEGRA_HSP_SM_FLAG_TX | ((x) & TEGRA_HSP_SM_MASK))
+
 #endif
-- 
2.19.1

  parent reply	other threads:[~2018-11-12 15:18 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 15:18 [PATCH v2 00/10] serial: Add Tegra Combined UART driver Thierry Reding
2018-11-12 15:18 ` Thierry Reding
2018-11-12 15:18 ` [PATCH v2 01/10] mailbox: Support blocking transfers in atomic context Thierry Reding
2018-11-12 15:18   ` Thierry Reding
2018-11-17 17:27   ` Jassi Brar
2018-11-17 17:27     ` Jassi Brar
2018-11-20 15:29     ` Thierry Reding
2018-11-20 15:29       ` Thierry Reding
2018-11-21 14:27       ` Thierry Reding
2018-11-21 14:27         ` Thierry Reding
2018-11-22  2:18         ` Jassi Brar
2018-11-22  2:18           ` Jassi Brar
2018-11-22  8:47           ` Thierry Reding
2018-11-22  8:47             ` Thierry Reding
2018-11-22 16:07             ` Jassi Brar
2018-11-22 16:07               ` Jassi Brar
2018-11-22 17:34               ` Thierry Reding
2018-11-22 17:34                 ` Thierry Reding
2018-11-23 11:17             ` Thierry Reding
2018-11-23 11:17               ` Thierry Reding
2018-11-23 11:56               ` Thierry Reding
2018-11-23 11:56                 ` Thierry Reding
2018-11-28  9:43   ` Jon Hunter
2018-11-28  9:43     ` Jon Hunter
2018-11-28 10:08     ` Thierry Reding
2018-11-28 10:08       ` Thierry Reding
2018-11-29  5:23     ` Jassi Brar
2018-11-29  5:23       ` Jassi Brar
2018-11-29 15:23       ` Thierry Reding
2018-12-07  5:56         ` Jassi Brar
2018-12-07  5:56           ` Jassi Brar
2018-12-07  6:19           ` Mikko Perttunen
2018-12-07  6:19             ` Mikko Perttunen
2018-12-08  5:51             ` Jassi Brar
2018-12-08  5:51               ` Jassi Brar
2018-12-08  8:50               ` Greg KH
2018-12-08  8:50                 ` Greg KH
2018-12-09  1:20                 ` Jassi Brar
2018-12-09  1:20                   ` Jassi Brar
2018-12-07 11:32           ` Thierry Reding
2018-12-07 15:39             ` Greg KH
2018-12-07 15:39               ` Greg KH
2018-12-08  6:09             ` Jassi Brar
2018-12-08  6:09               ` Jassi Brar
2018-12-10  9:52               ` Thierry Reding
2018-12-10 20:30                 ` Jassi Brar
2018-12-10 20:30                   ` Jassi Brar
2018-12-10 20:45                   ` Thierry Reding
2018-12-10 21:32                     ` Jassi Brar
2018-12-10 21:32                       ` Jassi Brar
2018-11-12 15:18 ` [PATCH v2 02/10] mailbox: Allow multiple controllers per device Thierry Reding
2018-11-12 15:18   ` Thierry Reding
2018-11-12 15:18 ` Thierry Reding [this message]
2018-11-12 15:18   ` [PATCH v2 03/10] dt-bindings: tegra186-hsp: Add shared mailboxes Thierry Reding
2018-11-12 15:18 ` [PATCH v2 04/10] mailbox: tegra-hsp: Add support for " Thierry Reding
2018-11-12 15:18   ` Thierry Reding
2018-11-13 11:09   ` Jon Hunter
2018-11-13 11:09     ` Jon Hunter
2018-11-13 13:09     ` Thierry Reding
2018-11-13 13:09       ` Thierry Reding
2018-11-13 19:24       ` Jon Hunter
2018-11-13 19:24         ` Jon Hunter
2018-11-12 15:18 ` [PATCH v2 05/10] mailbox: tegra-hsp: Add suspend/resume support Thierry Reding
2018-11-12 15:18   ` Thierry Reding
2018-11-13 11:17   ` Jon Hunter
2018-11-13 11:17     ` Jon Hunter
2018-12-10  9:58     ` Thierry Reding
2018-11-12 15:18 ` [PATCH v2 06/10] dt-bindings: serial: Add bindings for nvidia, tegra194-tcu Thierry Reding
2018-11-12 15:18   ` Thierry Reding
2018-11-13  9:39   ` [PATCH v2 06/10] dt-bindings: serial: Add bindings for nvidia,tegra194-tcu Jon Hunter
2018-11-13  9:39     ` Jon Hunter
2018-11-13 10:03     ` Thierry Reding
2018-11-13 10:03       ` Thierry Reding
2018-11-13 10:11       ` Jon Hunter
2018-11-13 10:11         ` Jon Hunter
2018-11-12 15:18 ` [PATCH v2 07/10] serial: Add Tegra Combined UART driver Thierry Reding
2018-11-12 15:18   ` Thierry Reding
2018-11-12 15:18 ` [PATCH v2 08/10] arm64: tegra: Add nodes for TCU on Tegra194 Thierry Reding
2018-11-12 15:18   ` Thierry Reding
2018-11-12 15:18 ` [PATCH v2 09/10] arm64: tegra: Mark TCU as primary serial port on Tegra194 P2888 Thierry Reding
2018-11-12 15:18   ` Thierry Reding
2018-11-12 15:18 ` [PATCH v2 10/10] arm64: defconfig: Enable Tegra TCU Thierry Reding
2018-11-12 15:18   ` Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181112151853.29289-4-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=jslaby@suse.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mliljeberg@nvidia.com \
    --cc=mperttunen@nvidia.com \
    --cc=ppessi@nvidia.com \
    --cc=robh+dt@kernel.org \
    --cc=talho@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.