summaryrefslogtreecommitdiff
path: root/drivers/mailbox
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mailbox')
-rw-r--r--drivers/mailbox/apple-mbox.c2
-rw-r--r--drivers/mailbox/imx-mailbox.c2
-rw-r--r--drivers/mailbox/k3-sec-proxy.c2
-rw-r--r--drivers/mailbox/mpfs-mbox.c27
-rw-r--r--drivers/mailbox/renesas-mfis.c2
-rw-r--r--drivers/mailbox/sandbox-mbox.c2
-rw-r--r--drivers/mailbox/stm32-ipcc.c2
7 files changed, 25 insertions, 14 deletions
diff --git a/drivers/mailbox/apple-mbox.c b/drivers/mailbox/apple-mbox.c
index 2ee49734f40..39a7edc0285 100644
--- a/drivers/mailbox/apple-mbox.c
+++ b/drivers/mailbox/apple-mbox.c
@@ -59,7 +59,7 @@ static int apple_mbox_recv(struct mbox_chan *chan, void *data)
return 0;
}
-struct mbox_ops apple_mbox_ops = {
+static const struct mbox_ops apple_mbox_ops = {
.of_xlate = apple_mbox_of_xlate,
.send = apple_mbox_send,
.recv = apple_mbox_recv,
diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
index c7eaa3de96f..fd0fce21d78 100644
--- a/drivers/mailbox/imx-mailbox.c
+++ b/drivers/mailbox/imx-mailbox.c
@@ -387,7 +387,7 @@ int imx_mu_of_xlate(struct mbox_chan *chan, struct ofnode_phandle_args *args)
return plat->dcfg->of_xlate(chan, args);
}
-struct mbox_ops imx_mu_ops = {
+static const struct mbox_ops imx_mu_ops = {
.of_xlate = imx_mu_of_xlate,
.request = imx_mu_chan_request,
.rfree = imx_mu_chan_free,
diff --git a/drivers/mailbox/k3-sec-proxy.c b/drivers/mailbox/k3-sec-proxy.c
index 6f5ad37919f..6eebfcd3601 100644
--- a/drivers/mailbox/k3-sec-proxy.c
+++ b/drivers/mailbox/k3-sec-proxy.c
@@ -293,7 +293,7 @@ static int k3_sec_proxy_recv(struct mbox_chan *chan, void *data)
return 0;
}
-struct mbox_ops k3_sec_proxy_mbox_ops = {
+static const struct mbox_ops k3_sec_proxy_mbox_ops = {
.of_xlate = k3_sec_proxy_of_xlate,
.request = k3_sec_proxy_request,
.rfree = k3_sec_proxy_free,
diff --git a/drivers/mailbox/mpfs-mbox.c b/drivers/mailbox/mpfs-mbox.c
index b1ce377525e..8b7a2719330 100644
--- a/drivers/mailbox/mpfs-mbox.c
+++ b/drivers/mailbox/mpfs-mbox.c
@@ -18,6 +18,7 @@
#include <linux/compat.h>
#include <linux/err.h>
#include <linux/errno.h>
+#include <linux/iopoll.h>
#include <log.h>
#include <mailbox-uclass.h>
#include <mpfs-mailbox.h>
@@ -60,11 +61,15 @@ static int mpfs_mbox_send(struct mbox_chan *chan, const void *data)
u32 mailbox_val, cmd_shifted, value;
u8 *byte_buf;
u8 idx, byte_idx, byte_offset;
+ int ret;
u32 *word_buf = (u32 *)msg->cmd_data;
- if (mpfs_mbox_busy(chan))
- return -EBUSY;
+ ret = regmap_read_poll_timeout(mbox->control_scb, SERVICES_SR_OFFSET,
+ value, !(value & SERVICE_SR_BUSY_MASK),
+ 1, 20);
+ if (ret)
+ return ret;
for (idx = 0; idx < (msg->cmd_data_size / BYTES_4); idx++)
writel(word_buf[idx], mbox->mbox_base + msg->mbox_offset + idx * BYTES_4);
@@ -86,13 +91,19 @@ static int mpfs_mbox_send(struct mbox_chan *chan, const void *data)
regmap_write(mbox->control_scb, SERVICES_CR_OFFSET, cmd_shifted);
- do {
- regmap_read(mbox->control_scb, SERVICES_CR_OFFSET, &value);
- } while (SERVICE_CR_REQ_MASK == (value & SERVICE_CR_REQ_MASK));
+ ret = regmap_read_poll_timeout(mbox->control_scb, SERVICES_CR_OFFSET,
+ value, !(value & SERVICE_CR_REQ_MASK),
+ 1, /* poll every 1 µs */
+ 20); /* timeout 20 ms */
+ if (ret)
+ return ret;
- do {
- regmap_read(mbox->control_scb, SERVICES_SR_OFFSET, &value);
- } while (SERVICE_SR_BUSY_MASK == (value & SERVICE_SR_BUSY_MASK));
+ ret = regmap_read_poll_timeout(mbox->control_scb, SERVICES_SR_OFFSET,
+ value, !(value & SERVICE_SR_BUSY_MASK),
+ 1,
+ 20);
+ if (ret)
+ return ret;
msg->response->resp_status = (value >> SERVICE_SR_STATUS_SHIFT);
if (msg->response->resp_status)
diff --git a/drivers/mailbox/renesas-mfis.c b/drivers/mailbox/renesas-mfis.c
index 1e9e8285974..19b801e56a6 100644
--- a/drivers/mailbox/renesas-mfis.c
+++ b/drivers/mailbox/renesas-mfis.c
@@ -29,7 +29,7 @@ static int mfis_send(struct mbox_chan *chan, const void *data)
return 0;
}
-struct mbox_ops mfis_mbox_ops = {
+static const struct mbox_ops mfis_mbox_ops = {
.send = mfis_send,
};
diff --git a/drivers/mailbox/sandbox-mbox.c b/drivers/mailbox/sandbox-mbox.c
index 87e06e492fe..d6ac758c4d8 100644
--- a/drivers/mailbox/sandbox-mbox.c
+++ b/drivers/mailbox/sandbox-mbox.c
@@ -86,7 +86,7 @@ static const struct udevice_id sandbox_mbox_ids[] = {
{ }
};
-struct mbox_ops sandbox_mbox_mbox_ops = {
+static const struct mbox_ops sandbox_mbox_mbox_ops = {
.request = sandbox_mbox_request,
.rfree = sandbox_mbox_free,
.send = sandbox_mbox_send,
diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index dda108735fc..49f7795b3cd 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -147,7 +147,7 @@ static const struct udevice_id stm32_ipcc_ids[] = {
{ }
};
-struct mbox_ops stm32_ipcc_mbox_ops = {
+static const struct mbox_ops stm32_ipcc_mbox_ops = {
.request = stm32_ipcc_request,
.rfree = stm32_ipcc_free,
.send = stm32_ipcc_send,