summaryrefslogtreecommitdiff
path: root/include/sbi_utils/mailbox/fdt_mailbox.h
blob: 0d5df34085a97799eb0ba8e42d66d180e788dfa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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