summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOleksij Rempel <linux@rempel-privat.de>2019-09-23 11:55:27 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-09-26 08:42:52 +0200
commit22763dab152cb38c0912fe688f564a54aeaaea88 (patch)
tree81252e6e25da91896de155d875c3badb67335299 /include
parentf114b0479a2217c19cdf77a5aeeeb2a329255ff0 (diff)
downloadbarebox-22763dab152cb38c0912fe688f564a54aeaaea88.tar.gz
barebox-22763dab152cb38c0912fe688f564a54aeaaea88.tar.xz
port reduced version of remoteproc framework from linux
I tested it on phytec imx7 board with remoteproc ELF image previously used on Linux. Linux would load this image, create appropriate resource (if defined in image) and boot it. The barebox version is only loading image and boot it. Currently barebox version do not extract resources defined by rproc ELF image. On this early stage it is hard to say, if it is needed. Previously there was an attempt to port bootaux command from u-boot. Porting of remoteproc framework is my attempt to lead this topic in to the (IMO) right direction. To start remoteproc image, firmwareload command should be used: firmwareload /mnt/tftp/rproc-imx-rproc-fw Since firmwareload already support multiple targets, it is possible to specify which exact cortex m4 CPU should be started (if multiple CPU are present). This example shows the list of available firmware targets: barebox@Phytec i.MX7 phyBOARD-Zeta:/ firmwareload -l firmware programming handlers: name: model: soc:imx7d-rp0@0.of Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/remoteproc.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
new file mode 100644
index 0000000000..feee9ee4ee
--- /dev/null
+++ b/include/linux/remoteproc.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Remote Processor Framework
+ *
+ * Copyright(c) 2011 Texas Instruments, Inc.
+ * Copyright(c) 2011 Google, Inc.
+ */
+
+#ifndef REMOTEPROC_H
+#define REMOTEPROC_H
+
+#include <firmware.h>
+
+struct resource_table {
+ u32 ver;
+ u32 num;
+ u32 reserved[2];
+ u32 offset[0];
+} __packed;
+
+struct firmware {
+ size_t size;
+ const u8 *data;
+};
+
+struct rproc;
+
+struct rproc_ops {
+ int (*start)(struct rproc *rproc);
+ int (*stop)(struct rproc *rproc);
+ void * (*da_to_va)(struct rproc *rproc, u64 da, int len);
+ int (*load)(struct rproc *rproc, const struct firmware *fw);
+};
+
+struct rproc {
+ struct firmware_handler fh;
+ const char *name;
+ void *priv;
+ struct rproc_ops *ops;
+ struct device_d dev;
+ int index;
+
+ void *fw_buf;
+ size_t fw_buf_ofs;
+};
+
+struct rproc *rproc_alloc(struct device_d *dev, const char *name,
+ const struct rproc_ops *ops, int len);
+int rproc_add(struct rproc *rproc);
+
+#endif /* REMOTEPROC_H */