Lines Matching full:scp
19 * @scp: mtk_scp structure
24 * Register an ipi function to receive ipi interrupt from SCP.
28 int scp_ipi_register(struct mtk_scp *scp, in scp_ipi_register() argument
33 if (!scp) in scp_ipi_register()
39 scp_ipi_lock(scp, id); in scp_ipi_register()
40 scp->ipi_desc[id].handler = handler; in scp_ipi_register()
41 scp->ipi_desc[id].priv = priv; in scp_ipi_register()
42 scp_ipi_unlock(scp, id); in scp_ipi_register()
51 * @scp: mtk_scp structure
54 * Unregister an ipi function to receive ipi interrupt from SCP.
56 void scp_ipi_unregister(struct mtk_scp *scp, u32 id) in scp_ipi_unregister() argument
58 if (!scp) in scp_ipi_unregister()
64 scp_ipi_lock(scp, id); in scp_ipi_unregister()
65 scp->ipi_desc[id].handler = NULL; in scp_ipi_unregister()
66 scp->ipi_desc[id].priv = NULL; in scp_ipi_unregister()
67 scp_ipi_unlock(scp, id); in scp_ipi_unregister()
72 * scp_memcpy_aligned() - Copy src to dst, where dst is in SCP SRAM region.
74 * @dst: Pointer to the destination buffer, should be in SCP SRAM region.
78 * Since AP access of SCP SRAM don't support byte write, this always write a
110 * @scp: mtk_scp structure
115 void scp_ipi_lock(struct mtk_scp *scp, u32 id) in scp_ipi_lock() argument
119 mutex_lock(&scp->ipi_desc[id].lock); in scp_ipi_lock()
126 * @scp: mtk_scp structure
131 void scp_ipi_unlock(struct mtk_scp *scp, u32 id) in scp_ipi_unlock() argument
135 mutex_unlock(&scp->ipi_desc[id].lock); in scp_ipi_unlock()
140 * scp_ipi_send() - send data from AP to scp.
142 * @scp: mtk_scp structure
149 * SCP has received the data and starts the processing.
155 int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len, in scp_ipi_send() argument
158 struct mtk_share_obj __iomem *send_obj = scp->send_buf; in scp_ipi_send()
167 mutex_lock(&scp->send_lock); in scp_ipi_send()
169 ret = clk_prepare_enable(scp->clk); in scp_ipi_send()
171 dev_err(scp->dev, "failed to enable clock\n"); in scp_ipi_send()
175 /* Wait until SCP receives the last command */ in scp_ipi_send()
179 dev_err(scp->dev, "%s: IPI timeout!\n", __func__); in scp_ipi_send()
183 } while (readl(scp->reg_base + scp->data->host_to_scp_reg)); in scp_ipi_send()
190 scp->ipi_id_ack[id] = false; in scp_ipi_send()
191 /* send the command to SCP */ in scp_ipi_send()
192 writel(scp->data->host_to_scp_int_bit, in scp_ipi_send()
193 scp->reg_base + scp->data->host_to_scp_reg); in scp_ipi_send()
196 /* wait for SCP's ACK */ in scp_ipi_send()
198 ret = wait_event_timeout(scp->ack_wq, in scp_ipi_send()
199 scp->ipi_id_ack[id], in scp_ipi_send()
201 scp->ipi_id_ack[id] = false; in scp_ipi_send()
202 if (WARN(!ret, "scp ipi %d ack time out !", id)) in scp_ipi_send()
209 clk_disable_unprepare(scp->clk); in scp_ipi_send()
211 mutex_unlock(&scp->send_lock); in scp_ipi_send()
218 MODULE_DESCRIPTION("MediaTek scp IPI interface");