Re: [U-Boot] [PATCH 22/25] remoteproc: Introduce K3 remoteproc driver

2018-08-24 Thread Tom Rini
On Tue, Aug 21, 2018 at 08:02:00PM +0530, Lokesh Vutla wrote:

> Add support for K3 based remoteproc driver that
> communicates with TISCI to start start a remote processor.
> 
> Signed-off-by: Lokesh Vutla 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 22/25] remoteproc: Introduce K3 remoteproc driver

2018-08-21 Thread Lokesh Vutla
Add support for K3 based remoteproc driver that
communicates with TISCI to start start a remote processor.

Signed-off-by: Lokesh Vutla 
---
 .../remoteproc/k3-rproc.txt   |  50 
 drivers/remoteproc/Kconfig|   9 +
 drivers/remoteproc/Makefile   |   1 +
 drivers/remoteproc/k3_rproc.c | 244 ++
 4 files changed, 304 insertions(+)
 create mode 100644 doc/device-tree-bindings/remoteproc/k3-rproc.txt
 create mode 100644 drivers/remoteproc/k3_rproc.c

diff --git a/doc/device-tree-bindings/remoteproc/k3-rproc.txt 
b/doc/device-tree-bindings/remoteproc/k3-rproc.txt
new file mode 100644
index 00..0a1e858225
--- /dev/null
+++ b/doc/device-tree-bindings/remoteproc/k3-rproc.txt
@@ -0,0 +1,50 @@
+Texas Instruments' K3 Remote processor driver
+=
+
+In K3 generation Socs, loading an image on any processing entity
+cannot be done directly from U-Boot. In order to load an image,
+remoteproc driver should communicate to SYSFW with a specific sequence.
+Also enable the timer required for this remotecore.
+
+Required properties:
+
+- compatible:  Shall be: "ti,am654-rproc"
+- reg: base address of the remoteproc timer.
+- power-domains:   Should contain two sets of entries:
+   First set corresponds to pm domain of the
+   remotecore timer. Seconf entry corresponds to the
+   remoteproc to start.
+   This property is as per the binding,
+   doc/device-tree-bindings/power/ti,sci-pm-domain.txt
+- resets:  Should contain a phandle to a reset controller node
+   and an args specifier containing the remote code
+   device id and reset mask value. This is as per the
+   doc/device-tree-bindings/reset/ti,sci-reset.txt
+- ti,sci:  Phandle to TI-SCI compatible System controller node.
+- ti,sci-proc-id:  Processor id as identified by TISCI
+
+Optional properties:
+
+- assigned-clocks: Should contain a phandle to clock node and an args
+   specifier containing the remote core device id and
+   the clock id within the remote core. This is as per
+   doc/device-tree-bindings/clock/ti,sci-clk.txt
+- assigned-clock-rates: One entry for each entry of assigned-clocks. This is
+   the frequency at which the corresponding clock needs
+   to be assigned.
+- ti,sci-host-id:  Host ID to which the processor control is transferred to
+
+Example:
+-
+
+a53_0: a53@0 {
+   compatible = "ti,am654-rproc";
+   power-domains = <_pds 61>,
+   <_pds 202>;
+   resets = <_reset 202 0>;
+   assigned-clocks = <_clks 202 0>;
+   assigned-clock-rates = <8>;
+   ti,sci = <>;
+   ti,sci-proc-id = <32>;
+   ti,sci-host-id = <10>;
+};
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 812d30153b..9eb532bc7a 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -22,6 +22,15 @@ config K3_SYSTEM_CONTROLLER
help
  Say 'y' here to add support for TI' K3 System Controller.
 
+config REMOTEPROC_K3
+   bool "Support for TI's K3 based remoteproc driver"
+   select REMOTEPROC
+   depends on DM
+   depends on ARCH_K3
+   depends on OF_CONTROL
+   help
+ Say 'y' here to add support for TI' K3 remoteproc driver.
+
 config REMOTEPROC_SANDBOX
bool "Support for Test processor for Sandbox"
select REMOTEPROC
diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
index bfd02ad52d..87ef9e61a7 100644
--- a/drivers/remoteproc/Makefile
+++ b/drivers/remoteproc/Makefile
@@ -8,5 +8,6 @@ obj-$(CONFIG_REMOTEPROC) += rproc-uclass.o
 
 # Remote proc drivers - Please keep this list alphabetically sorted.
 obj-$(CONFIG_K3_SYSTEM_CONTROLLER) += k3_system_controller.o
+obj-$(CONFIG_REMOTEPROC_K3) += k3_rproc.o
 obj-$(CONFIG_REMOTEPROC_SANDBOX) += sandbox_testproc.o
 obj-$(CONFIG_REMOTEPROC_TI_POWER) += ti_power_proc.o
diff --git a/drivers/remoteproc/k3_rproc.c b/drivers/remoteproc/k3_rproc.c
new file mode 100644
index 00..4028d4aa66
--- /dev/null
+++ b/drivers/remoteproc/k3_rproc.c
@@ -0,0 +1,244 @@
+// SPDX-License-Identifier:GPL-2.0+
+/*
+ * Texas Instruments' K3 Remoteproc driver
+ *
+ * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
+ * Lokesh Vutla 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define INVALID_ID 0x
+
+#define GTC_CNTCR_REG  0x0
+#define GTC_CNTR_EN0x3
+
+/**
+ * struct k3_rproc_privdata - Structure representing Remote processor data.
+ * @rproc_pwrdmn:  rproc power domain