Skip to contentSkip to conversation

mailbox: Introduce Texas Instrument's message manager driver

PATCH New Nishanth Menon 1 participant 3 messages Mar 17, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover mailbox: Introduce Texas Instrument's message manager driver

Hi,

The following v2 of the 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 - NOTE: complete chapter update is estimated to be somewhere in March '16 - This does not seem done as of this writing).

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 fragment:
http://pastebin.ubuntu.com/15209502/

Boot log: http://pastebin.ubuntu.com/15405132/

baseline: next-20160316

Changes since v2:
- driver update for review comments from Jassi.

v2: http://marc.info/?l=linux-kernel&m=145652549004201&w=2
v1: http://marc.info/?l=devicetree&m=145469015018996&w=2

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

 .../bindings/mailbox/ti,message-manager.txt        |  50 ++
 drivers/mailbox/Kconfig                            |  11 +
 drivers/mailbox/Makefile                           |   2 +
 drivers/mailbox/ti-msgmgr.c                        | 639 +++++++++++++++++++++
 include/linux/soc/ti/ti-msgmgr.h                   |  35 ++
 5 files changed, 737 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/soc/ti/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.8.0.rc3
#1 lore raw

PATCH v3 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.

---
Changes in V3:
- Just picked up Rob's ack from v2
V2: https://patchwork.kernel.org/patch/8442641/
V1: https://patchwork.kernel.org/patch/8237111/

 .../bindings/mailbox/ti,message-manager.txt        | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/ti,message-manager.txt
Documentation/devicetree/bindings/mailbox/ti,message-manager.txt new file +50 -0
new file mode 100644
index 000000000000..b449d025049f
@@ -0,0 +1,50 @@
+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", "rx_057";
+		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 · 1 line
2.8.0.rc3
#2 lore raw

PATCH v3 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 will is available here: http://www.ti.com/lit/ug/spruhy8/spruhy8.pdf
Chapter 8.1(Message Manager)

---
Changes in V3:
- rebased to next-20160316 -> this hopefully should help Jassi apply the patch.
- moved header to include/linux/soc/ti/
- dropped duplicated comment in tx path around writel (just pointed to rx in case someone looks at code later on).
- Dropped ti_msgmgr_queue_get_num_messages from tx path - it seems to be causing confusion Vs what is necessary at this point in time.

V2: https://patchwork.kernel.org/patch/8442671/
V1: https://patchwork.kernel.org/patch/8237171/

 drivers/mailbox/Kconfig          |  11 +
 drivers/mailbox/Makefile         |   2 +
 drivers/mailbox/ti-msgmgr.c      | 639 +++++++++++++++++++++++++++++++++++++++
 include/linux/soc/ti/ti-msgmgr.h |  35 +++
 4 files changed, 687 insertions(+)
 create mode 100644 drivers/mailbox/ti-msgmgr.c
 create mode 100644 include/linux/soc/ti/ti-msgmgr.h
drivers/mailbox/Kconfig +11 -0
index 09719843ad4a..5305923752d2 100644
@@ -87,6 +87,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 HI6220_MBOX
 	tristate "Hi6220 Mailbox"
 	depends on ARCH_HISI
drivers/mailbox/Makefile +2 -0
index 948671733aa7..0be3e742bb7d 100644
@@ -20,6 +20,8 @@ obj-$(CONFIG_BCM2835_MBOX)	+= bcm2835-mailbox.o
 
 obj-$(CONFIG_STI_MBOX)		+= mailbox-sti.o
 
+obj-$(CONFIG_TI_MESSAGE_MANAGER) += ti-msgmgr.o
+
 obj-$(CONFIG_XGENE_SLIMPRO_MBOX) += mailbox-xgene-slimpro.o
 
 obj-$(CONFIG_HI6220_MBOX)	+= hi6220-mailbox.o
drivers/mailbox/ti-msgmgr.c new file +639 -0

639 lines not on this page · raw message

include/linux/soc/ti/ti-msgmgr.h new file +35 -0
new file mode 100644
index 000000000000..eac8e0c6fe11
@@ -0,0 +1,35 @@
+/*
+ * Texas Instruments' Message Manager
+ *
+ * Copyright (C) 2015-2016 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.8.0.rc3