xref: /linux/include/linux/rpmsg/mtk_rpmsg.h (revision 8dd06ef34b6e2f41b29fbf5fc1663780f2524285)
1*70179969SPi-Hsun Shih /* SPDX-License-Identifier: GPL-2.0 */
2*70179969SPi-Hsun Shih /*
3*70179969SPi-Hsun Shih  * Copyright 2019 Google LLC.
4*70179969SPi-Hsun Shih  */
5*70179969SPi-Hsun Shih 
6*70179969SPi-Hsun Shih #ifndef __LINUX_RPMSG_MTK_RPMSG_H
7*70179969SPi-Hsun Shih #define __LINUX_RPMSG_MTK_RPMSG_H
8*70179969SPi-Hsun Shih 
9*70179969SPi-Hsun Shih #include <linux/platform_device.h>
10*70179969SPi-Hsun Shih #include <linux/remoteproc.h>
11*70179969SPi-Hsun Shih 
12*70179969SPi-Hsun Shih typedef void (*ipi_handler_t)(void *data, unsigned int len, void *priv);
13*70179969SPi-Hsun Shih 
14*70179969SPi-Hsun Shih /*
15*70179969SPi-Hsun Shih  * struct mtk_rpmsg_info - IPI functions tied to the rpmsg device.
16*70179969SPi-Hsun Shih  * @register_ipi: register IPI handler for an IPI id.
17*70179969SPi-Hsun Shih  * @unregister_ipi: unregister IPI handler for a registered IPI id.
18*70179969SPi-Hsun Shih  * @send_ipi: send IPI to an IPI id. wait is the timeout (in msecs) to wait
19*70179969SPi-Hsun Shih  *            until response, or 0 if there's no timeout.
20*70179969SPi-Hsun Shih  * @ns_ipi_id: the IPI id used for name service, or -1 if name service isn't
21*70179969SPi-Hsun Shih  *             supported.
22*70179969SPi-Hsun Shih  */
23*70179969SPi-Hsun Shih struct mtk_rpmsg_info {
24*70179969SPi-Hsun Shih 	int (*register_ipi)(struct platform_device *pdev, u32 id,
25*70179969SPi-Hsun Shih 			    ipi_handler_t handler, void *priv);
26*70179969SPi-Hsun Shih 	void (*unregister_ipi)(struct platform_device *pdev, u32 id);
27*70179969SPi-Hsun Shih 	int (*send_ipi)(struct platform_device *pdev, u32 id,
28*70179969SPi-Hsun Shih 			void *buf, unsigned int len, unsigned int wait);
29*70179969SPi-Hsun Shih 	int ns_ipi_id;
30*70179969SPi-Hsun Shih };
31*70179969SPi-Hsun Shih 
32*70179969SPi-Hsun Shih struct rproc_subdev *
33*70179969SPi-Hsun Shih mtk_rpmsg_create_rproc_subdev(struct platform_device *pdev,
34*70179969SPi-Hsun Shih 			      struct mtk_rpmsg_info *info);
35*70179969SPi-Hsun Shih 
36*70179969SPi-Hsun Shih void mtk_rpmsg_destroy_rproc_subdev(struct rproc_subdev *subdev);
37*70179969SPi-Hsun Shih 
38*70179969SPi-Hsun Shih #endif
39