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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2020-2025, Renesas Electronics Corporation.
*/
#include <asm/io.h>
#include <dm.h>
#include <linux/delay.h>
#include <mailbox-uclass.h>
#define COM 0x0
#define IIR BIT(0)
struct mfis_priv {
void __iomem *tx_base;
};
static int mfis_send(struct mbox_chan *chan, const void *data)
{
struct mfis_priv *mfis = dev_get_priv(chan->dev);
writel(IIR, mfis->tx_base + COM);
/* Give the remote side some time. */
mdelay(1);
writel(0, mfis->tx_base + COM);
return 0;
}
struct mbox_ops mfis_mbox_ops = {
.send = mfis_send,
};
static int mfis_mbox_probe(struct udevice *dev)
{
struct mfis_priv *mbox = dev_get_priv(dev);
mbox->tx_base = dev_read_addr_index_ptr(dev, 0);
if (!mbox->tx_base)
return -ENODEV;
return 0;
}
static const struct udevice_id mfis_mbox_of_match[] = {
{ .compatible = "renesas,mfis-mbox", },
{},
};
U_BOOT_DRIVER(renesas_mfis) = {
.name = "renesas-mfis",
.id = UCLASS_MAILBOX,
.of_match = mfis_mbox_of_match,
.probe = mfis_mbox_probe,
.priv_auto = sizeof(struct mfis_priv),
.ops = &mfis_mbox_ops,
};
|