1 /* SPDX-License-Identifier: BSD-3-Clause
10 /* Data Path DMA Interface API
11 * Contains initialization APIs and runtime control APIs for DPDMAI
14 /* General DPDMAI macros */
17 * Maximum number of Tx/Rx priorities per DPDMAI object
19 #define DPDMAI_PRIO_NUM 2
22 * All queues considered; see dpdmai_set_rx_queue()
24 #define DPDMAI_ALL_QUEUES (uint8_t)(-1)
26 int dpdmai_open(struct fsl_mc_io *mc_io,
31 int dpdmai_close(struct fsl_mc_io *mc_io,
36 * struct dpdmai_cfg - Structure representing DPDMAI configuration
37 * @priorities: Priorities for the DMA hardware processing; valid priorities are
38 * configured with values 1-8; the entry following last valid entry
39 * should be configured with 0
43 uint8_t priorities[DPDMAI_PRIO_NUM];
46 int dpdmai_create(struct fsl_mc_io *mc_io,
49 const struct dpdmai_cfg *cfg,
52 int dpdmai_destroy(struct fsl_mc_io *mc_io,
57 int dpdmai_enable(struct fsl_mc_io *mc_io,
61 int dpdmai_disable(struct fsl_mc_io *mc_io,
65 int dpdmai_is_enabled(struct fsl_mc_io *mc_io,
70 int dpdmai_reset(struct fsl_mc_io *mc_io,
75 * struct dpdmai_attr - Structure representing DPDMAI attributes
76 * @id: DPDMAI object ID
77 * @num_of_priorities: number of priorities
81 uint8_t num_of_priorities;
82 uint8_t num_of_queues;
85 int dpdmai_get_attributes(struct fsl_mc_io *mc_io,
88 struct dpdmai_attr *attr);
91 * enum dpdmai_dest - DPDMAI destination types
92 * @DPDMAI_DEST_NONE: Unassigned destination; The queue is set in parked mode
93 * and does not generate FQDAN notifications; user is expected to dequeue
94 * from the queue based on polling or other user-defined method
95 * @DPDMAI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
96 * notifications to the specified DPIO; user is expected to dequeue
97 * from the queue only after notification is received
98 * @DPDMAI_DEST_DPCON: The queue is set in schedule mode and does not generate
99 * FQDAN notifications, but is connected to the specified DPCON object;
100 * user is expected to dequeue from the DPCON channel
103 DPDMAI_DEST_NONE = 0,
104 DPDMAI_DEST_DPIO = 1,
105 DPDMAI_DEST_DPCON = 2
109 * struct dpdmai_dest_cfg - Structure representing DPDMAI destination parameters
110 * @dest_type: Destination type
111 * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
112 * @priority: Priority selection within the DPIO or DPCON channel; valid values
113 * are 0-1 or 0-7, depending on the number of priorities in that
114 * channel; not relevant for 'DPDMAI_DEST_NONE' option
116 struct dpdmai_dest_cfg {
117 enum dpdmai_dest dest_type;
122 /* DPDMAI queue modification options */
125 * Select to modify the user's context associated with the queue
127 #define DPDMAI_QUEUE_OPT_USER_CTX 0x00000001
130 * Select to modify the queue's destination
132 #define DPDMAI_QUEUE_OPT_DEST 0x00000002
135 * struct dpdmai_rx_queue_cfg - DPDMAI RX queue configuration
136 * @options: Flags representing the suggested modifications to the queue;
137 * Use any combination of 'DPDMAI_QUEUE_OPT_<X>' flags
138 * @user_ctx: User context value provided in the frame descriptor of each
140 * valid only if 'DPDMAI_QUEUE_OPT_USER_CTX' is contained in 'options'
141 * @dest_cfg: Queue destination parameters;
142 * valid only if 'DPDMAI_QUEUE_OPT_DEST' is contained in 'options'
144 struct dpdmai_rx_queue_cfg {
147 struct dpdmai_dest_cfg dest_cfg;
151 int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io,
156 const struct dpdmai_rx_queue_cfg *cfg);
159 * struct dpdmai_rx_queue_attr - Structure representing attributes of Rx queues
160 * @user_ctx: User context value provided in the frame descriptor of each
162 * @dest_cfg: Queue destination configuration
163 * @fqid: Virtual FQID value to be used for dequeue operations
165 struct dpdmai_rx_queue_attr {
167 struct dpdmai_dest_cfg dest_cfg;
171 int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io,
176 struct dpdmai_rx_queue_attr *attr);
179 * struct dpdmai_tx_queue_attr - Structure representing attributes of Tx queues
180 * @fqid: Virtual FQID to be used for sending frames to DMA hardware
183 struct dpdmai_tx_queue_attr {
187 int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io,
192 struct dpdmai_tx_queue_attr *attr);
194 #endif /* __FSL_DPDMAI_H */