dpio.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
  2. /*
  3. * Copyright 2013-2016 Freescale Semiconductor Inc.
  4. * Copyright 2016 NXP
  5. *
  6. */
  7. #ifndef __FSL_DPIO_H
  8. #define __FSL_DPIO_H
  9. struct fsl_mc_io;
  10. int dpio_open(struct fsl_mc_io *mc_io,
  11. u32 cmd_flags,
  12. int dpio_id,
  13. u16 *token);
  14. int dpio_close(struct fsl_mc_io *mc_io,
  15. u32 cmd_flags,
  16. u16 token);
  17. /**
  18. * enum dpio_channel_mode - DPIO notification channel mode
  19. * @DPIO_NO_CHANNEL: No support for notification channel
  20. * @DPIO_LOCAL_CHANNEL: Notifications on data availability can be received by a
  21. * dedicated channel in the DPIO; user should point the queue's
  22. * destination in the relevant interface to this DPIO
  23. */
  24. enum dpio_channel_mode {
  25. DPIO_NO_CHANNEL = 0,
  26. DPIO_LOCAL_CHANNEL = 1,
  27. };
  28. /**
  29. * struct dpio_cfg - Structure representing DPIO configuration
  30. * @channel_mode: Notification channel mode
  31. * @num_priorities: Number of priorities for the notification channel (1-8);
  32. * relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
  33. */
  34. struct dpio_cfg {
  35. enum dpio_channel_mode channel_mode;
  36. u8 num_priorities;
  37. };
  38. int dpio_enable(struct fsl_mc_io *mc_io,
  39. u32 cmd_flags,
  40. u16 token);
  41. int dpio_disable(struct fsl_mc_io *mc_io,
  42. u32 cmd_flags,
  43. u16 token);
  44. /**
  45. * struct dpio_attr - Structure representing DPIO attributes
  46. * @id: DPIO object ID
  47. * @qbman_portal_ce_offset: offset of the software portal cache-enabled area
  48. * @qbman_portal_ci_offset: offset of the software portal cache-inhibited area
  49. * @qbman_portal_id: Software portal ID
  50. * @channel_mode: Notification channel mode
  51. * @num_priorities: Number of priorities for the notification channel (1-8);
  52. * relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
  53. * @qbman_version: QBMAN version
  54. * @clk: QBMAN clock frequency value in Hz
  55. */
  56. struct dpio_attr {
  57. int id;
  58. u64 qbman_portal_ce_offset;
  59. u64 qbman_portal_ci_offset;
  60. u16 qbman_portal_id;
  61. enum dpio_channel_mode channel_mode;
  62. u8 num_priorities;
  63. u32 qbman_version;
  64. u32 clk;
  65. };
  66. int dpio_get_attributes(struct fsl_mc_io *mc_io,
  67. u32 cmd_flags,
  68. u16 token,
  69. struct dpio_attr *attr);
  70. int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
  71. u32 cmd_flags,
  72. u16 token,
  73. u8 dest);
  74. int dpio_get_api_version(struct fsl_mc_io *mc_io,
  75. u32 cmd_flags,
  76. u16 *major_ver,
  77. u16 *minor_ver);
  78. int dpio_reset(struct fsl_mc_io *mc_io,
  79. u32 cmd_flags,
  80. u16 token);
  81. #endif /* __FSL_DPIO_H */