Lines Matching +full:chan +full:- +full:name

4  * SPDX-License-Identifier: GPL-2.0
10 #include <mailbox-uclass.h>
16 return (struct mbox_ops *)dev->driver->ops; in mbox_dev_ops()
19 static int mbox_of_xlate_default(struct mbox_chan *chan, in mbox_of_xlate_default() argument
22 debug("%s(chan=%p)\n", __func__, chan); in mbox_of_xlate_default()
24 if (args->args_count != 1) { in mbox_of_xlate_default()
25 debug("Invaild args_count: %d\n", args->args_count); in mbox_of_xlate_default()
26 return -EINVAL; in mbox_of_xlate_default()
29 chan->id = args->args[0]; in mbox_of_xlate_default()
34 int mbox_get_by_index(struct udevice *dev, int index, struct mbox_chan *chan) in mbox_get_by_index() argument
41 debug("%s(dev=%p, index=%d, chan=%p)\n", __func__, dev, index, chan); in mbox_get_by_index()
43 ret = dev_read_phandle_with_args(dev, "mboxes", "#mbox-cells", 0, index, in mbox_get_by_index()
59 chan->dev = dev_mbox; in mbox_get_by_index()
60 if (ops->of_xlate) in mbox_get_by_index()
61 ret = ops->of_xlate(chan, &args); in mbox_get_by_index()
63 ret = mbox_of_xlate_default(chan, &args); in mbox_get_by_index()
69 ret = ops->request(chan); in mbox_get_by_index()
71 debug("ops->request() failed: %d\n", ret); in mbox_get_by_index()
78 int mbox_get_by_name(struct udevice *dev, const char *name, in mbox_get_by_name() argument
79 struct mbox_chan *chan) in mbox_get_by_name() argument
83 debug("%s(dev=%p, name=%s, chan=%p)\n", __func__, dev, name, chan); in mbox_get_by_name()
85 index = dev_read_stringlist_search(dev, "mbox-names", name); in mbox_get_by_name()
91 return mbox_get_by_index(dev, index, chan); in mbox_get_by_name()
94 int mbox_free(struct mbox_chan *chan) in mbox_free() argument
96 struct mbox_ops *ops = mbox_dev_ops(chan->dev); in mbox_free()
98 debug("%s(chan=%p)\n", __func__, chan); in mbox_free()
100 return ops->free(chan); in mbox_free()
103 int mbox_send(struct mbox_chan *chan, const void *data) in mbox_send() argument
105 struct mbox_ops *ops = mbox_dev_ops(chan->dev); in mbox_send()
107 debug("%s(chan=%p, data=%p)\n", __func__, chan, data); in mbox_send()
109 return ops->send(chan, data); in mbox_send()
112 int mbox_recv(struct mbox_chan *chan, void *data, ulong timeout_us) in mbox_recv() argument
114 struct mbox_ops *ops = mbox_dev_ops(chan->dev); in mbox_recv()
118 debug("%s(chan=%p, data=%p, timeout_us=%ld)\n", __func__, chan, data, in mbox_recv()
130 ret = ops->recv(chan, data); in mbox_recv()
131 if (ret != -ENODATA) in mbox_recv()
133 if ((timer_get_us() - start_time) >= timeout_us) in mbox_recv()
134 return -ETIMEDOUT; in mbox_recv()
140 .name = "mailbox",