Blame view

include/mailbox-uclass.h 2.45 KB
83d290c56   Tom Rini   SPDX: Convert all...
1
  /* SPDX-License-Identifier: GPL-2.0 */
6238935d0   Stephen Warren   Add a mailbox dri...
2
3
  /*
   * Copyright (c) 2016, NVIDIA CORPORATION.
6238935d0   Stephen Warren   Add a mailbox dri...
4
5
6
7
   */
  
  #ifndef _MAILBOX_UCLASS_H
  #define _MAILBOX_UCLASS_H
769d52ef0   Stephen Warren   mailbox: rename h...
8
  /* See mailbox.h for background documentation. */
6238935d0   Stephen Warren   Add a mailbox dri...
9

769d52ef0   Stephen Warren   mailbox: rename h...
10
  #include <mailbox.h>
6238935d0   Stephen Warren   Add a mailbox dri...
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
36
  
  struct udevice;
  
  /**
   * struct mbox_ops - The functions that a mailbox driver must implement.
   */
  struct mbox_ops {
  	/**
  	 * of_xlate - Translate a client's device-tree (OF) mailbox specifier.
  	 *
  	 * The mailbox core calls this function as the first step in
  	 * implementing a client's mbox_get_by_*() call.
  	 *
  	 * If this function pointer is set to NULL, the mailbox core will use
  	 * a default implementation, which assumes #mbox-cells = <1>, and that
  	 * the DT cell contains a simple integer channel ID.
  	 *
  	 * At present, the mailbox API solely supports device-tree. If this
  	 * changes, other xxx_xlate() functions may be added to support those
  	 * other mechanisms.
  	 *
  	 * @chan:	The channel to hold the translation result.
  	 * @args:	The mailbox specifier values from device tree.
  	 * @return 0 if OK, or a negative error code.
  	 */
  	int (*of_xlate)(struct mbox_chan *chan,
5e1ff6480   Simon Glass   dm: mailbox: Upda...
37
  			struct ofnode_phandle_args *args);
6238935d0   Stephen Warren   Add a mailbox dri...
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
  	/**
  	 * request - Request a translated channel.
  	 *
  	 * The mailbox core calls this function as the second step in
  	 * implementing a client's mbox_get_by_*() call, following a successful
  	 * xxx_xlate() call.
  	 *
  	 * @chan:	The channel to request; this has been filled in by a
  	 *		previoux xxx_xlate() function call.
  	 * @return 0 if OK, or a negative error code.
  	 */
  	int (*request)(struct mbox_chan *chan);
  	/**
  	 * free - Free a previously requested channel.
  	 *
  	 * This is the implementation of the client mbox_free() API.
  	 *
  	 * @chan:	The channel to free.
  	 * @return 0 if OK, or a negative error code.
  	 */
  	int (*free)(struct mbox_chan *chan);
  	/**
  	* send - Send a message over a mailbox channel
  	*
  	* @chan:	The channel to send to the message to.
  	* @data:	A pointer to the message to send.
  	* @return 0 if OK, or a negative error code.
  	*/
  	int (*send)(struct mbox_chan *chan, const void *data);
  	/**
  	* recv - Receive any available message from the channel.
  	*
  	* This function does not block. If not message is immediately
  	* available, the function should return an error.
  	*
  	* @chan:	The channel to receive to the message from.
  	* @data:	A pointer to the buffer to hold the received message.
  	* @return 0 if OK, -ENODATA if no message was available, or a negative
  	* error code.
  	*/
  	int (*recv)(struct mbox_chan *chan, void *data);
  };
  
  #endif