Secure Proxy module manages hardware threads that are meant
for communication between the processor entities. Adding
support for this driver.
Signed-off-by: Lokesh Vutla
Signed-off-by: Andreas Dannenberg
---
.../mailbox/k3-secure-proxy.txt | 40 ++
drivers/mailbox/Kconfig | 10 +
drivers/mailbox/Makefile | 1 +
drivers/mailbox/k3-sec-proxy.c| 438 ++
include/linux/soc/ti/k3-sec-proxy.h | 25 +
5 files changed, 514 insertions(+)
create mode 100644 doc/device-tree-bindings/mailbox/k3-secure-proxy.txt
create mode 100644 drivers/mailbox/k3-sec-proxy.c
create mode 100644 include/linux/soc/ti/k3-sec-proxy.h
diff --git a/doc/device-tree-bindings/mailbox/k3-secure-proxy.txt
b/doc/device-tree-bindings/mailbox/k3-secure-proxy.txt
new file mode 100644
index 00..f3add0d4e7
--- /dev/null
+++ b/doc/device-tree-bindings/mailbox/k3-secure-proxy.txt
@@ -0,0 +1,40 @@
+Texas Instruments' K3 Secure Proxy
+===
+
+The Texas Instruments' K3 Secure Proxy is a mailbox controller that has
+configurable threads maintained by System power processor. Each thread
+has different address space that can be used to send or receive messages.
+
+Secure Proxy Device Node:
+===
+Required properties:
+
+- compatible: Shall be: "ti,am654-secure-proxy"
+- reg-namesdata - Map the data region
+ scfg - Map the secure configuration region
+ rt - Map the Realtime region.
+- reg: Contains the register map per reg-names.
+- #mbox-cells Shall be 1. Contains the thread ID.
+
+Example:
+
+
+secproxy: secproxy@285b {
+ compatible = "ti,am654-secure-proxy";
+ reg = <0x2a38 0x8>,
+ <0x2a40 0x8>,
+ <0x2a48 0x8>;
+ reg-names = "rt", "scfg", "data";
+ #mbox-cells = <1>;
+};
+
+client:
+
+systemcontroller: systemcontroller {
+ [...]
+ # RX thread ID is 4.
+ # TX thread ID is 5.
+ mboxes= < 4>,
+ < 5>;
+ [...]
+};
diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index 9649b70589..2836ee4a7b 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -24,4 +24,14 @@ config TEGRA_HSP
This enables support for the NVIDIA Tegra HSP Hw module, which
implements doorbells, mailboxes, semaphores, and shared interrupts.
+config K3_SEC_PROXY
+ bool "Texas Instruments K3 Secure Proxy Driver"
+ depends on DM_MAILBOX && ARCH_K3
+ help
+ An implementation of Secure proxy slave driver for K3 SoCs from
+ Texas Instruments. Secure proxy is a communication entity mainly
+ used for communication between multiple processors with the SoC.
+ Select this driver if your platform has support for this hardware
+ block.
+
endmenu
diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile
index 155dbeb099..4ac85d412f 100644
--- a/drivers/mailbox/Makefile
+++ b/drivers/mailbox/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_DM_MAILBOX) += mailbox-uclass.o
obj-$(CONFIG_SANDBOX_MBOX) += sandbox-mbox.o
obj-$(CONFIG_SANDBOX_MBOX) += sandbox-mbox-test.o
obj-$(CONFIG_TEGRA_HSP) += tegra-hsp.o
+obj-$(CONFIG_K3_SEC_PROXY) += k3-sec-proxy.o
diff --git a/drivers/mailbox/k3-sec-proxy.c b/drivers/mailbox/k3-sec-proxy.c
new file mode 100644
index 00..4654c8cb82
--- /dev/null
+++ b/drivers/mailbox/k3-sec-proxy.c
@@ -0,0 +1,438 @@
+// SPDX-License-Identifier:GPL-2.0+
+/*
+ * Texas Instruments' K3 Secure proxy Driver
+ *
+ * Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/
+ * Lokesh Vutla
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* SEC PROXY RT THREAD STATUS */
+#define RT_THREAD_STATUS 0x0
+#define RT_THREAD_THRESHOLD0x4
+#define RT_THREAD_STATUS_ERROR_SHIFT 31
+#define RT_THREAD_STATUS_ERROR_MASKBIT(31)
+#define RT_THREAD_STATUS_CUR_CNT_SHIFT 0
+#define RT_THREAD_STATUS_CUR_CNT_MASK GENMASK(7, 0)
+
+/* SEC PROXY SCFG THREAD CTRL */
+#define SCFG_THREAD_CTRL 0x1000
+#define SCFG_THREAD_CTRL_DIR_SHIFT 31
+#define SCFG_THREAD_CTRL_DIR_MASK BIT(31)
+
+#define SEC_PROXY_THREAD(base, x) ((base) + (0x1000 * (x)))
+#define THREAD_IS_RX 1
+#define THREAD_IS_TX 0
+
+/**
+ * struct k3_sec_proxy_desc - Description of secure proxy integration.
+ * @thread_count: Number of Threads.
+ * @max_msg_size: Message size in bytes.
+ * @data_start_offset: Offset of the First data register of the thread
+ * @data_end_offset: Offset of the Last data register of the thread
+ * @valid_threads: List