Skip to contentSkip to conversation

mailbox: Introduce Texas Instrument's message manager driver

PATCH Superseded Nishanth Menon 4 participants 19 messages Feb 5, 2016 – Feb 26, 2016

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover mailbox: Introduce Texas Instrument's message manager driver

Hi,

The following series provides a base driver for the support of TI's message manager hardware block which facilitates communication between multiple compute engines(or processors) with a central system controller (called PMMC in K2G SoC). Keystone family of TI processors incorporate this solution starting with K2G[1].

The hardware specification is available here:
http://www.ti.com/lit/ug/spruhy8/spruhy8.pdf Chapter 8.1 (Message Manager).

Starting with K2G SoC, TI Keystone architecture is moving towards an architecture similar to ARM Juno platform with a centralized system controller where all system control takes place - all power management and system control functions are now centralized in this system controller. A protocol called TI-SCI (TI System Control Interface) is built on top of this mailbox driver providing for communication protocol (similar to SCPI drivers/firmware/arm_scpi.c) Follow on patches (once the message manager is accepted) will enable the same. However, an 4.1 kernel based vendor kernel implementation is available at [2].

The following series is functional in TI vendor kernel, however, was tested on K2G EVM using the following test patch:
http://pastebin.ubuntu.com/14872857/
Boot log: http://pastebin.ubuntu.com/14872879/

baseline: v4.5-rc1

This could potentially be a targetted for v4.6-rc1 kernel.

Nishanth Menon (2):
Documentation: dt: mailbox: Add TI Message Manager
mailbox: Introduce TI message manager driver

 .../bindings/mailbox/ti,message-manager.txt        |  72 +++
 drivers/mailbox/Kconfig                            |  11 +
 drivers/mailbox/Makefile                           |   2 +
 drivers/mailbox/ti-msgmgr.c                        | 603 +++++++++++++++++++++
 include/linux/ti-msgmgr.h                          |  35 ++
 5 files changed, 723 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/ti,message-manager.txt
 create mode 100644 drivers/mailbox/ti-msgmgr.c
 create mode 100644 include/linux/ti-msgmgr.h

[1] K2G support
https://patchwork.kernel.org/patch/8196481/
https://patchwork.kernel.org/patch/8196491/
https://patchwork.kernel.org/patch/8196471/

[2] TISCI support(for reference): (mailbox client driver)
http://git.ti.com/ti-linux-kernel/ti-linux-kernel/blobs/ti-lsk-linux-4.1.y/Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
http://git.ti.com/ti-linux-kernel/ti-linux-kernel/blobs/ti-lsk-linux-4.1.y/drivers/firmware/ti_sci.c
http://git.ti.com/ti-linux-kernel/ti-linux-kernel/blobs/ti-lsk-linux-4.1.y/drivers/firmware/ti_sci.h
http://git.ti.com/ti-linux-kernel/ti-linux-kernel/blobs/ti-lsk-linux-4.1.y/include/linux/ti_sci_protocol.h
The above protocol is used for clock, generic powerdomain, reset etc..

Signature · 1 line
2.7.0
#1 lore raw

PATCH 1/2 Documentation: dt: mailbox: Add TI Message Manager

Message Manager is a hardware block used to communicate with various processor systems within certain Texas Instrument's Keystone generation SoCs.

This hardware engine is used to transfer messages from various compute entities(or processors) within the SoC. It is designed to be self contained without needing software initialization for operation.

---
 .../bindings/mailbox/ti,message-manager.txt        | 72 ++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/ti,message-manager.txt
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +72 -0
new file mode 100644
index 000000000000..f3d73b0b3c66
@@ -0,0 +1,72 @@
+Texas Instruments' Message Manager Driver
+========================================
+
+The Texas Instruments' Message Manager is a mailbox controller that has
+configurable queues selectable at SoC(System on Chip) integration. The Message
+manager is broken up into queues in different address regions that are called
+"proxies" - each instance is unidirectional and is instantiated at SoC
+integration level to indicate receive or transmit path.
+
+Message Manager Device Node:
+===========================
+
+Required properties:
+--------------------
+- compatible:		Shall be:
+				"ti,k2g-message-manager"
+				"ti,message-manager"
+- reg-names 		queue_proxy_region - Map the queue Proxy region
+			queue_state_debug_region - Map the queue state debug
+			region.
+- reg:			Contains the register map per reg-names
+- #mbox-cells		Shall be 1
+
+Child Nodes:
+============
+A child node is used for representing the actual queue device that is
+used for the communication between the host processor and a remote processor.
+Each child node should have a unique node name across all the different
+message manager device nodes.
+
+Required Properties:
+--------------------
+- ti,queue-id:		Indicates the queue number this node represents
+- ti,proxy-id:		Proxy ID representing the processor in the SoC.
+
+Optional Properties:
+--------------------
+- interrupt-names:	'rx' - indicates a receive interrupt (mandatory ONLY if
+			this is a receive queue)
+- interrupts:		Contains the interrupt information corresponding to
+			interrupt-names property.
+
+Example:
+--------
+
+	msgmgr: msgmgr at 02a00000 {
+		compatible = "ti,k2g-message-manager", "ti,message-manager";
+		#mbox-cells = <1>;
+		reg-names = "queue_proxy_region", "queue_state_debug_region";
+		reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
+
+		msgmgr_proxy_pmmc_tx_prio0: pmmc_tx_prio0 {
+			ti,queue-id = <0>;
+			ti,proxy-id = <0>;
+		};
+
+		msgmgr_proxy_pmmc_rx: pmmc_rx {
+			ti,queue-id = <5>;
+			ti,proxy-id = <2>;
+			interrupt-names = "rx";
+			interrupts = <GIC_SPI 324 IRQ_TYPE_EDGE_RISING>;
+		};
+	};
+
+...
+	pmmc {
+		...
+		mbox-names = "tx", "rx";
+		mboxes = <&msgmgr &msgmgr_proxy_pmmc_tx>
+			 <&msgmgr &msgmgr_proxy_pmmc_rx>;
+		...
+	};
Signature · 1 line
2.7.0
maintainer
#2 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Quoted 27 lines · Nishanth Menon

Message Manager is a hardware block used to communicate with various processor systems within certain Texas Instrument's Keystone generation SoCs.

This hardware engine is used to transfer messages from various compute entities(or processors) within the SoC. It is designed to be self contained without needing software initialization for operation.

---
 .../bindings/mailbox/ti,message-manager.txt        | 72 ++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/ti,message-manager.txt
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +7 -0
new file mode 100644
index 000000000000..f3d73b0b3c66
@@ -0,0 +1,72 @@
+Texas Instruments' Message Manager Driver
+========================================
+
+The Texas Instruments' Message Manager is a mailbox controller that has
+configurable queues selectable at SoC(System on Chip) integration. The Message
+manager is broken up into queues in different address regions that are called
+"proxies" - each instance is unidirectional and is instantiated at SoC

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 17

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +10 -0
+integration level to indicate receive or transmit path.
+
+Message Manager Device Node:
+===========================
+
+Required properties:
+--------------------
+- compatible:		Shall be:
+				"ti,k2g-message-manager"
+				"ti,message-manager"

Given that queues are configurable at integration time, does a generic property really make sense here?

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 22

Quoted 5 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +5 -0
+- reg-names 		queue_proxy_region - Map the queue Proxy region
+			queue_state_debug_region - Map the queue state debug
+			region.
+- reg:			Contains the register map per reg-names
+- #mbox-cells		Shall be 1

And the value contained is what?

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 34

Quoted 12 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +12 -0
+
+Child Nodes:
+============
+A child node is used for representing the actual queue device that is
+used for the communication between the host processor and a remote processor.
+Each child node should have a unique node name across all the different
+message manager device nodes.
+
+Required Properties:
+--------------------
+- ti,queue-id:		Indicates the queue number this node represents
+- ti,proxy-id:		Proxy ID representing the processor in the SoC.

What determines these values?

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 39

Quoted 5 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +5 -0
+
+Optional Properties:
+--------------------
+- interrupt-names:	'rx' - indicates a receive interrupt (mandatory ONLY if
+			this is a receive queue)

Kind of pointless if there is only 1.

Quoted 21 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +21 -0
+- interrupts:		Contains the interrupt information corresponding to
+			interrupt-names property.
+
+Example:
+--------
+
+	msgmgr: msgmgr at 02a00000 {
+		compatible = "ti,k2g-message-manager", "ti,message-manager";
+		#mbox-cells = <1>;
+		reg-names = "queue_proxy_region", "queue_state_debug_region";
+		reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
+
+		msgmgr_proxy_pmmc_tx_prio0: pmmc_tx_prio0 {
+			ti,queue-id = <0>;
+			ti,proxy-id = <0>;
+		};
+
+		msgmgr_proxy_pmmc_rx: pmmc_rx {
+			ti,queue-id = <5>;
+			ti,proxy-id = <2>;
+			interrupt-names = "rx";

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 70

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +10 -0
+			interrupts = <GIC_SPI 324 IRQ_TYPE_EDGE_RISING>;
+		};
+	};
+
+...
+	pmmc {
+		...
+		mbox-names = "tx", "rx";
+		mboxes = <&msgmgr &msgmgr_proxy_pmmc_tx>
+			 <&msgmgr &msgmgr_proxy_pmmc_rx>;

While I guess this is valid DT, it is a bit strange having the cell values be phandles. Why not just make the queue and proxy ids be the cell values? The interrupts could be moved to the parent and the child nodes eliminated altogether.

The alternative would be just drop msgmgr phandle and point to the child nodes. I prefer getting rid of the child nodes though.

Rob

#3 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Hi Rob,

Quoted 101 lines · Rob Herring
Quoted 27 lines · Nishanth Menon

Message Manager is a hardware block used to communicate with various processor systems within certain Texas Instrument's Keystone generation SoCs.

This hardware engine is used to transfer messages from various compute entities(or processors) within the SoC. It is designed to be self contained without needing software initialization for operation.

---
 .../bindings/mailbox/ti,message-manager.txt        | 72 ++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/ti,message-manager.txt
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +7 -0
new file mode 100644
index 000000000000..f3d73b0b3c66
@@ -0,0 +1,72 @@
+Texas Instruments' Message Manager Driver
+========================================
+
+The Texas Instruments' Message Manager is a mailbox controller that has
+configurable queues selectable at SoC(System on Chip) integration. The Message
+manager is broken up into queues in different address regions that are called
+"proxies" - each instance is unidirectional and is instantiated at SoC

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 17

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +10 -0
+integration level to indicate receive or transmit path.
+
+Message Manager Device Node:
+===========================
+
+Required properties:
+--------------------
+- compatible:		Shall be:
+				"ti,k2g-message-manager"
+				"ti,message-manager"

Given that queues are configurable at integration time, does a generic property really make sense here?

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 22

Quoted 5 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +5 -0
+- reg-names 		queue_proxy_region - Map the queue Proxy region
+			queue_state_debug_region - Map the queue state debug
+			region.
+- reg:			Contains the register map per reg-names
+- #mbox-cells		Shall be 1

And the value contained is what?

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 34

Quoted 12 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +12 -0
+
+Child Nodes:
+============
+A child node is used for representing the actual queue device that is
+used for the communication between the host processor and a remote processor.
+Each child node should have a unique node name across all the different
+message manager device nodes.
+
+Required Properties:
+--------------------
+- ti,queue-id:		Indicates the queue number this node represents
+- ti,proxy-id:		Proxy ID representing the processor in the SoC.

What determines these values?

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 39

Quoted 5 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +5 -0
+
+Optional Properties:
+--------------------
+- interrupt-names:	'rx' - indicates a receive interrupt (mandatory ONLY if
+			this is a receive queue)

Kind of pointless if there is only 1.

Quoted 28 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +28 -0
+- interrupts:		Contains the interrupt information corresponding to
+			interrupt-names property.
+
+Example:
+--------
+
+	msgmgr: msgmgr at 02a00000 {
+		compatible = "ti,k2g-message-manager", "ti,message-manager";
+		#mbox-cells = <1>;
+		reg-names = "queue_proxy_region", "queue_state_debug_region";
+		reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
+
+		msgmgr_proxy_pmmc_tx_prio0: pmmc_tx_prio0 {
+			ti,queue-id = <0>;
+			ti,proxy-id = <0>;
+		};
+
+		msgmgr_proxy_pmmc_rx: pmmc_rx {
+			ti,queue-id = <5>;
+			ti,proxy-id = <2>;
+			interrupt-names = "rx";
+			interrupts = <GIC_SPI 324 IRQ_TYPE_EDGE_RISING>;
+		};
+	};
+
+...
+	pmmc {
+		...
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 70

Quoted 3 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +3 -0
+		mbox-names = "tx", "rx";
+		mboxes = <&msgmgr &msgmgr_proxy_pmmc_tx>
+			 <&msgmgr &msgmgr_proxy_pmmc_rx>;

While I guess this is valid DT, it is a bit strange having the cell values be phandles. Why not just make the queue and proxy ids be the cell values? The interrupts could be moved to the parent and the child nodes eliminated altogether.

The mailbox controller node (msgmgr) and its child nodes all are registered with the mailbox core together and the client users request a mailbox using the framework API that requires the controller node. Usually the channels are given numbers and the request is done based on indices, but that meant that we had to introduce a logical device id just for the sake of the API. Instead, we just chose to go with the phandles.

Doing a queue and proxy id as cell values requires the mailbox controller node registration phase to parse through all the client nodes with the matching controller node. The current approach was in-line with how all the mailbox controller nodes are implemented today, except for the usage of phandle instead of an index for the cell-value.

Quoted 3 lines

The alternative would be just drop msgmgr phandle and point to the child nodes. I prefer getting rid of the child nodes though.

The 'mboxes' property is a standard property supported by the mailbox framework core, and requires the phandle of the controller node along with a cell-value to lookup a channel. So, we cannot use the child nodes directly.

regards
Suman

maintainer
#4 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Quoted 138 lines · Suman Anna

Hi Rob,

Quoted 101 lines · Rob Herring
Quoted 27 lines · Nishanth Menon

Message Manager is a hardware block used to communicate with various processor systems within certain Texas Instrument's Keystone generation SoCs.

This hardware engine is used to transfer messages from various compute entities(or processors) within the SoC. It is designed to be self contained without needing software initialization for operation.

---
 .../bindings/mailbox/ti,message-manager.txt        | 72 ++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/ti,message-manager.txt
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +7 -0
new file mode 100644
index 000000000000..f3d73b0b3c66
@@ -0,0 +1,72 @@
+Texas Instruments' Message Manager Driver
+========================================
+
+The Texas Instruments' Message Manager is a mailbox controller that has
+configurable queues selectable at SoC(System on Chip) integration. The Message
+manager is broken up into queues in different address regions that are called
+"proxies" - each instance is unidirectional and is instantiated at SoC

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 17

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +10 -0
+integration level to indicate receive or transmit path.
+
+Message Manager Device Node:
+===========================
+
+Required properties:
+--------------------
+- compatible:               Shall be:
+                            "ti,k2g-message-manager"
+                            "ti,message-manager"

Given that queues are configurable at integration time, does a generic property really make sense here?

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 22

Quoted 5 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +5 -0
+- reg-names                 queue_proxy_region - Map the queue Proxy region
+                    queue_state_debug_region - Map the queue state debug
+                    region.
+- reg:                      Contains the register map per reg-names
+- #mbox-cells               Shall be 1

And the value contained is what?

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 34

Quoted 12 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +12 -0
+
+Child Nodes:
+============
+A child node is used for representing the actual queue device that is
+used for the communication between the host processor and a remote processor.
+Each child node should have a unique node name across all the different
+message manager device nodes.
+
+Required Properties:
+--------------------
+- ti,queue-id:              Indicates the queue number this node represents
+- ti,proxy-id:              Proxy ID representing the processor in the SoC.

What determines these values?

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 39

Quoted 5 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +5 -0
+
+Optional Properties:
+--------------------
+- interrupt-names:  'rx' - indicates a receive interrupt (mandatory ONLY if
+                    this is a receive queue)

Kind of pointless if there is only 1.

Quoted 28 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +28 -0
+- interrupts:               Contains the interrupt information corresponding to
+                    interrupt-names property.
+
+Example:
+--------
+
+    msgmgr: msgmgr@02a00000 {
+            compatible = "ti,k2g-message-manager", "ti,message-manager";
+            #mbox-cells = <1>;
+            reg-names = "queue_proxy_region", "queue_state_debug_region";
+            reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
+
+            msgmgr_proxy_pmmc_tx_prio0: pmmc_tx_prio0 {
+                    ti,queue-id = <0>;
+                    ti,proxy-id = <0>;
+            };
+
+            msgmgr_proxy_pmmc_rx: pmmc_rx {
+                    ti,queue-id = <5>;
+                    ti,proxy-id = <2>;
+                    interrupt-names = "rx";
+                    interrupts = <GIC_SPI 324 IRQ_TYPE_EDGE_RISING>;
+            };
+    };
+
+...
+    pmmc {
+            ...
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 70

Quoted 3 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +3 -0
+            mbox-names = "tx", "rx";
+            mboxes = <&msgmgr &msgmgr_proxy_pmmc_tx>
+                     <&msgmgr &msgmgr_proxy_pmmc_rx>;

While I guess this is valid DT, it is a bit strange having the cell values be phandles. Why not just make the queue and proxy ids be the cell values? The interrupts could be moved to the parent and the child nodes eliminated altogether.

The mailbox controller node (msgmgr) and its child nodes all are registered with the mailbox core together and the client users request a mailbox using the framework API that requires the controller node. Usually the channels are given numbers and the request is done based on indices, but that meant that we had to introduce a logical device id just for the sake of the API. Instead, we just chose to go with the phandles.

Doing a queue and proxy id as cell values requires the mailbox controller node registration phase to parse through all the client nodes with the matching controller node. The current approach was in-line with how all the mailbox controller nodes are implemented today, except for the usage of phandle instead of an index for the cell-value.

Quoted 3 lines

The alternative would be just drop msgmgr phandle and point to the child nodes. I prefer getting rid of the child nodes though.

The 'mboxes' property is a standard property supported by the mailbox framework core, and requires the phandle of the controller node along with a cell-value to lookup a channel. So, we cannot use the child nodes directly.

regards
Suman

#5 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

In reply to Rob Herring

On Mon, Feb 8, 2016 at 1:37 PM, Rob Herring <[email protected]> wrote:

Thank you for reviewing the binding.

Quoted 33 lines · Nishanth Menon
Quoted 32 lines

Message Manager is a hardware block used to communicate with various processor systems within certain Texas Instrument's Keystone generation SoCs.

This hardware engine is used to transfer messages from various compute entities(or processors) within the SoC. It is designed to be self contained without needing software initialization for operation.

---
 .../bindings/mailbox/ti,message-manager.txt        | 72 ++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/ti,message-manager.txt
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +12 -0
new file mode 100644
index 000000000000..f3d73b0b3c66
@@ -0,0 +1,72 @@
+Texas Instruments' Message Manager Driver
+========================================
+
+The Texas Instruments' Message Manager is a mailbox controller that has
+configurable queues selectable at SoC(System on Chip) integration. The Message
+manager is broken up into queues in different address regions that are called
+"proxies" - each instance is unidirectional and is instantiated at SoC
+integration level to indicate receive or transmit path.
+
+Message Manager Device Node:
+===========================
+
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 17

Quoted 5 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +5 -0
+Required properties:
+--------------------
+- compatible:                Shall be:
+                             "ti,k2g-message-manager"
+                             "ti,message-manager"

Given that queues are configurable at integration time, does a generic property really make sense here?

True. I can drop the generic "ti,message-manager" binding.

Quoted 7 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 22

Quoted 5 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +5 -0
+- reg-names          queue_proxy_region - Map the queue Proxy region
+                     queue_state_debug_region - Map the queue state debug
+                     region.
+- reg:                       Contains the register map per reg-names
+- #mbox-cells                Shall be 1

And the value contained is what?

phandle -> I think Suman has already explained in his response.

Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +6 -0
+
+Child Nodes:
+============
+A child node is used for representing the actual queue device that is
+used for the communication between the host processor and a remote processor.
+Each child node should have a unique node name across all the different
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 34

Quoted 6 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +6 -0
+message manager device nodes.
+
+Required Properties:
+--------------------
+- ti,queue-id:               Indicates the queue number this node represents
+- ti,proxy-id:               Proxy ID representing the processor in the SoC.

What determines these values?

This is SoC integration dependent -> Every queue, proxy combination has it's own memory region allocated for it.

Quoted 8 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 39

Quoted 5 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +5 -0
+
+Optional Properties:
+--------------------
+- interrupt-names:   'rx' - indicates a receive interrupt (mandatory ONLY if
+                     this is a receive queue)

Kind of pointless if there is only 1.

This is primarily to ensure a future compatibility where we are trying to convince the hardware team to provide an error interrupt per queue as well for slave usage.
it would probably be pointless at that time to deal with "legacy" binding defintions when the next hardware ip definition takes place.

Quoted 37 lines
Quoted 21 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +21 -0
+- interrupts:                Contains the interrupt information corresponding to
+                     interrupt-names property.
+
+Example:
+--------
+
+     msgmgr: msgmgr at 02a00000 {
+             compatible = "ti,k2g-message-manager", "ti,message-manager";
+             #mbox-cells = <1>;
+             reg-names = "queue_proxy_region", "queue_state_debug_region";
+             reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
+
+             msgmgr_proxy_pmmc_tx_prio0: pmmc_tx_prio0 {
+                     ti,queue-id = <0>;
+                     ti,proxy-id = <0>;
+             };
+
+             msgmgr_proxy_pmmc_rx: pmmc_rx {
+                     ti,queue-id = <5>;
+                     ti,proxy-id = <2>;
+                     interrupt-names = "rx";

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 70

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +10 -0
+                     interrupts = <GIC_SPI 324 IRQ_TYPE_EDGE_RISING>;
+             };
+     };
+
+...
+     pmmc {
+             ...
+             mbox-names = "tx", "rx";
+             mboxes = <&msgmgr &msgmgr_proxy_pmmc_tx>
+                      <&msgmgr &msgmgr_proxy_pmmc_rx>;

While I guess this is valid DT, it is a bit strange having the cell values be phandles. Why not just make the queue and proxy ids be the cell values? The interrupts could be moved to the parent and the child nodes eliminated altogether.

Quoted 2 lines

The alternative would be just drop msgmgr phandle and point to the child nodes. I prefer getting rid of the child nodes though.

I see that Suman has already responded to this.

--
Regards,
Nishanth Menon

maintainer
#6 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

In reply to Nishanth Menon
Quoted 10 lines · Nishanth Menon
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +10 -0
+
+       msgmgr: msgmgr at 02a00000 {
+               compatible = "ti,k2g-message-manager", "ti,message-manager";
+               #mbox-cells = <1>;
+               reg-names = "queue_proxy_region", "queue_state_debug_region";
+               reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
+
+               msgmgr_proxy_pmmc_tx_prio0: pmmc_tx_prio0 {
+                       ti,queue-id = <0>;
+                       ti,proxy-id = <0>;

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 64

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +10 -0
+               };
+
+               msgmgr_proxy_pmmc_rx: pmmc_rx {
+                       ti,queue-id = <5>;
+                       ti,proxy-id = <2>;
+                       interrupt-names = "rx";
+                       interrupts = <GIC_SPI 324 IRQ_TYPE_EDGE_RISING>;
+               };
+       };
+

I think we should get rid of consumer specifics from the provider node...

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 72

Quoted 9 lines

+...

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +7 -0
+       pmmc {
+               ...
+               mbox-names = "tx", "rx";
+               mboxes = <&msgmgr &msgmgr_proxy_pmmc_tx>
+                        <&msgmgr &msgmgr_proxy_pmmc_rx>;
+               ...
+       };

... and have consumers like

       pmmc {
               ...
               mbox-names = "tx", "rx";
               mboxes = <&msgmgr 0 0>
                        <&msgmgr 5 2>;
       };

I leave the IRQ for you to decide how to specify - a 'dummy' or 'valid' always provided as last cell in mboxes or some other way. (I'll review other patches in detail later)

cheers.

#7 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

On 02/08/2016 10:14 PM, Jassi Brar wrote:

Thanks for the review.

Quoted 14 lines · Nishanth Menon
Quoted 13 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +13 -0
+
+       msgmgr: msgmgr at 02a00000 {
+               compatible = "ti,k2g-message-manager", "ti,message-manager";
+               #mbox-cells = <1>;
+               reg-names = "queue_proxy_region", "queue_state_debug_region";
+               reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
+
+               msgmgr_proxy_pmmc_tx_prio0: pmmc_tx_prio0 {
+                       ti,queue-id = <0>;
+                       ti,proxy-id = <0>;
+               };
+
+               msgmgr_proxy_pmmc_rx: pmmc_rx {
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 64

Quoted 7 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +7 -0
+                       ti,queue-id = <5>;
+                       ti,proxy-id = <2>;
+                       interrupt-names = "rx";
+                       interrupts = <GIC_SPI 324 IRQ_TYPE_EDGE_RISING>;
+               };
+       };
+

I think we should get rid of consumer specifics from the provider node...

If I get rid of the consumer nodes, how do you propose I describe the rx queue interrupt(s) in the msmgr dt node (Every Rx queue will have it's own interrupt - and it cannot be reverse computed from queue ID, proxy ID)?

Quoted 17 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 72

Quoted 9 lines

+...

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +7 -0
+       pmmc {
+               ...
+               mbox-names = "tx", "rx";
+               mboxes = <&msgmgr &msgmgr_proxy_pmmc_tx>
+                        <&msgmgr &msgmgr_proxy_pmmc_rx>;
+               ...
+       };

... and have consumers like

       pmmc {
               ...
               mbox-names = "tx", "rx";
               mboxes = <&msgmgr 0 0>
                        <&msgmgr 5 2>;
       };
Quoted 3 lines

I leave the IRQ for you to decide how to specify - a 'dummy' or 'valid' always provided as last cell in mboxes or some other way. (I'll review other patches in detail later)

What do we do with the issues that Suman pointed out in the mailbox framework itself? Could you respond to that thread[1] as well?

[1] http://marc.info/?l=devicetree&m=145496308418123&w=2

Signature · 2 lines
Regards,
Nishanth Menon
maintainer
#8 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Quoted 28 lines · Nishanth Menon

On 02/08/2016 10:14 PM, Jassi Brar wrote:

Thanks for the review.

Quoted 14 lines · Nishanth Menon
Quoted 13 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +13 -0
+
+       msgmgr: msgmgr at 02a00000 {
+               compatible = "ti,k2g-message-manager", "ti,message-manager";
+               #mbox-cells = <1>;
+               reg-names = "queue_proxy_region", "queue_state_debug_region";
+               reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
+
+               msgmgr_proxy_pmmc_tx_prio0: pmmc_tx_prio0 {
+                       ti,queue-id = <0>;
+                       ti,proxy-id = <0>;
+               };
+
+               msgmgr_proxy_pmmc_rx: pmmc_rx {
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 64

Quoted 7 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +7 -0
+                       ti,queue-id = <5>;
+                       ti,proxy-id = <2>;
+                       interrupt-names = "rx";
+                       interrupts = <GIC_SPI 32I didn't respond because I think Suman got Rob's point wrong.I didn't respond because I think Suman got Rob's point wrong.4 IRQ_TYPE_EDGE_RISING>;
+               };
+       };
+

I think we should get rid of consumer specifics from the provider node...

Quoted 4 lines

If I get rid of the consumer nodes, how do you propose I describe the rx queue interrupt(s) in the msmgr dt node (Every Rx queue will have it's own interrupt - and it cannot be reverse computed from queue ID, proxy ID)?

One option is to have controller driver construct interrupt name from queue and proxy ids like

msgmgr: msgmgr at 02a00000 {
....

     interrupt-names = "irq_5_2", "irq_0_0";     /* irq_<queue-id>_<proxy-id> */
     interrupts = <GIC_SPI 324 IRQ_TYPE_EDGE_RISING>,
                        <GIC_SPI 325 IRQ_TYPE_EDGE_RISING>;
}

and have the consumer specify queue and proxy ids in mboxes property like

 pmmc {
       ....
       mbox-names = "tx", "rx";
       mboxes = <&msgmgr 0 0>
                          <&msgmgr 5 2>;
};
Quoted 17 lines
Quoted 17 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 72

Quoted 9 lines

+...

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +7 -0
+       pmmc {
+               ...
+               mbox-names = "tx", "rx";
+               mboxes = <&msgmgr &msgmgr_proxy_pmmc_tx>
+                        <&msgmgr &msgmgr_proxy_pmmc_rx>;
+               ...
+       };

... and have consumers like

       pmmc {
               ...
               mbox-names = "tx", "rx";
               mboxes = <&msgmgr 0 0>
                        <&msgmgr 5 2>;
       };
Quoted 7 lines
Quoted 3 lines

I leave the IRQ for you to decide how to specify - a 'dummy' or 'valid' always provided as last cell in mboxes or some other way. (I'll review other patches in detail later)

What do we do with the issues that Suman pointed out in the mailbox framework itself? Could you respond to that thread[1] as well?

Phandle of provider in consumer node is quite normal and acceptable. I think Rob (at least I am) is talking about the second cell where you specify phandle (&msgmgr_proxy_xxx) instead of values from those child nodes directly.
Which is what I suggest mboxes = <&msgmgr 0 0>, <&msgmgr 5 2>;

Cheers!

maintainer
#9 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Quoted 22 lines · Jassi Brar
Quoted 11 lines · Nishanth Menon
Quoted 2 lines · Jassi Brar
Quoted 1 line

+

I think we should get rid of consumer specifics from the provider node...

If I get rid of the consumer nodes, how do you propose I describe the rx queue interrupt(s) in the msmgr dt node (Every Rx queue will have it's own interrupt - and it cannot be reverse computed from queue ID, proxy ID)?

One option is to have controller driver construct interrupt name from queue and proxy ids like

msgmgr: msgmgr at 02a00000 {
   ....
     interrupt-names = "irq_5_2", "irq_0_0";     /* irq_<queue-id>_<proxy-id> */
     interrupts = <GIC_SPI 324 IRQ_TYPE_EDGE_RISING>,
                        <GIC_SPI 325 IRQ_TYPE_EDGE_RISING>;
}
Quoted 8 lines

and have the consumer specify queue and proxy ids in mboxes property like

 pmmc {
       ....
       mbox-names = "tx", "rx";
       mboxes = <&msgmgr 0 0>
                          <&msgmgr 5 2>;
};

However if the queue+proxy+interrupt tuple is a hard property of a channel (which it seems to me now), then probably your original scheme of chile node phandle is just as fine.

Thanks

#10 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

In reply to Jassi Brar
Quoted 43 lines · Jassi Brar
Quoted 28 lines · Nishanth Menon

On 02/08/2016 10:14 PM, Jassi Brar wrote:

Thanks for the review.

Quoted 14 lines · Nishanth Menon
Quoted 13 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +13 -0
+
+       msgmgr: msgmgr at 02a00000 {
+               compatible = "ti,k2g-message-manager", "ti,message-manager";
+               #mbox-cells = <1>;
+               reg-names = "queue_proxy_region", "queue_state_debug_region";
+               reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
+
+               msgmgr_proxy_pmmc_tx_prio0: pmmc_tx_prio0 {
+                       ti,queue-id = <0>;
+                       ti,proxy-id = <0>;
+               };
+
+               msgmgr_proxy_pmmc_rx: pmmc_rx {
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 64

Quoted 7 lines
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +7 -0
+                       ti,queue-id = <5>;
+                       ti,proxy-id = <2>;
+                       interrupt-names = "rx";
+                       interrupts = <GIC_SPI 32I didn't respond because I think Suman got Rob's point wrong.I didn't respond because I think Suman got Rob's point wrong.4 IRQ_TYPE_EDGE_RISING>;
+               };
+       };
+

I think we should get rid of consumer specifics from the provider node...

Quoted 4 lines

If I get rid of the consumer nodes, how do you propose I describe the rx queue interrupt(s) in the msmgr dt node (Every Rx queue will have it's own interrupt - and it cannot be reverse computed from queue ID, proxy ID)?

One option is to have controller driver construct interrupt name from queue and proxy ids like

msgmgr: msgmgr at 02a00000 {
   ....
     interrupt-names = "irq_5_2", "irq_0_0";     /* irq_<queue-id>_<proxy-id> */
     interrupts = <GIC_SPI 324 IRQ_TYPE_EDGE_RISING>,
                        <GIC_SPI 325 IRQ_TYPE_EDGE_RISING>;
}
Quoted 8 lines

and have the consumer specify queue and proxy ids in mboxes property like

 pmmc {
       ....
       mbox-names = "tx", "rx";
       mboxes = <&msgmgr 0 0>
                          <&msgmgr 5 2>;
};

I was wondering about the same as well... the best option I can think of at the moment is as follows:
- out of a 62*9 (558) all combination possible child nodes, only 11
or so are valid for ARM - this is what is represented as child nodes to msgmgr. rest of the proxies and queues are inaccessible for ARM.
- move this "valid queue list" as compatible data in the driver.
- for each of the rx queues identified in the compatible data, I can do of_irq_get(np, rx_queue_index) without enforcing a naming convention requirement

If I go with the above approach, I loose ability for non queue interrupts to be identified appropriately... I think moving valid queue information to driver compatible data and named irq names might be the best option for flexibility.

Quoted 22 lines
Quoted 22 lines
Quoted 21 lines

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt line 72

Quoted 10 lines

+...

Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +7 -0
+       pmmc {
+               ...
+               mbox-names = "tx", "rx";
+               mboxes = <&msgmgr &msgmgr_proxy_pmmc_tx>
+                        <&msgmgr &msgmgr_proxy_pmmc_rx>;
+               ...
+       };

... and have consumers like

       pmmc {
               ...
               mbox-names = "tx", "rx";
               mboxes = <&msgmgr 0 0>
                        <&msgmgr 5 2>;
       };

I leave the IRQ for you to decide how to specify - a 'dummy' or 'valid' always provided as last cell in mboxes or some other way. (I'll review other patches in detail later)

Quoted 8 lines
Quoted 3 lines

What do we do with the issues that Suman pointed out in the mailbox framework itself? Could you respond to that thread[1] as well?

Phandle of provider in consumer node is quite normal and acceptable. I think Rob (at least I am) is talking about the second cell where you specify phandle (&msgmgr_proxy_xxx) instead of values from those child nodes directly.
Which is what I suggest mboxes = <&msgmgr 0 0>, <&msgmgr 5 2>;

Let me prototype this as part of of_xlate and see if I can pull the qinst data back out.. obviously one negative will be that I will register *all* valid channels as part of probe.. at least based on initial code i wrote today morning..

Signature · 3 lines
---
Regards,
Nishanth Menon
#11 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Quoted 1 line · Nishanth Menon

On Tue, Feb 9, 2016 at 8:54 AM, Jassi Brar <[email protected]> wrote:

[..]

Quoted 4 lines

Let me prototype this as part of of_xlate and see if I can pull the qinst data back out.. obviously one negative will be that I will register *all* valid channels as part of probe.. at least based on initial code i wrote today morning..

OK - I believe I have it working now. How does the following look? If this looks fine to you, then I will post a v2 including the driver update.
Changes here:
- dropped the generic message-manager compatible
- dropped child nodes
- moved the valid queue information to driver (no longer in dts)
- rx interrupts per SoC are explicitly named list in binding(and dts)

Texas Instruments' Message Manager Driver
========================================

The Texas Instruments' Message Manager is a mailbox controller that has configurable queues selectable at SoC(System on Chip) integration. The Message manager is broken up into queues in different address regions that are called "proxies" - each instance is unidirectional and is instantiated at SoC integration level to indicate receive or transmit path.

Message Manager Device Node:
===========================
Required properties:
--------------------
- compatible: Shall be: "ti,k2g-message-manager"
- reg-names queue_proxy_region - Map the queue proxy region.
queue_state_debug_region - Map the queue state debug region.
- reg: Contains the register map per reg-names.
- #mbox-cells Shall be 2. Contains the queue ID and proxy ID in that
order referring to the transfer path.
- interrupt-names: Contains interrupt names matching the rx transfer path

			for a given SoC. Receive interrupts shall be of the
			format: "rx_<QID>_<PID>".
			For ti,k2g-message-manager, this shall contain:
				"rx_005_002", "rx_057_002"

- interrupts: Contains the interrupt information corresponding to
interrupt-names property.

Example(K2G):
------------

	msgmgr: msgmgr at 02a00000 {
		compatible = "ti,k2g-message-manager";
		#mbox-cells = <2>;
		reg-names = "queue_proxy_region", "queue_state_debug_region";
		reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
		interrupt-names = "rx_005_002",
				  "rx_057_002";
		interrupts = <GIC_SPI 324 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 327 IRQ_TYPE_LEVEL_HIGH>;
	};

	pmmc: pmmc {
		[...]
		mbox-names = "rx", "tx";
		# RX queue ID is 5, proxy ID is 2
		# TX queue ID is 0, proxy ID is 0
		mboxes= <&msgmgr 5 2>,
			<&msgmgr 0 0>;
		[...]
	};
Signature · 2 lines
Regards,
Nishanth Menon
#12 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Hi Nishanth,

Quoted 39 lines · Nishanth
Quoted 1 line · Nishanth Menon

On Tue, Feb 9, 2016 at 8:54 AM, Jassi Brar <[email protected]> wrote:

[..]

Quoted 4 lines

Let me prototype this as part of of_xlate and see if I can pull the qinst data back out.. obviously one negative will be that I will register *all* valid channels as part of probe.. at least based on initial code i wrote today morning..

OK - I believe I have it working now. How does the following look? If this looks fine to you, then I will post a v2 including the driver update.
Changes here:
- dropped the generic message-manager compatible
- dropped child nodes
- moved the valid queue information to driver (no longer in dts)
- rx interrupts per SoC are explicitly named list in binding(and dts)

Texas Instruments' Message Manager Driver
========================================

The Texas Instruments' Message Manager is a mailbox controller that has configurable queues selectable at SoC(System on Chip) integration. The Message manager is broken up into queues in different address regions that are called "proxies" - each instance is unidirectional and is instantiated at SoC integration level to indicate receive or transmit path.

Message Manager Device Node:
===========================
Required properties:
--------------------
- compatible: Shall be: "ti,k2g-message-manager"
- reg-names queue_proxy_region - Map the queue proxy region.
queue_state_debug_region - Map the queue state debug region.
- reg: Contains the register map per reg-names.
- #mbox-cells Shall be 2. Contains the queue ID and proxy ID in that
order referring to the transfer path.
- interrupt-names: Contains interrupt names matching the rx transfer path

Quoted 4 lines
			for a given SoC. Receive interrupts shall be of the
			format: "rx_<QID>_<PID>".
			For ti,k2g-message-manager, this shall contain:
				"rx_005_002", "rx_057_002"

Are these the only two that will ever be supported for ti,k2g-message-manager or there can be more in the future? You did mention about 11 possible valid qid_pid values for the ARM, and the driver match data is
registering all of those mboxes.

Quoted 18 lines

- interrupts: Contains the interrupt information corresponding to
interrupt-names property.

Example(K2G):
------------

	msgmgr: msgmgr at 02a00000 {
		compatible = "ti,k2g-message-manager";
		#mbox-cells = <2>;
		reg-names = "queue_proxy_region", "queue_state_debug_region";
		reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
		interrupt-names = "rx_005_002",
				  "rx_057_002";
		interrupts = <GIC_SPI 324 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 327 IRQ_TYPE_LEVEL_HIGH>;
	};

	pmmc: pmmc {
Quoted 8 lines
		[...]
		mbox-names = "rx", "tx";
		# RX queue ID is 5, proxy ID is 2
		# TX queue ID is 0, proxy ID is 0
		mboxes= <&msgmgr 5 2>,
			<&msgmgr 0 0>;
		[...]
	};

Yeah, this will also work. I am fine with this approach - my only concern was that the probe doesn't have to go parsing all the nodes to be able to register the mailbox channels with the mailbox core. Since you are registering them using match data, that is not a concern anymore.

Anyway, will let Rob give the final ACK.

regards
Suman

#13 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Quoted 47 lines · Suman Anna

Hi Nishanth,

Quoted 27 lines · Nishanth
Quoted 1 line · Nishanth Menon

On Tue, Feb 9, 2016 at 8:54 AM, Jassi Brar <[email protected]> wrote:

[..]

Quoted 4 lines

Let me prototype this as part of of_xlate and see if I can pull the qinst data back out.. obviously one negative will be that I will register *all* valid channels as part of probe.. at least based on initial code i wrote today morning..

OK - I believe I have it working now. How does the following look? If this looks fine to you, then I will post a v2 including the driver update.
Changes here:
- dropped the generic message-manager compatible
- dropped child nodes
- moved the valid queue information to driver (no longer in dts)
- rx interrupts per SoC are explicitly named list in binding(and dts)

Texas Instruments' Message Manager Driver
========================================

The Texas Instruments' Message Manager is a mailbox controller that has configurable queues selectable at SoC(System on Chip) integration. The Message manager is broken up into queues in different address regions that are called "proxies" - each instance is unidirectional and is instantiated at SoC integration level to indicate receive or transmit path.

Quoted 16 lines

Message Manager Device Node:
===========================
Required properties:
--------------------
- compatible: Shall be: "ti,k2g-message-manager"
- reg-names queue_proxy_region - Map the queue proxy region.
queue_state_debug_region - Map the queue state debug region.
- reg: Contains the register map per reg-names.
- #mbox-cells Shall be 2. Contains the queue ID and proxy ID in that
order referring to the transfer path.
- interrupt-names: Contains interrupt names matching the rx transfer path
for a given SoC. Receive interrupts shall be of the
format: "rx_<QID>_<PID>".
For ti,k2g-message-manager, this shall contain:
"rx_005_002", "rx_057_002"

Quoted 5 lines

Are these the only two that will ever be supported for ti,k2g-message-manager or there can be more in the future? You did mention about 11 possible valid qid_pid values for the ARM, and the driver match data is
registering all of those mboxes.

As per the internal TRM, there *only* 2 rx interrupts to the public world ARM on K2G. I just noticed that the public TRM conveniently stripped out every single useful information and replaced with TRM!!!!!*&^*&^&*%&^%&%&!!! Anyways, checked internal documentation to verify as well. we have multiple output paths to various compute systems, but only 2 receive paths.

Ofcourse a different SoC will have different integration, which why the interrupt list will have to be compatible property.

Quoted 28 lines
Quoted 19 lines

- interrupts: Contains the interrupt information corresponding to
interrupt-names property.

Example(K2G):
------------

      msgmgr: msgmgr at 02a00000 {
              compatible = "ti,k2g-message-manager";
              #mbox-cells = <2>;
              reg-names = "queue_proxy_region", "queue_state_debug_region";
              reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
              interrupt-names = "rx_005_002",
                                "rx_057_002";
              interrupts = <GIC_SPI 324 IRQ_TYPE_LEVEL_HIGH>,
                           <GIC_SPI 327 IRQ_TYPE_LEVEL_HIGH>;
      };

      pmmc: pmmc {
Quoted 8 lines
              [...]
              mbox-names = "rx", "tx";
              # RX queue ID is 5, proxy ID is 2
              # TX queue ID is 0, proxy ID is 0
              mboxes= <&msgmgr 5 2>,
                      <&msgmgr 0 0>;
              [...]
      };
Quoted 6 lines

Yeah, this will also work. I am fine with this approach - my only concern was that the probe doesn't have to go parsing all the nodes to be able to register the mailbox channels with the mailbox core. Since you are registering them using match data, that is not a concern anymore.

Anyway, will let Rob give the final ACK.

Thanks for the review. will wait for Rob and Jassi or post a new rev on monday.

---
Regards,
Nishanth Menon

maintainer
#14 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

In reply to Nishanth Menon
Quoted 49 lines · Nishanth Menon
Quoted 1 line · Nishanth Menon

On Tue, Feb 9, 2016 at 8:54 AM, Jassi Brar <[email protected]> wrote:

[..]

Quoted 4 lines

Let me prototype this as part of of_xlate and see if I can pull the qinst data back out.. obviously one negative will be that I will register *all* valid channels as part of probe.. at least based on initial code i wrote today morning..

OK - I believe I have it working now. How does the following look? If this looks fine to you, then I will post a v2 including the driver update.
Changes here:
- dropped the generic message-manager compatible
- dropped child nodes
- moved the valid queue information to driver (no longer in dts)
- rx interrupts per SoC are explicitly named list in binding(and dts)

Texas Instruments' Message Manager Driver
========================================

The Texas Instruments' Message Manager is a mailbox controller that has configurable queues selectable at SoC(System on Chip) integration. The Message manager is broken up into queues in different address regions that are called "proxies" - each instance is unidirectional and is instantiated at SoC integration level to indicate receive or transmit path.

Message Manager Device Node:
===========================
Required properties:
--------------------
- compatible: Shall be: "ti,k2g-message-manager"
- reg-names queue_proxy_region - Map the queue proxy region.
queue_state_debug_region - Map the queue state debug region.
- reg: Contains the register map per reg-names.
- #mbox-cells Shall be 2. Contains the queue ID and proxy ID in that
order referring to the transfer path.
- interrupt-names: Contains interrupt names matching the rx transfer path
for a given SoC. Receive interrupts shall be of the
format: "rx_<QID>_<PID>".
For ti,k2g-message-manager, this shall contain:
"rx_005_002", "rx_057_002"
- interrupts: Contains the interrupt information corresponding to
interrupt-names property.

Example(K2G):
------------

Quoted 8 lines
        msgmgr: msgmgr at 02a00000 {
                compatible = "ti,k2g-message-manager";
                #mbox-cells = <2>;
                reg-names = "queue_proxy_region", "queue_state_debug_region";
                reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
                interrupt-names = "rx_005_002",
                                  "rx_057_002";

Looking at figure in page-1445, it seems QID is the h/w channel id, while proxy is its programming parameter. So maybe we need to list all the ARM irq's as a list here, matched only by the qid asked by the consumer ... assuming no two channels could have the same qid (?).

interrupt-names = "irq_005", "irq_037", "irq_049", "irq_057",
"perr", "ferr", "eerr";

I may be slightly off, but the idea remains to not have to encode any consumer specific info in the provider node.

Quoted 9 lines
        pmmc: pmmc {
                [...]
                mbox-names = "rx", "tx";
                # RX queue ID is 5, proxy ID is 2
                # TX queue ID is 0, proxy ID is 0
                mboxes= <&msgmgr 5 2>,
                        <&msgmgr 0 0>;
                [...]
        };
#15 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Hi Jassi,

On 02/10/2016 10:23 PM, Jassi Brar wrote:
[...]

Thanks for taking the time and checking the TRM, I apologize that the actual details of the hardware block which was supposed to be in sections 8.1.3 and 8.1.4 has unfortunately been dropped since the last time I reviewed in the spec Vs what actually went out into public domain! I do realize the problem of doing a review without comprehensive and accurate documentation - ugghh.. :(

But, I am trying to get our internal guys to upload the proper TRM chapter in public domain -> hopefully we will get it done some time soon.

Quoted 8 lines
Quoted 8 lines
        msgmgr: msgmgr at 02a00000 {
                compatible = "ti,k2g-message-manager";
                #mbox-cells = <2>;
                reg-names = "queue_proxy_region", "queue_state_debug_region";
                reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
                interrupt-names = "rx_005_002",
                                  "rx_057_002";
Quoted 4 lines

Looking at figure in page-1445, it seems QID is the h/w channel id, while proxy is its programming parameter. So maybe we need to list all the ARM irq's as a list here, matched only by the qid asked by the consumer ... assuming no two channels could have the same qid (?).

The overall story is something like what you already figured out.. message manager has a queue engine and a ram for data buffers, and n queues. Each of these queues have a memory map corresponding to the processor view.. we can call that programming paramater as well.

Quoted 2 lines

interrupt-names = "irq_005", "irq_037", "irq_049", "irq_057",
"perr", "ferr", "eerr";

proxy error (perr), free index error(ferr) and ECC error(eerr) cannot be handled by a slave, since it involves controlling a shared register set for a single message manager instance. in the case of K2G, the master of the message manager is actually PMMC, and not the compute processors - it has error handling logic to handle things there - a slave can only report these errors without ability to even expect reliable detection (for example PMMC reacting even before any of these cores have come up from low power state).

irq_37 and irq_49 go to the secure world and we have no access from ARM "non secure" world. the "missing documentation" would have helped clarify that :(..

Quoted 3 lines

I may be slightly off, but the idea remains to not have to encode any consumer specific info in the provider node.

I do realize the reasoning behind your suggestion here. the reasoning for providing rx_qid_pid as the interrupt name was as follows: I was hoping to get a future SoC to provide proxy specific error instead of a global error which is really useless since the processor generating error should be the guy actually be notified.. queue specific interrupts as well.. the reason for naming interrupts with the proxy id information was primarily to let the dtb ABI stay compatible with only additional properties defined when the new SoC gets supported.

I can make it compatible for today's SoC, but based on what i explained, how about just "rx_<qid>" for the interrupt names? interrupt-names = "rx_005", "rx_057" (I kinda feel using "irq" for interrupt-names is actually redundant information)?

*if* i manage to convince to get a new IP with proxy specific interrupts, then "perr_qid_pid" could then be introduced for that new compatible type..

[...]

Signature · 2 lines
Regards,
Nishanth Menon
maintainer
#16 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Quoted 64 lines · Nishanth Menon

Hi Jassi,

On 02/10/2016 10:23 PM, Jassi Brar wrote:
[...]

Thanks for taking the time and checking the TRM, I apologize that the actual details of the hardware block which was supposed to be in sections 8.1.3 and 8.1.4 has unfortunately been dropped since the last time I reviewed in the spec Vs what actually went out into public domain! I do realize the problem of doing a review without comprehensive and accurate documentation - ugghh.. :(

But, I am trying to get our internal guys to upload the proper TRM chapter in public domain -> hopefully we will get it done some time soon.

Quoted 8 lines
Quoted 8 lines
        msgmgr: msgmgr at 02a00000 {
                compatible = "ti,k2g-message-manager";
                #mbox-cells = <2>;
                reg-names = "queue_proxy_region", "queue_state_debug_region";
                reg = <0x02a00000 0x400000>, <0x028c3400 0x400>;
                interrupt-names = "rx_005_002",
                                  "rx_057_002";
Quoted 4 lines

Looking at figure in page-1445, it seems QID is the h/w channel id, while proxy is its programming parameter. So maybe we need to list all the ARM irq's as a list here, matched only by the qid asked by the consumer ... assuming no two channels could have the same qid (?).

The overall story is something like what you already figured out.. message manager has a queue engine and a ram for data buffers, and n queues. Each of these queues have a memory map corresponding to the processor view.. we can call that programming paramater as well.

Quoted 2 lines

interrupt-names = "irq_005", "irq_037", "irq_049", "irq_057",
"perr", "ferr", "eerr";

proxy error (perr), free index error(ferr) and ECC error(eerr) cannot be handled by a slave, since it involves controlling a shared register set for a single message manager instance. in the case of K2G, the master of the message manager is actually PMMC, and not the compute processors - it has error handling logic to handle things there - a slave can only report these errors without ability to even expect reliable detection (for example PMMC reacting even before any of these cores have come up from low power state).

irq_37 and irq_49 go to the secure world and we have no access from ARM "non secure" world. the "missing documentation" would have helped clarify that :(..

Quoted 3 lines

I may be slightly off, but the idea remains to not have to encode any consumer specific info in the provider node.

I do realize the reasoning behind your suggestion here. the reasoning for providing rx_qid_pid as the interrupt name was as follows: I was hoping to get a future SoC to provide proxy specific error instead of a global error which is really useless since the processor generating error should be the guy actually be notified.. queue specific interrupts as well.. the reason for naming interrupts with the proxy id information was primarily to let the dtb ABI stay compatible with only additional properties defined when the new SoC gets supported.

Quoted 5 lines

I can make it compatible for today's SoC, but based on what i explained, how about just "rx_<qid>" for the interrupt names? interrupt-names = "rx_005", "rx_057" (I kinda feel using "irq" for interrupt-names is actually redundant information)?

Feel free to name the interrupts "rx_" instead of "irq_" ... assuming the interrupts correspond to only reception of data.

Quoted 4 lines

*if* i manage to convince to get a new IP with proxy specific interrupts, then "perr_qid_pid" could then be introduced for that new compatible type..

Yeah, let us cross the bridge when we come to it. Let us not add any feature/binding that has no user today.

Thanks.

#17 lore raw

Re: [PATCH 1/2] Documentation: dt: mailbox: Add TI Message Manager

Jassi,

Quoted 1 line · Jassi Brar

On Thu, Feb 11, 2016 at 10:33 AM, Nishanth Menon <[email protected]> wrote:

[...]

Quoted 8 lines
Quoted 5 lines

I can make it compatible for today's SoC, but based on what i explained, how about just "rx_<qid>" for the interrupt names? interrupt-names = "rx_005", "rx_057" (I kinda feel using "irq" for interrupt-names is actually redundant information)?

Feel free to name the interrupts "rx_" instead of "irq_" ... assuming the interrupts correspond to only reception of data.

Thanks for your reviews. I have now posted a v2: hopefully these meet the needs.

https://patchwork.kernel.org/patch/8442641/
https://patchwork.kernel.org/patch/8442671/

Signature · 3 lines
---
Regards,
Nishanth Menon
#18 lore raw

PATCH 2/2 mailbox: Introduce TI message manager driver

In reply to Nishanth Menon

Support for TI Message Manager Module. This hardware block manages a bunch of hardware queues meant for communication between processor entities.

Clients sitting on top of this would manage the required protocol for communicating with the counterpart entities.

For more details on TI Message Manager hardware block, see documentation that is available here: http://www.ti.com/lit/ug/spruhy8/spruhy8.pdf
Chapter 8.1(Message Manager)

---
 drivers/mailbox/Kconfig     |  11 +
 drivers/mailbox/Makefile    |   2 +
 drivers/mailbox/ti-msgmgr.c | 603 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/ti-msgmgr.h   |  35 +++
 4 files changed, 651 insertions(+)
 create mode 100644 drivers/mailbox/ti-msgmgr.c
 create mode 100644 include/linux/ti-msgmgr.h
drivers/mailbox/Kconfig +11 -0
index 546d05f4358a..5da85ae48a59 100644
@@ -78,6 +78,17 @@ config STI_MBOX
 	  Mailbox implementation for STMicroelectonics family chips with
 	  hardware for interprocessor communication.
 
+config TI_MESSAGE_MANAGER
+	tristate "Texas Instruments Message Manager Driver"
+	depends on ARCH_KEYSTONE
+	help
+	  An implementation of Message Manager slave driver for Keystone
+	  architecture SoCs from Texas Instruments. Message Manager is a
+	  communication entity found on few of Texas Instrument's keystone
+	  architecture SoCs. These may be used for communication between
+	  multiple processors within the SoC. Select this driver if your
+	  platform has support for the hardware block.
+
 config MAILBOX_TEST
 	tristate "Mailbox Test Client"
 	depends on OF
drivers/mailbox/Makefile +2 -0
index 92435ef11f26..a9c2899e44ff 100644
@@ -17,3 +17,5 @@ obj-$(CONFIG_ALTERA_MBOX)	+= mailbox-altera.o
 obj-$(CONFIG_BCM2835_MBOX)	+= bcm2835-mailbox.o
 
 obj-$(CONFIG_STI_MBOX)		+= mailbox-sti.o
+
+obj-$(CONFIG_TI_MESSAGE_MANAGER) += ti-msgmgr.o
drivers/mailbox/ti-msgmgr.c new file +603 -0

603 lines not on this page · raw message

include/linux/ti-msgmgr.h new file +35 -0
new file mode 100644
index 000000000000..2c6a01850028
@@ -0,0 +1,35 @@
+/*
+ * Texas Instruments' Message Manager
+ *
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *	Nishanth Menon
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef TI_MSGMGR_H
+#define TI_MSGMGR_H
+
+/**
+ * struct ti_msgmgr_message - Message Manager structure
+ * @len: Length of data in the Buffer
+ * @buf: Buffer pointer
+ *
+ * This is the structure for data used in mbox_send_message
+ * the length of data buffer used depends on the SoC integration
+ * parameters - each message may be 64, 128 bytes long depending
+ * on SoC. Client is supposed to be aware of this.
+ */
+struct ti_msgmgr_message {
+	size_t len;
+	u8 *buf;
+};
+
+#endif /* TI_MSGMGR_H */
Signature · 1 line
2.7.0