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
152 static void qcom_smp2p_kick(struct qcom_smp2p *smp2p) in qcom_smp2p_kick() argument
157 if (smp2p->mbox_chan) { in qcom_smp2p_kick()
158 mbox_send_message(smp2p->mbox_chan, NULL); in qcom_smp2p_kick()
159 mbox_client_txdone(smp2p->mbox_chan, 0); in qcom_smp2p_kick()
161 regmap_write(smp2p->ipc_regmap, smp2p->ipc_offset, BIT(smp2p->ipc_bit)); in qcom_smp2p_kick()
168 * @data: smp2p driver context
177 struct qcom_smp2p *smp2p = data; in qcom_smp2p_intr() local
178 unsigned smem_id = smp2p->smem_items[SMP2P_INBOUND]; in qcom_smp2p_intr()
179 unsigned pid = smp2p->remote_pid; in qcom_smp2p_intr()
187 in = smp2p->in; in qcom_smp2p_intr()
193 dev_err(smp2p->dev, in qcom_smp2p_intr()
194 "Unable to acquire remote smp2p item\n"); in qcom_smp2p_intr()
198 smp2p->in = in; in qcom_smp2p_intr()
202 for (i = smp2p->valid_entries; i < in->valid_entries; i++) { in qcom_smp2p_intr()
203 list_for_each_entry(entry, &smp2p->inbound, node) { in qcom_smp2p_intr()
211 smp2p->valid_entries = i; in qcom_smp2p_intr()
214 list_for_each_entry(entry, &smp2p->inbound, node) { in qcom_smp2p_intr()
281 .name = "smp2p",
306 static int qcom_smp2p_inbound_entry(struct qcom_smp2p *smp2p, in qcom_smp2p_inbound_entry() argument
312 dev_err(smp2p->dev, "failed to add irq_domain\n"); in qcom_smp2p_inbound_entry()
334 qcom_smp2p_kick(entry->smp2p); in smp2p_update_bits()
343 static int qcom_smp2p_outbound_entry(struct qcom_smp2p *smp2p, in qcom_smp2p_outbound_entry() argument
347 struct smp2p_smem_item *out = smp2p->out; in qcom_smp2p_outbound_entry()
361 dev_err(smp2p->dev, "failed to register qcom_smem_state\n"); in qcom_smp2p_outbound_entry()
368 static int qcom_smp2p_alloc_outbound_item(struct qcom_smp2p *smp2p) in qcom_smp2p_alloc_outbound_item() argument
371 unsigned smem_id = smp2p->smem_items[SMP2P_OUTBOUND]; in qcom_smp2p_alloc_outbound_item()
372 unsigned pid = smp2p->remote_pid; in qcom_smp2p_alloc_outbound_item()
378 dev_err(smp2p->dev, in qcom_smp2p_alloc_outbound_item()
379 "unable to allocate local smp2p item\n"); in qcom_smp2p_alloc_outbound_item()
385 dev_err(smp2p->dev, "Unable to acquire local smp2p item\n"); in qcom_smp2p_alloc_outbound_item()
391 out->local_pid = smp2p->local_pid; in qcom_smp2p_alloc_outbound_item()
392 out->remote_pid = smp2p->remote_pid; in qcom_smp2p_alloc_outbound_item()
403 qcom_smp2p_kick(smp2p); in qcom_smp2p_alloc_outbound_item()
405 smp2p->out = out; in qcom_smp2p_alloc_outbound_item()
410 static int smp2p_parse_ipc(struct qcom_smp2p *smp2p) in smp2p_parse_ipc() argument
413 struct device *dev = smp2p->dev; in smp2p_parse_ipc()
423 smp2p->ipc_regmap = syscon_node_to_regmap(syscon); in smp2p_parse_ipc()
424 if (IS_ERR(smp2p->ipc_regmap)) in smp2p_parse_ipc()
425 return PTR_ERR(smp2p->ipc_regmap); in smp2p_parse_ipc()
428 ret = of_property_read_u32_index(dev->of_node, key, 1, &smp2p->ipc_offset); in smp2p_parse_ipc()
434 ret = of_property_read_u32_index(dev->of_node, key, 2, &smp2p->ipc_bit); in smp2p_parse_ipc()
447 struct qcom_smp2p *smp2p; in qcom_smp2p_probe() local
452 smp2p = devm_kzalloc(&pdev->dev, sizeof(*smp2p), GFP_KERNEL); in qcom_smp2p_probe()
453 if (!smp2p) in qcom_smp2p_probe()
456 smp2p->dev = &pdev->dev; in qcom_smp2p_probe()
457 INIT_LIST_HEAD(&smp2p->inbound); in qcom_smp2p_probe()
458 INIT_LIST_HEAD(&smp2p->outbound); in qcom_smp2p_probe()
460 platform_set_drvdata(pdev, smp2p); in qcom_smp2p_probe()
464 smp2p->smem_items, 2); in qcom_smp2p_probe()
469 ret = of_property_read_u32(pdev->dev.of_node, key, &smp2p->local_pid); in qcom_smp2p_probe()
474 ret = of_property_read_u32(pdev->dev.of_node, key, &smp2p->remote_pid); in qcom_smp2p_probe()
482 smp2p->mbox_client.dev = &pdev->dev; in qcom_smp2p_probe()
483 smp2p->mbox_client.knows_txdone = true; in qcom_smp2p_probe()
484 smp2p->mbox_chan = mbox_request_channel(&smp2p->mbox_client, 0); in qcom_smp2p_probe()
485 if (IS_ERR(smp2p->mbox_chan)) { in qcom_smp2p_probe()
486 if (PTR_ERR(smp2p->mbox_chan) != -ENODEV) in qcom_smp2p_probe()
487 return PTR_ERR(smp2p->mbox_chan); in qcom_smp2p_probe()
489 smp2p->mbox_chan = NULL; in qcom_smp2p_probe()
491 ret = smp2p_parse_ipc(smp2p); in qcom_smp2p_probe()
496 ret = qcom_smp2p_alloc_outbound_item(smp2p); in qcom_smp2p_probe()
507 entry->smp2p = smp2p; in qcom_smp2p_probe()
515 ret = qcom_smp2p_inbound_entry(smp2p, entry, node); in qcom_smp2p_probe()
519 list_add(&entry->node, &smp2p->inbound); in qcom_smp2p_probe()
521 ret = qcom_smp2p_outbound_entry(smp2p, entry, node); in qcom_smp2p_probe()
525 list_add(&entry->node, &smp2p->outbound); in qcom_smp2p_probe()
530 qcom_smp2p_kick(smp2p); in qcom_smp2p_probe()
535 "smp2p", (void *)smp2p); in qcom_smp2p_probe()
545 list_for_each_entry(entry, &smp2p->inbound, node) in qcom_smp2p_probe()
548 list_for_each_entry(entry, &smp2p->outbound, node) in qcom_smp2p_probe()
551 smp2p->out->valid_entries = 0; in qcom_smp2p_probe()
554 mbox_free_channel(smp2p->mbox_chan); in qcom_smp2p_probe()
565 struct qcom_smp2p *smp2p = platform_get_drvdata(pdev); in qcom_smp2p_remove() local
568 list_for_each_entry(entry, &smp2p->inbound, node) in qcom_smp2p_remove()
571 list_for_each_entry(entry, &smp2p->outbound, node) in qcom_smp2p_remove()
574 mbox_free_channel(smp2p->mbox_chan); in qcom_smp2p_remove()
576 smp2p->out->valid_entries = 0; in qcom_smp2p_remove()
582 { .compatible = "qcom,smp2p" },