dpio.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. */
  55. struct dpio_attr {
  56. int id;
  57. u64 qbman_portal_ce_offset;
  58. u64 qbman_portal_ci_offset;
  59. u16 qbman_portal_id;
  60. enum dpio_channel_mode channel_mode;
  61. u8 num_priorities;
  62. u32 qbman_version;
  63. };
  64. int dpio_get_attributes(struct fsl_mc_io *mc_io,
  65. u32 cmd_flags,
  66. u16 token,
  67. struct dpio_attr *attr);
  68. int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
  69. u32 cmd_flags,
  70. u16 token,
  71. u8 dest);
  72. int dpio_get_api_version(struct fsl_mc_io *mc_io,
  73. u32 cmd_flags,
  74. u16 *major_ver,
  75. u16 *minor_ver);
  76. int dpio_reset(struct fsl_mc_io *mc_io,
  77. u32 cmd_flags,
  78. u16 token);
  79. #endif /* __FSL_DPIO_H */