]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
firmware: scmi: mailbox: Support arm,max_rx_timeout_ms
authorPeng Fan <peng.fan@nxp.com>
Fri, 26 Sep 2025 16:06:20 +0000 (00:06 +0800)
committerTom Rini <trini@konsulko.com>
Thu, 9 Oct 2025 20:16:11 +0000 (14:16 -0600)
Per devicetree bindings:
arm,max-rx-timeout-ms indicates an optional time value, expressed in
milliseconds, representing the transport maximum timeout value for the
receive channel. The value should be a non-zero value if set.

Support this property if platform set it to a non-default value. This
property is a per SCMI property, so all channels share same value.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
drivers/firmware/scmi/mailbox_agent.c

index 32b0fd9f589a30c2bb8bdbe8d655c3d47d0abd5a..16a82f55ab7f7550e7744066cd640b0c439f75eb 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "smt.h"
 
-#define TIMEOUT_US_30MS                        30000
+#define TIMEOUT_30MS                   30
 
 /**
  * struct scmi_mbox_channel - Description of an SCMI mailbox transport
@@ -73,6 +73,7 @@ out:
 
 static int setup_channel(struct udevice *dev, struct scmi_mbox_channel *chan)
 {
+       struct scmi_mbox_channel *base_chan = dev_get_plat(dev);
        int ret;
 
        ret = mbox_get_by_index(dev, 0, &chan->mbox);
@@ -87,7 +88,7 @@ static int setup_channel(struct udevice *dev, struct scmi_mbox_channel *chan)
                return ret;
        }
 
-       chan->timeout_us = TIMEOUT_US_30MS;
+       chan->timeout_us = base_chan->timeout_us;
 
        return 0;
 }
@@ -127,6 +128,9 @@ int scmi_mbox_of_to_plat(struct udevice *dev)
 {
        struct scmi_mbox_channel *chan = dev_get_plat(dev);
 
+       chan->timeout_us = dev_read_u32_default(dev, "arm,max-rx-timeout-ms",
+                                               TIMEOUT_30MS) * 1000;
+
        return setup_channel(dev, chan);
 }