aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnup Patel <apatel@ventanamicro.com>2024-08-06 10:02:04 +0530
committerAnup Patel <anup@brainfault.org>2024-12-06 09:26:19 +0530
commit2244a34f0d618c6f18c161b6448af1eecc7f72ab (patch)
treed67b390674b421f1ab86d0a1be8e5e18b19a5345 /include
parentad846a7cb8cdb98870e42539087f2bc4e786fd22 (diff)
downloadopensbi-2244a34f0d618c6f18c161b6448af1eecc7f72ab.tar.gz
opensbi-2244a34f0d618c6f18c161b6448af1eecc7f72ab.tar.bz2
opensbi-2244a34f0d618c6f18c161b6448af1eecc7f72ab.zip
lib: utils/mailbox: Add simple FDT based mailbox framework
Add a simple FDT based mailbox framework which is built on top of the generic mailbox library. The phandle of FDT mailbox DT node is treated as the unique mailbox controller ID which is required by the generic mailbox library. The FDT based mailbox drivers will be probed on-demand from fdt_mailbox_request_chan() called by the mailbox client drivers. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Diffstat (limited to 'include')
-rw-r--r--include/sbi_utils/mailbox/fdt_mailbox.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/sbi_utils/mailbox/fdt_mailbox.h b/include/sbi_utils/mailbox/fdt_mailbox.h
new file mode 100644
index 00000000..0d5df340
--- /dev/null
+++ b/include/sbi_utils/mailbox/fdt_mailbox.h
@@ -0,0 +1,35 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2024 Ventana Micro Systems Inc.
+ *
+ * Authors:
+ * Anup Patel <apatel@ventanamicro.com>
+ */
+
+#ifndef __FDT_MAILBOX_H__
+#define __FDT_MAILBOX_H__
+
+#include <sbi_utils/fdt/fdt_driver.h>
+#include <sbi_utils/mailbox/mailbox.h>
+
+struct fdt_phandle_args;
+
+/** FDT based mailbox driver */
+struct fdt_mailbox {
+ struct fdt_driver driver;
+ int (*xlate)(struct mbox_controller *mbox,
+ const struct fdt_phandle_args *pargs,
+ u32 *out_chan_args);
+};
+
+/** Request a mailbox channel using "mboxes" DT property of client DT node */
+int fdt_mailbox_request_chan(const void *fdt, int nodeoff, int index,
+ struct mbox_chan **out_chan);
+
+/** Simple xlate function to convert one mailbox FDT cell into channel args */
+int fdt_mailbox_simple_xlate(struct mbox_controller *mbox,
+ const struct fdt_phandle_args *pargs,
+ u32 *out_chan_args);
+
+#endif