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
42 uint8_t priorities[DPDMAI_PRIO_NUM];
45 int dpdmai_create(struct fsl_mc_io *mc_io,
48 const struct dpdmai_cfg *cfg,
51 int dpdmai_destroy(struct fsl_mc_io *mc_io,
56 int dpdmai_enable(struct fsl_mc_io *mc_io,
60 int dpdmai_disable(struct fsl_mc_io *mc_io,
64 int dpdmai_is_enabled(struct fsl_mc_io *mc_io,
69 int dpdmai_reset(struct fsl_mc_io *mc_io,
74 * struct dpdmai_attr - Structure representing DPDMAI attributes
75 * @id: DPDMAI object ID
76 * @num_of_priorities: number of priorities
80 uint8_t num_of_priorities;
83 int dpdmai_get_attributes(struct fsl_mc_io *mc_io,
86 struct dpdmai_attr *attr);
89 * enum dpdmai_dest - DPDMAI destination types
90 * @DPDMAI_DEST_NONE: Unassigned destination; The queue is set in parked mode
91 * and does not generate FQDAN notifications; user is expected to dequeue
92 * from the queue based on polling or other user-defined method
93 * @DPDMAI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
94 * notifications to the specified DPIO; user is expected to dequeue
95 * from the queue only after notification is received
96 * @DPDMAI_DEST_DPCON: The queue is set in schedule mode and does not generate
97 * FQDAN notifications, but is connected to the specified DPCON object;
98 * user is expected to dequeue from the DPCON channel
101 DPDMAI_DEST_NONE = 0,
102 DPDMAI_DEST_DPIO = 1,
103 DPDMAI_DEST_DPCON = 2
107 * struct dpdmai_dest_cfg - Structure representing DPDMAI destination parameters
108 * @dest_type: Destination type
109 * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
110 * @priority: Priority selection within the DPIO or DPCON channel; valid values
111 * are 0-1 or 0-7, depending on the number of priorities in that
112 * channel; not relevant for 'DPDMAI_DEST_NONE' option
114 struct dpdmai_dest_cfg {
115 enum dpdmai_dest dest_type;
120 /* DPDMAI queue modification options */
123 * Select to modify the user's context associated with the queue
125 #define DPDMAI_QUEUE_OPT_USER_CTX 0x00000001
128 * Select to modify the queue's destination
130 #define DPDMAI_QUEUE_OPT_DEST 0x00000002
133 * struct dpdmai_rx_queue_cfg - DPDMAI RX queue configuration
134 * @options: Flags representing the suggested modifications to the queue;
135 * Use any combination of 'DPDMAI_QUEUE_OPT_<X>' flags
136 * @user_ctx: User context value provided in the frame descriptor of each
138 * valid only if 'DPDMAI_QUEUE_OPT_USER_CTX' is contained in 'options'
139 * @dest_cfg: Queue destination parameters;
140 * valid only if 'DPDMAI_QUEUE_OPT_DEST' is contained in 'options'
142 struct dpdmai_rx_queue_cfg {
145 struct dpdmai_dest_cfg dest_cfg;
149 int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io,
153 const struct dpdmai_rx_queue_cfg *cfg);
156 * struct dpdmai_rx_queue_attr - Structure representing attributes of Rx queues
157 * @user_ctx: User context value provided in the frame descriptor of each
159 * @dest_cfg: Queue destination configuration
160 * @fqid: Virtual FQID value to be used for dequeue operations
162 struct dpdmai_rx_queue_attr {
164 struct dpdmai_dest_cfg dest_cfg;
168 int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io,
172 struct dpdmai_rx_queue_attr *attr);
175 * struct dpdmai_tx_queue_attr - Structure representing attributes of Tx queues
176 * @fqid: Virtual FQID to be used for sending frames to DMA hardware
179 struct dpdmai_tx_queue_attr {
183 int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io,
187 struct dpdmai_tx_queue_attr *attr);
189 #endif /* __FSL_DPDMAI_H */