Lines Matching full:smp2p

23  * The Shared Memory Point to Point (SMP2P) protocol facilitates communication
32 * single-writer, SMP2P does not require any remote locking mechanisms.
79 * @smp2p: reference to the device driver context
92 struct qcom_smp2p *smp2p; member
151 static void qcom_smp2p_kick(struct qcom_smp2p *smp2p) in qcom_smp2p_kick() argument
156 if (smp2p->mbox_chan) { in qcom_smp2p_kick()
157 mbox_send_message(smp2p->mbox_chan, NULL); in qcom_smp2p_kick()
158 mbox_client_txdone(smp2p->mbox_chan, 0); in qcom_smp2p_kick()
160 regmap_write(smp2p->ipc_regmap, smp2p->ipc_offset, BIT(smp2p->ipc_bit)); in qcom_smp2p_kick()
167 * @data: smp2p driver context
176 struct qcom_smp2p *smp2p = data; in qcom_smp2p_intr() local
177 unsigned smem_id = smp2p->smem_items[SMP2P_INBOUND]; in qcom_smp2p_intr()
178 unsigned pid = smp2p->remote_pid; in qcom_smp2p_intr()
186 in = smp2p->in; in qcom_smp2p_intr()
192 dev_err(smp2p->dev, in qcom_smp2p_intr()
193 "Unable to acquire remote smp2p item\n"); in qcom_smp2p_intr()
197 smp2p->in = in; in qcom_smp2p_intr()
201 for (i = smp2p->valid_entries; i < in->valid_entries; i++) { in qcom_smp2p_intr()
202 list_for_each_entry(entry, &smp2p->inbound, node) { in qcom_smp2p_intr()
210 smp2p->valid_entries = i; in qcom_smp2p_intr()
213 list_for_each_entry(entry, &smp2p->inbound, node) { in qcom_smp2p_intr()
280 .name = "smp2p",
305 static int qcom_smp2p_inbound_entry(struct qcom_smp2p *smp2p, in qcom_smp2p_inbound_entry() argument
311 dev_err(smp2p->dev, "failed to add irq_domain\n"); in qcom_smp2p_inbound_entry()
332 qcom_smp2p_kick(entry->smp2p); in smp2p_update_bits()
341 static int qcom_smp2p_outbound_entry(struct qcom_smp2p *smp2p, in qcom_smp2p_outbound_entry() argument
345 struct smp2p_smem_item *out = smp2p->out; in qcom_smp2p_outbound_entry()
359 dev_err(smp2p->dev, "failed to register qcom_smem_state\n"); in qcom_smp2p_outbound_entry()
366 static int qcom_smp2p_alloc_outbound_item(struct qcom_smp2p *smp2p) in qcom_smp2p_alloc_outbound_item() argument
369 unsigned smem_id = smp2p->smem_items[SMP2P_OUTBOUND]; in qcom_smp2p_alloc_outbound_item()
370 unsigned pid = smp2p->remote_pid; in qcom_smp2p_alloc_outbound_item()
376 dev_err(smp2p->dev, in qcom_smp2p_alloc_outbound_item()
377 "unable to allocate local smp2p item\n"); in qcom_smp2p_alloc_outbound_item()
383 dev_err(smp2p->dev, "Unable to acquire local smp2p item\n"); in qcom_smp2p_alloc_outbound_item()
389 out->local_pid = smp2p->local_pid; in qcom_smp2p_alloc_outbound_item()
390 out->remote_pid = smp2p->remote_pid; in qcom_smp2p_alloc_outbound_item()
401 qcom_smp2p_kick(smp2p); in qcom_smp2p_alloc_outbound_item()
403 smp2p->out = out; in qcom_smp2p_alloc_outbound_item()
408 static int smp2p_parse_ipc(struct qcom_smp2p *smp2p) in smp2p_parse_ipc() argument
411 struct device *dev = smp2p->dev; in smp2p_parse_ipc()
421 smp2p->ipc_regmap = syscon_node_to_regmap(syscon); in smp2p_parse_ipc()
422 if (IS_ERR(smp2p->ipc_regmap)) in smp2p_parse_ipc()
423 return PTR_ERR(smp2p->ipc_regmap); in smp2p_parse_ipc()
426 ret = of_property_read_u32_index(dev->of_node, key, 1, &smp2p->ipc_offset); in smp2p_parse_ipc()
432 ret = of_property_read_u32_index(dev->of_node, key, 2, &smp2p->ipc_bit); in smp2p_parse_ipc()
445 struct qcom_smp2p *smp2p; in qcom_smp2p_probe() local
450 smp2p = devm_kzalloc(&pdev->dev, sizeof(*smp2p), GFP_KERNEL); in qcom_smp2p_probe()
451 if (!smp2p) in qcom_smp2p_probe()
454 smp2p->dev = &pdev->dev; in qcom_smp2p_probe()
455 INIT_LIST_HEAD(&smp2p->inbound); in qcom_smp2p_probe()
456 INIT_LIST_HEAD(&smp2p->outbound); in qcom_smp2p_probe()
458 platform_set_drvdata(pdev, smp2p); in qcom_smp2p_probe()
462 smp2p->smem_items, 2); in qcom_smp2p_probe()
467 ret = of_property_read_u32(pdev->dev.of_node, key, &smp2p->local_pid); in qcom_smp2p_probe()
472 ret = of_property_read_u32(pdev->dev.of_node, key, &smp2p->remote_pid); in qcom_smp2p_probe()
480 smp2p->mbox_client.dev = &pdev->dev; in qcom_smp2p_probe()
481 smp2p->mbox_client.knows_txdone = true; in qcom_smp2p_probe()
482 smp2p->mbox_chan = mbox_request_channel(&smp2p->mbox_client, 0); in qcom_smp2p_probe()
483 if (IS_ERR(smp2p->mbox_chan)) { in qcom_smp2p_probe()
484 if (PTR_ERR(smp2p->mbox_chan) != -ENODEV) in qcom_smp2p_probe()
485 return PTR_ERR(smp2p->mbox_chan); in qcom_smp2p_probe()
487 smp2p->mbox_chan = NULL; in qcom_smp2p_probe()
489 ret = smp2p_parse_ipc(smp2p); in qcom_smp2p_probe()
494 ret = qcom_smp2p_alloc_outbound_item(smp2p); in qcom_smp2p_probe()
505 entry->smp2p = smp2p; in qcom_smp2p_probe()
513 ret = qcom_smp2p_inbound_entry(smp2p, entry, node); in qcom_smp2p_probe()
517 list_add(&entry->node, &smp2p->inbound); in qcom_smp2p_probe()
519 ret = qcom_smp2p_outbound_entry(smp2p, entry, node); in qcom_smp2p_probe()
523 list_add(&entry->node, &smp2p->outbound); in qcom_smp2p_probe()
528 qcom_smp2p_kick(smp2p); in qcom_smp2p_probe()
533 "smp2p", (void *)smp2p); in qcom_smp2p_probe()
543 list_for_each_entry(entry, &smp2p->inbound, node) in qcom_smp2p_probe()
546 list_for_each_entry(entry, &smp2p->outbound, node) in qcom_smp2p_probe()
549 smp2p->out->valid_entries = 0; in qcom_smp2p_probe()
552 mbox_free_channel(smp2p->mbox_chan); in qcom_smp2p_probe()
563 struct qcom_smp2p *smp2p = platform_get_drvdata(pdev); in qcom_smp2p_remove() local
566 list_for_each_entry(entry, &smp2p->inbound, node) in qcom_smp2p_remove()
569 list_for_each_entry(entry, &smp2p->outbound, node) in qcom_smp2p_remove()
572 mbox_free_channel(smp2p->mbox_chan); in qcom_smp2p_remove()
574 smp2p->out->valid_entries = 0; in qcom_smp2p_remove()
580 { .compatible = "qcom,smp2p" },