Lines Matching +full:scmi +full:- +full:shmem
1 // SPDX-License-Identifier: GPL-2.0
3 * System Control and Management Interface (SCMI) Message SMC/HVC
9 #include <linux/arm-smccc.h>
24 * struct scmi_smc - Structure representing a SCMI smc transport
26 * @cinfo: SCMI channel info
27 * @shmem: Transmit/Receive shared memory area
37 struct scmi_shared_mem __iomem *shmem; member
38 /* Protect access to shmem area */
49 scmi_rx_callback(scmi_info->cinfo, in smc_msg_done_isr()
50 shmem_read_header(scmi_info->shmem), NULL); in smc_msg_done_isr()
57 struct device_node *np = of_parse_phandle(dev->of_node, "shmem", 0); in smc_chan_available()
68 atomic_set(&scmi_info->inflight, INFLIGHT_NONE); in smc_channel_lock_init()
70 mutex_init(&scmi_info->shmem_lock); in smc_channel_lock_init()
77 ret = atomic_cmpxchg(inflight, INFLIGHT_NONE, xfer->hdr.seq); in smc_xfer_inflight()
87 spin_until_cond(smc_xfer_inflight(xfer, &scmi_info->inflight)); in smc_channel_lock_acquire()
89 mutex_lock(&scmi_info->shmem_lock); in smc_channel_lock_acquire()
95 atomic_set(&scmi_info->inflight, INFLIGHT_NONE); in smc_channel_lock_release()
97 mutex_unlock(&scmi_info->shmem_lock); in smc_channel_lock_release()
103 struct device *cdev = cinfo->dev; in smc_chan_setup()
112 return -ENODEV; in smc_chan_setup()
116 return -ENOMEM; in smc_chan_setup()
118 np = of_parse_phandle(cdev->of_node, "shmem", 0); in smc_chan_setup()
119 if (!of_device_is_compatible(np, "arm,scmi-shmem")) in smc_chan_setup()
120 return -ENXIO; in smc_chan_setup()
125 dev_err(cdev, "failed to get SCMI Tx shared memory\n"); in smc_chan_setup()
130 scmi_info->shmem = devm_ioremap(dev, res.start, size); in smc_chan_setup()
131 if (!scmi_info->shmem) { in smc_chan_setup()
132 dev_err(dev, "failed to ioremap SCMI Tx shared memory\n"); in smc_chan_setup()
133 return -EADDRNOTAVAIL; in smc_chan_setup()
136 ret = of_property_read_u32(dev->of_node, "arm,smc-id", &func_id); in smc_chan_setup()
145 irq = of_irq_get_byname(cdev->of_node, "a2p"); in smc_chan_setup()
151 dev_err(dev, "failed to setup SCMI smc irq\n"); in smc_chan_setup()
155 cinfo->no_completion_irq = true; in smc_chan_setup()
158 scmi_info->func_id = func_id; in smc_chan_setup()
159 scmi_info->cinfo = cinfo; in smc_chan_setup()
161 cinfo->transport_info = scmi_info; in smc_chan_setup()
169 struct scmi_smc *scmi_info = cinfo->transport_info; in smc_chan_free()
171 cinfo->transport_info = NULL; in smc_chan_free()
172 scmi_info->cinfo = NULL; in smc_chan_free()
182 struct scmi_smc *scmi_info = cinfo->transport_info; in smc_send_message()
191 shmem_tx_prepare(scmi_info->shmem, xfer, cinfo); in smc_send_message()
193 arm_smccc_1_1_invoke(scmi_info->func_id, 0, 0, 0, 0, 0, 0, 0, &res); in smc_send_message()
198 return -EOPNOTSUPP; in smc_send_message()
207 struct scmi_smc *scmi_info = cinfo->transport_info; in smc_fetch_response()
209 shmem_fetch_response(scmi_info->shmem, xfer); in smc_fetch_response()
215 struct scmi_smc *scmi_info = cinfo->transport_info; in smc_mark_txdone()
237 * SCMI command would have been already fully processed by the SCMI