Lines Matching full:scp

23  * @scp:	mtk_scp structure
28 * Register an ipi function to receive ipi interrupt from SCP.
32 int scp_ipi_register(struct mtk_scp *scp, in scp_ipi_register() argument
37 if (!scp) in scp_ipi_register()
43 scp_ipi_lock(scp, id); in scp_ipi_register()
44 scp->ipi_desc[id].handler = handler; in scp_ipi_register()
45 scp->ipi_desc[id].priv = priv; in scp_ipi_register()
46 scp_ipi_unlock(scp, id); in scp_ipi_register()
55 * @scp: mtk_scp structure
58 * Unregister an ipi function to receive ipi interrupt from SCP.
60 void scp_ipi_unregister(struct mtk_scp *scp, u32 id) in scp_ipi_unregister() argument
62 if (!scp) in scp_ipi_unregister()
68 scp_ipi_lock(scp, id); in scp_ipi_unregister()
69 scp->ipi_desc[id].handler = NULL; in scp_ipi_unregister()
70 scp->ipi_desc[id].priv = NULL; in scp_ipi_unregister()
71 scp_ipi_unlock(scp, id); in scp_ipi_unregister()
76 * scp_memcpy_aligned() - Copy src to dst, where dst is in SCP SRAM region.
78 * @dst: Pointer to the destination buffer, should be in SCP SRAM region.
82 * Since AP access of SCP SRAM don't support byte write, this always write a
114 * @scp: mtk_scp structure
119 void scp_ipi_lock(struct mtk_scp *scp, u32 id) in scp_ipi_lock() argument
123 mutex_lock(&scp->ipi_desc[id].lock); in scp_ipi_lock()
130 * @scp: mtk_scp structure
135 void scp_ipi_unlock(struct mtk_scp *scp, u32 id) in scp_ipi_unlock() argument
139 mutex_unlock(&scp->ipi_desc[id].lock); in scp_ipi_unlock()
144 * scp_ipi_send() - send data from AP to scp.
146 * @scp: mtk_scp structure
153 * SCP has received the data and starts the processing.
159 int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len, in scp_ipi_send() argument
162 struct mtk_share_obj __iomem *send_obj = scp->send_buf; in scp_ipi_send()
167 scp_sizes = scp->data->scp_sizes; in scp_ipi_send()
174 ret = clk_prepare_enable(scp->clk); in scp_ipi_send()
176 dev_err(scp->dev, "failed to enable clock\n"); in scp_ipi_send()
180 mutex_lock(&scp->send_lock); in scp_ipi_send()
182 /* Wait until SCP receives the last command */ in scp_ipi_send()
183 ret = readl_poll_timeout_atomic(scp->cluster->reg_base + scp->data->host_to_scp_reg, in scp_ipi_send()
186 dev_err(scp->dev, "%s: IPI timeout!\n", __func__); in scp_ipi_send()
195 scp->ipi_id_ack[id] = false; in scp_ipi_send()
196 /* send the command to SCP */ in scp_ipi_send()
197 writel(scp->data->host_to_scp_int_bit, in scp_ipi_send()
198 scp->cluster->reg_base + scp->data->host_to_scp_reg); in scp_ipi_send()
201 /* wait for SCP's ACK */ in scp_ipi_send()
202 ret = wait_event_timeout(scp->ack_wq, in scp_ipi_send()
203 scp->ipi_id_ack[id], in scp_ipi_send()
205 scp->ipi_id_ack[id] = false; in scp_ipi_send()
206 if (WARN(!ret, "scp ipi %d ack time out !", id)) in scp_ipi_send()
213 mutex_unlock(&scp->send_lock); in scp_ipi_send()
214 clk_disable_unprepare(scp->clk); in scp_ipi_send()
221 MODULE_DESCRIPTION("MediaTek scp IPI interface");