ipc.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright 2018 NXP
  4. *
  5. * Header file for the IPC implementation.
  6. */
  7. #ifndef _SC_IPC_H
  8. #define _SC_IPC_H
  9. #include <linux/device.h>
  10. #include <linux/types.h>
  11. #define IMX_SC_RPC_VERSION 1
  12. #define IMX_SC_RPC_MAX_MSG 8
  13. struct imx_sc_ipc;
  14. enum imx_sc_rpc_svc {
  15. IMX_SC_RPC_SVC_UNKNOWN = 0,
  16. IMX_SC_RPC_SVC_RETURN = 1,
  17. IMX_SC_RPC_SVC_PM = 2,
  18. IMX_SC_RPC_SVC_RM = 3,
  19. IMX_SC_RPC_SVC_TIMER = 5,
  20. IMX_SC_RPC_SVC_PAD = 6,
  21. IMX_SC_RPC_SVC_MISC = 7,
  22. IMX_SC_RPC_SVC_IRQ = 8,
  23. };
  24. struct imx_sc_rpc_msg {
  25. uint8_t ver;
  26. uint8_t size;
  27. uint8_t svc;
  28. uint8_t func;
  29. };
  30. /*
  31. * This is an function to send an RPC message over an IPC channel.
  32. * It is called by client-side SCFW API function shims.
  33. *
  34. * @param[in] ipc IPC handle
  35. * @param[in,out] msg handle to a message
  36. * @param[in] have_resp response flag
  37. *
  38. * If have_resp is true then this function waits for a response
  39. * and returns the result in msg.
  40. */
  41. int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp);
  42. /*
  43. * This function gets the default ipc handle used by SCU
  44. *
  45. * @param[out] ipc sc ipc handle
  46. *
  47. * @return Returns an error code (0 = success, failed if < 0)
  48. */
  49. int imx_scu_get_handle(struct imx_sc_ipc **ipc);
  50. #endif /* _SC_IPC_H */