xref: /OK3568_Linux_fs/kernel/include/linux/remoteproc/mtk_scp.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (c) 2019 MediaTek Inc.
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun #ifndef _MTK_SCP_H
7*4882a593Smuzhiyun #define _MTK_SCP_H
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #include <linux/platform_device.h>
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun typedef void (*scp_ipi_handler_t) (void *data,
12*4882a593Smuzhiyun 				   unsigned int len,
13*4882a593Smuzhiyun 				   void *priv);
14*4882a593Smuzhiyun struct mtk_scp;
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun /**
17*4882a593Smuzhiyun  * enum ipi_id - the id of inter-processor interrupt
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * @SCP_IPI_INIT:	 The interrupt from scp is to notfiy kernel
20*4882a593Smuzhiyun  *			 SCP initialization completed.
21*4882a593Smuzhiyun  *			 IPI_SCP_INIT is sent from SCP when firmware is
22*4882a593Smuzhiyun  *			 loaded. AP doesn't need to send IPI_SCP_INIT
23*4882a593Smuzhiyun  *			 command to SCP.
24*4882a593Smuzhiyun  *			 For other IPI below, AP should send the request
25*4882a593Smuzhiyun  *			 to SCP to trigger the interrupt.
26*4882a593Smuzhiyun  * @SCP_IPI_MAX:	 The maximum IPI number
27*4882a593Smuzhiyun  */
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun enum scp_ipi_id {
30*4882a593Smuzhiyun 	SCP_IPI_INIT = 0,
31*4882a593Smuzhiyun 	SCP_IPI_VDEC_H264,
32*4882a593Smuzhiyun 	SCP_IPI_VDEC_VP8,
33*4882a593Smuzhiyun 	SCP_IPI_VDEC_VP9,
34*4882a593Smuzhiyun 	SCP_IPI_VENC_H264,
35*4882a593Smuzhiyun 	SCP_IPI_VENC_VP8,
36*4882a593Smuzhiyun 	SCP_IPI_MDP_INIT,
37*4882a593Smuzhiyun 	SCP_IPI_MDP_DEINIT,
38*4882a593Smuzhiyun 	SCP_IPI_MDP_FRAME,
39*4882a593Smuzhiyun 	SCP_IPI_DIP,
40*4882a593Smuzhiyun 	SCP_IPI_ISP_CMD,
41*4882a593Smuzhiyun 	SCP_IPI_ISP_FRAME,
42*4882a593Smuzhiyun 	SCP_IPI_FD_CMD,
43*4882a593Smuzhiyun 	SCP_IPI_CROS_HOST_CMD,
44*4882a593Smuzhiyun 	SCP_IPI_NS_SERVICE = 0xFF,
45*4882a593Smuzhiyun 	SCP_IPI_MAX = 0x100,
46*4882a593Smuzhiyun };
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun struct mtk_scp *scp_get(struct platform_device *pdev);
49*4882a593Smuzhiyun void scp_put(struct mtk_scp *scp);
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun struct device *scp_get_device(struct mtk_scp *scp);
52*4882a593Smuzhiyun struct rproc *scp_get_rproc(struct mtk_scp *scp);
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun int scp_ipi_register(struct mtk_scp *scp, u32 id, scp_ipi_handler_t handler,
55*4882a593Smuzhiyun 		     void *priv);
56*4882a593Smuzhiyun void scp_ipi_unregister(struct mtk_scp *scp, u32 id);
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len,
59*4882a593Smuzhiyun 		 unsigned int wait);
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun unsigned int scp_get_vdec_hw_capa(struct mtk_scp *scp);
62*4882a593Smuzhiyun unsigned int scp_get_venc_hw_capa(struct mtk_scp *scp);
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun void *scp_mapping_dm_addr(struct mtk_scp *scp, u32 mem_addr);
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun #endif /* _MTK_SCP_H */
67