]>
git.ipfire.org Git - people/ms/u-boot.git/blob - include/mailbox_uclass.h
2 * Copyright (c) 2016, NVIDIA CORPORATION.
4 * SPDX-License-Identifier: GPL-2.0
7 #ifndef _MAILBOX_UCLASS_H
8 #define _MAILBOX_UCLASS_H
10 /* See mailbox_client.h for background documentation. */
12 #include <mailbox_client.h>
17 * struct mbox_ops - The functions that a mailbox driver must implement.
21 * of_xlate - Translate a client's device-tree (OF) mailbox specifier.
23 * The mailbox core calls this function as the first step in
24 * implementing a client's mbox_get_by_*() call.
26 * If this function pointer is set to NULL, the mailbox core will use
27 * a default implementation, which assumes #mbox-cells = <1>, and that
28 * the DT cell contains a simple integer channel ID.
30 * At present, the mailbox API solely supports device-tree. If this
31 * changes, other xxx_xlate() functions may be added to support those
34 * @chan: The channel to hold the translation result.
35 * @args: The mailbox specifier values from device tree.
36 * @return 0 if OK, or a negative error code.
38 int (*of_xlate
)(struct mbox_chan
*chan
,
39 struct fdtdec_phandle_args
*args
);
41 * request - Request a translated channel.
43 * The mailbox core calls this function as the second step in
44 * implementing a client's mbox_get_by_*() call, following a successful
47 * @chan: The channel to request; this has been filled in by a
48 * previoux xxx_xlate() function call.
49 * @return 0 if OK, or a negative error code.
51 int (*request
)(struct mbox_chan
*chan
);
53 * free - Free a previously requested channel.
55 * This is the implementation of the client mbox_free() API.
57 * @chan: The channel to free.
58 * @return 0 if OK, or a negative error code.
60 int (*free
)(struct mbox_chan
*chan
);
62 * send - Send a message over a mailbox channel
64 * @chan: The channel to send to the message to.
65 * @data: A pointer to the message to send.
66 * @return 0 if OK, or a negative error code.
68 int (*send
)(struct mbox_chan
*chan
, const void *data
);
70 * recv - Receive any available message from the channel.
72 * This function does not block. If not message is immediately
73 * available, the function should return an error.
75 * @chan: The channel to receive to the message from.
76 * @data: A pointer to the buffer to hold the received message.
77 * @return 0 if OK, -ENODATA if no message was available, or a negative
80 int (*recv
)(struct mbox_chan
*chan
, void *data
);