diff options
author | Chris Lew | 2017-10-26 15:28:55 -0700 |
---|---|---|
committer | Bjorn Andersson | 2017-10-30 21:25:04 -0700 |
commit | 073893778dc2f68e41d65d79925ca89db526b4ab (patch) | |
tree | 03fa10264a50b2fcb7bc33e30a9f280ce58fad85 /drivers/rpmsg | |
parent | eace566c3406cac3131d44198f05b7b55f79651f (diff) |
rpmsg: glink: Add support to preallocate intents
The base intents prequeued during channel creation may not satisfy a
channel's throughput requirement. Add support for intents dt-binding to
allow channels to specify the size and amount of intents to prequeue
during endpoint announcement.
Signed-off-by: Chris Lew <clew@codeaurora.org>
[bjorn: Altered how defaults are expressed]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/rpmsg')
-rw-r--r-- | drivers/rpmsg/qcom_glink_native.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index fcd46ab090a7..2dff77882ced 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1149,19 +1149,38 @@ static struct rpmsg_endpoint *qcom_glink_create_ept(struct rpmsg_device *rpdev, static int qcom_glink_announce_create(struct rpmsg_device *rpdev) { struct glink_channel *channel = to_glink_channel(rpdev->ept); - struct glink_core_rx_intent *intent; + struct device_node *np = rpdev->dev.of_node; struct qcom_glink *glink = channel->glink; - int num_intents = glink->intentless ? 0 : 5; + struct glink_core_rx_intent *intent; + const struct property *prop = NULL; + __be32 defaults[] = { cpu_to_be32(SZ_1K), cpu_to_be32(5) }; + int num_intents; + int num_groups = 1; + __be32 *val = defaults; + int size; + + if (glink->intentless) + return 0; + + prop = of_find_property(np, "qcom,intents", NULL); + if (prop) { + val = prop->value; + num_groups = prop->length / sizeof(u32) / 2; + } /* Channel is now open, advertise base set of intents */ - while (num_intents--) { - intent = qcom_glink_alloc_intent(glink, channel, SZ_1K, true); - if (!intent) - break; + while (num_groups--) { + size = be32_to_cpup(val++); + num_intents = be32_to_cpup(val++); + while (num_intents--) { + intent = qcom_glink_alloc_intent(glink, channel, size, + true); + if (!intent) + break; - qcom_glink_advertise_intent(glink, channel, intent); + qcom_glink_advertise_intent(glink, channel, intent); + } } - return 0; } |