aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 23:12:08 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 23:12:08 -0500
commitbedf571986990046ddc4578e6378de146cf75b9e (patch)
tree60ceae16db9c3b5efbe8d53fab4ecf3499ccc1bb
parentd9ef1ccf7cf1210d5ca49c652045bc03c97c8b59 (diff)
parent38a9acb3bb7b2561a08144ff80a292889f389a9b (diff)
Merge tag 'rpmsg-v4.15' of git://github.com/andersson/remoteproc
Pull rpmsg updates from Bjorn Andersson: - turn RPMSG_VIRTIO into a user selectable config - fix few bugs in GLINK - provide the support for specifying initial buffer sizes for GLINK channels. * tag 'rpmsg-v4.15' of git://github.com/andersson/remoteproc: rpmsg: glink: The mbox client knows_txdone rpmsg: glink: Add missing MODULE_LICENSE rpmsg: glink: Use best fit intent during tx rpmsg: glink: Add support to preallocate intents dt-bindings: soc: qcom: Support GLINK intents rpmsg: glink: Initialize the "intent_req_comp" completion variable rpmsg: Allow RPMSG_VIRTIO to be enabled via menuconfig or defconfig
-rw-r--r--Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt10
-rw-r--r--drivers/remoteproc/Kconfig4
-rw-r--r--drivers/rpmsg/Kconfig3
-rw-r--r--drivers/rpmsg/qcom_glink_native.c51
4 files changed, 52 insertions, 16 deletions
diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
index b277eca861f7..9663cab52246 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
@@ -39,6 +39,14 @@ of these nodes are defined by the individual bindings for the specific function
39 Definition: a list of channels tied to this function, used for matching 39 Definition: a list of channels tied to this function, used for matching
40 the function to a set of virtual channels 40 the function to a set of virtual channels
41 41
42- qcom,intents:
43 Usage: optional
44 Value type: <prop-encoded-array>
45 Definition: a list of size,amount pairs describing what intents should
46 be preallocated for this virtual channel. This can be used
47 to tweak the default intents available for the channel to
48 meet expectations of the remote.
49
42= EXAMPLE 50= EXAMPLE
43The following example represents the GLINK RPM node on a MSM8996 device, with 51The following example represents the GLINK RPM node on a MSM8996 device, with
44the function for the "rpm_request" channel defined, which is used for 52the function for the "rpm_request" channel defined, which is used for
@@ -69,6 +77,8 @@ regualtors and root clocks.
69 compatible = "qcom,rpm-msm8996"; 77 compatible = "qcom,rpm-msm8996";
70 qcom,glink-channels = "rpm_requests"; 78 qcom,glink-channels = "rpm_requests";
71 79
80 qcom,intents = <0x400 5
81 0x800 1>;
72 ... 82 ...
73 }; 83 };
74 }; 84 };
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index bf04479456a0..b609e1d3654b 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -28,7 +28,6 @@ config OMAP_REMOTEPROC
28 depends on OMAP_IOMMU 28 depends on OMAP_IOMMU
29 select MAILBOX 29 select MAILBOX
30 select OMAP2PLUS_MBOX 30 select OMAP2PLUS_MBOX
31 select RPMSG_VIRTIO
32 help 31 help
33 Say y here to support OMAP's remote processors (dual M3 32 Say y here to support OMAP's remote processors (dual M3
34 and DSP on OMAP4) via the remote processor framework. 33 and DSP on OMAP4) via the remote processor framework.
@@ -58,7 +57,6 @@ config DA8XX_REMOTEPROC
58 tristate "DA8xx/OMAP-L13x remoteproc support" 57 tristate "DA8xx/OMAP-L13x remoteproc support"
59 depends on ARCH_DAVINCI_DA8XX 58 depends on ARCH_DAVINCI_DA8XX
60 depends on DMA_CMA 59 depends on DMA_CMA
61 select RPMSG_VIRTIO
62 help 60 help
63 Say y here to support DA8xx/OMAP-L13x remote processors via the 61 Say y here to support DA8xx/OMAP-L13x remote processors via the
64 remote processor framework. 62 remote processor framework.
@@ -79,7 +77,6 @@ config DA8XX_REMOTEPROC
79config KEYSTONE_REMOTEPROC 77config KEYSTONE_REMOTEPROC
80 tristate "Keystone Remoteproc support" 78 tristate "Keystone Remoteproc support"
81 depends on ARCH_KEYSTONE 79 depends on ARCH_KEYSTONE
82 select RPMSG_VIRTIO
83 help 80 help
84 Say Y here here to support Keystone remote processors (DSP) 81 Say Y here here to support Keystone remote processors (DSP)
85 via the remote processor framework. 82 via the remote processor framework.
@@ -135,7 +132,6 @@ config ST_REMOTEPROC
135 depends on ARCH_STI 132 depends on ARCH_STI
136 select MAILBOX 133 select MAILBOX
137 select STI_MBOX 134 select STI_MBOX
138 select RPMSG_VIRTIO
139 help 135 help
140 Say y here to support ST's adjunct processors via the remote 136 Say y here to support ST's adjunct processors via the remote
141 processor framework. 137 processor framework.
diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig
index 0fe6eac46512..65a9f6b892f0 100644
--- a/drivers/rpmsg/Kconfig
+++ b/drivers/rpmsg/Kconfig
@@ -47,7 +47,8 @@ config RPMSG_QCOM_SMD
47 platforms. 47 platforms.
48 48
49config RPMSG_VIRTIO 49config RPMSG_VIRTIO
50 tristate 50 tristate "Virtio RPMSG bus driver"
51 depends on HAS_DMA
51 select RPMSG 52 select RPMSG
52 select VIRTIO 53 select VIRTIO
53 54
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 5dcc9bf1c5bc..40d76d2a5eff 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -227,6 +227,7 @@ static struct glink_channel *qcom_glink_alloc_channel(struct qcom_glink *glink,
227 227
228 init_completion(&channel->open_req); 228 init_completion(&channel->open_req);
229 init_completion(&channel->open_ack); 229 init_completion(&channel->open_ack);
230 init_completion(&channel->intent_req_comp);
230 231
231 INIT_LIST_HEAD(&channel->done_intents); 232 INIT_LIST_HEAD(&channel->done_intents);
232 INIT_WORK(&channel->intent_work, qcom_glink_rx_done_work); 233 INIT_WORK(&channel->intent_work, qcom_glink_rx_done_work);
@@ -1148,19 +1149,38 @@ static struct rpmsg_endpoint *qcom_glink_create_ept(struct rpmsg_device *rpdev,
1148static int qcom_glink_announce_create(struct rpmsg_device *rpdev) 1149static int qcom_glink_announce_create(struct rpmsg_device *rpdev)
1149{ 1150{
1150 struct glink_channel *channel = to_glink_channel(rpdev->ept); 1151 struct glink_channel *channel = to_glink_channel(rpdev->ept);
1151 struct glink_core_rx_intent *intent; 1152 struct device_node *np = rpdev->dev.of_node;
1152 struct qcom_glink *glink = channel->glink; 1153 struct qcom_glink *glink = channel->glink;
1153 int num_intents = glink->intentless ? 0 : 5; 1154 struct glink_core_rx_intent *intent;
1155 const struct property *prop = NULL;
1156 __be32 defaults[] = { cpu_to_be32(SZ_1K), cpu_to_be32(5) };
1157 int num_intents;
1158 int num_groups = 1;
1159 __be32 *val = defaults;
1160 int size;
1161
1162 if (glink->intentless)
1163 return 0;
1164
1165 prop = of_find_property(np, "qcom,intents", NULL);
1166 if (prop) {
1167 val = prop->value;
1168 num_groups = prop->length / sizeof(u32) / 2;
1169 }
1154 1170
1155 /* Channel is now open, advertise base set of intents */ 1171 /* Channel is now open, advertise base set of intents */
1156 while (num_intents--) { 1172 while (num_groups--) {
1157 intent = qcom_glink_alloc_intent(glink, channel, SZ_1K, true); 1173 size = be32_to_cpup(val++);
1158 if (!intent) 1174 num_intents = be32_to_cpup(val++);
1159 break; 1175 while (num_intents--) {
1176 intent = qcom_glink_alloc_intent(glink, channel, size,
1177 true);
1178 if (!intent)
1179 break;
1160 1180
1161 qcom_glink_advertise_intent(glink, channel, intent); 1181 qcom_glink_advertise_intent(glink, channel, intent);
1182 }
1162 } 1183 }
1163
1164 return 0; 1184 return 0;
1165} 1185}
1166 1186
@@ -1237,11 +1257,16 @@ static int __qcom_glink_send(struct glink_channel *channel,
1237 spin_lock_irqsave(&channel->intent_lock, flags); 1257 spin_lock_irqsave(&channel->intent_lock, flags);
1238 idr_for_each_entry(&channel->riids, tmp, iid) { 1258 idr_for_each_entry(&channel->riids, tmp, iid) {
1239 if (tmp->size >= len && !tmp->in_use) { 1259 if (tmp->size >= len && !tmp->in_use) {
1240 tmp->in_use = true; 1260 if (!intent)
1241 intent = tmp; 1261 intent = tmp;
1242 break; 1262 else if (intent->size > tmp->size)
1263 intent = tmp;
1264 if (intent->size == len)
1265 break;
1243 } 1266 }
1244 } 1267 }
1268 if (intent)
1269 intent->in_use = true;
1245 spin_unlock_irqrestore(&channel->intent_lock, flags); 1270 spin_unlock_irqrestore(&channel->intent_lock, flags);
1246 1271
1247 /* We found an available intent */ 1272 /* We found an available intent */
@@ -1551,6 +1576,7 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev,
1551 idr_init(&glink->rcids); 1576 idr_init(&glink->rcids);
1552 1577
1553 glink->mbox_client.dev = dev; 1578 glink->mbox_client.dev = dev;
1579 glink->mbox_client.knows_txdone = true;
1554 glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0); 1580 glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0);
1555 if (IS_ERR(glink->mbox_chan)) { 1581 if (IS_ERR(glink->mbox_chan)) {
1556 if (PTR_ERR(glink->mbox_chan) != -EPROBE_DEFER) 1582 if (PTR_ERR(glink->mbox_chan) != -EPROBE_DEFER)
@@ -1616,3 +1642,6 @@ void qcom_glink_native_unregister(struct qcom_glink *glink)
1616 device_unregister(glink->dev); 1642 device_unregister(glink->dev);
1617} 1643}
1618EXPORT_SYMBOL_GPL(qcom_glink_native_unregister); 1644EXPORT_SYMBOL_GPL(qcom_glink_native_unregister);
1645
1646MODULE_DESCRIPTION("Qualcomm GLINK driver");
1647MODULE_LICENSE("GPL v2");