Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * Copyright 2018 NXP
0004  *
0005  * Header file for the IPC implementation.
0006  */
0007 
0008 #ifndef _SC_IPC_H
0009 #define _SC_IPC_H
0010 
0011 #include <linux/device.h>
0012 #include <linux/types.h>
0013 
0014 #define IMX_SC_RPC_VERSION  1
0015 #define IMX_SC_RPC_MAX_MSG  8
0016 
0017 struct imx_sc_ipc;
0018 
0019 enum imx_sc_rpc_svc {
0020     IMX_SC_RPC_SVC_UNKNOWN = 0,
0021     IMX_SC_RPC_SVC_RETURN = 1,
0022     IMX_SC_RPC_SVC_PM = 2,
0023     IMX_SC_RPC_SVC_RM = 3,
0024     IMX_SC_RPC_SVC_TIMER = 5,
0025     IMX_SC_RPC_SVC_PAD = 6,
0026     IMX_SC_RPC_SVC_MISC = 7,
0027     IMX_SC_RPC_SVC_IRQ = 8,
0028 };
0029 
0030 struct imx_sc_rpc_msg {
0031     uint8_t ver;
0032     uint8_t size;
0033     uint8_t svc;
0034     uint8_t func;
0035 };
0036 
0037 #ifdef CONFIG_IMX_SCU
0038 /*
0039  * This is an function to send an RPC message over an IPC channel.
0040  * It is called by client-side SCFW API function shims.
0041  *
0042  * @param[in]     ipc         IPC handle
0043  * @param[in,out] msg         handle to a message
0044  * @param[in]     have_resp   response flag
0045  *
0046  * If have_resp is true then this function waits for a response
0047  * and returns the result in msg.
0048  */
0049 int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp);
0050 
0051 /*
0052  * This function gets the default ipc handle used by SCU
0053  *
0054  * @param[out]  ipc sc ipc handle
0055  *
0056  * @return Returns an error code (0 = success, failed if < 0)
0057  */
0058 int imx_scu_get_handle(struct imx_sc_ipc **ipc);
0059 #else
0060 static inline int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg,
0061                    bool have_resp)
0062 {
0063     return -ENOTSUPP;
0064 }
0065 
0066 static inline int imx_scu_get_handle(struct imx_sc_ipc **ipc)
0067 {
0068     return -ENOTSUPP;
0069 }
0070 #endif
0071 #endif /* _SC_IPC_H */