回复: [PATCH] mailbox: Allow operation without .recv callback
Alice Guo (OSS)
alice.guo at oss.nxp.com
Wed Oct 29 10:08:51 CET 2025
> -----邮件原件-----
> 发件人: U-Boot <u-boot-bounces at lists.denx.de> 代表 Marek Vasut
> 发送时间: 2025年10月28日 0:39
> 收件人: u-boot at lists.denx.de
> 抄送: Marek Vasut <marek.vasut+renesas at mailbox.org>; Alice Guo
> <alice.guo at nxp.com>; Jamie Gibbons <jamie.gibbons at microchip.com>;
> Nobuhiro Iwamatsu <iwamatsu at nigauri.org>; Peng Fan <peng.fan at nxp.com>;
> Tom Rini <trini at konsulko.com>; Tuyen Dang <tuyen.dang.xa at renesas.com>;
> Viorel Suman <viorel.suman at nxp.com>; Ye Li <ye.li at nxp.com>
> 主题: [PATCH] mailbox: Allow operation without .recv callback
>
> Some shared memory mailboxes may have empty receive operation, because
> the data are polled by upper layers directly from the shared memory region, and
> there is no completion interrupt or bit of any sort. Allow empty .recv callback,
> and if the .recv callback is empty, exit from mbox_recv() right away, because any
> polling for completion here would be meaningless.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
> ---
> Cc: Alice Guo <alice.guo at nxp.com>
> Cc: Jamie Gibbons <jamie.gibbons at microchip.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
> Cc: Peng Fan <peng.fan at nxp.com>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Tuyen Dang <tuyen.dang.xa at renesas.com>
> Cc: Viorel Suman <viorel.suman at nxp.com>
> Cc: Ye Li <ye.li at nxp.com>
> Cc: u-boot at lists.denx.de
> ---
> drivers/mailbox/mailbox-uclass.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/mailbox/mailbox-uclass.c b/drivers/mailbox/mailbox-uclass.c
> index 4bf4987ce0a..fef437a4281 100644
> --- a/drivers/mailbox/mailbox-uclass.c
> +++ b/drivers/mailbox/mailbox-uclass.c
> @@ -132,6 +132,15 @@ int mbox_recv(struct mbox_chan *chan, void *data,
> ulong timeout_us)
> debug("%s(chan=%p, data=%p, timeout_us=%ld)\n", __func__, chan, data,
> timeout_us);
>
> + /*
> + * Some shared memory mailboxes may have empty receive operation,
> + * because the data are polled by upper layers directly from the
> + * shared memory region, and there is no completion interrupt or
> + * bit of any sort.
> + */
> + if (!ops->recv)
> + return 0;
> +
> start_time = timer_get_us();
> /*
> * Account for partial us ticks, but if timeout_us is 0, ensure we
> --
> 2.51.0
Reviewed-by: Alice Guo <alice.guo at nxp.com>
More information about the U-Boot
mailing list