1 // SPDX-License-Identifier: GPL-2.0
3 * K3 NAVSS DMA glue interface
5 * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
9 #include <linux/atomic.h>
10 #include <linux/delay.h>
11 #include <linux/dma-mapping.h>
13 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/soc/ti/k3-ringacc.h>
17 #include <linux/dma/ti-cppi5.h>
18 #include <linux/dma/k3-udma-glue.h>
21 #include "k3-psil-priv.h"
23 struct k3_udma_glue_common
{
25 struct udma_dev
*udmax
;
26 const struct udma_tisci_rm
*tisci_rm
;
27 struct k3_ringacc
*ringacc
;
38 struct k3_udma_glue_tx_channel
{
39 struct k3_udma_glue_common common
;
41 struct udma_tchan
*udma_tchanx
;
44 struct k3_ring
*ringtx
;
45 struct k3_ring
*ringtxcq
;
58 struct k3_udma_glue_rx_flow
{
59 struct udma_rflow
*udma_rflow
;
61 struct k3_ring
*ringrx
;
62 struct k3_ring
*ringrxfdq
;
67 struct k3_udma_glue_rx_channel
{
68 struct k3_udma_glue_common common
;
70 struct udma_rchan
*udma_rchanx
;
79 struct k3_udma_glue_rx_flow
*flows
;
84 #define K3_UDMAX_TDOWN_TIMEOUT_US 1000
86 static int of_k3_udma_glue_parse(struct device_node
*udmax_np
,
87 struct k3_udma_glue_common
*common
)
89 common
->ringacc
= of_k3_ringacc_get_by_phandle(udmax_np
,
91 if (IS_ERR(common
->ringacc
))
92 return PTR_ERR(common
->ringacc
);
94 common
->udmax
= of_xudma_dev_get(udmax_np
, NULL
);
95 if (IS_ERR(common
->udmax
))
96 return PTR_ERR(common
->udmax
);
98 common
->tisci_rm
= xudma_dev_get_tisci_rm(common
->udmax
);
103 static int of_k3_udma_glue_parse_chn(struct device_node
*chn_np
,
104 const char *name
, struct k3_udma_glue_common
*common
,
107 struct psil_endpoint_config
*ep_config
;
108 struct of_phandle_args dma_spec
;
116 index
= of_property_match_string(chn_np
, "dma-names", name
);
120 if (of_parse_phandle_with_args(chn_np
, "dmas", "#dma-cells", index
,
124 thread_id
= dma_spec
.args
[0];
125 if (dma_spec
.args_count
== 2) {
126 if (dma_spec
.args
[1] > 2) {
127 dev_err(common
->dev
, "Invalid channel atype: %u\n",
132 common
->atype
= dma_spec
.args
[1];
135 if (tx_chn
&& !(thread_id
& K3_PSIL_DST_THREAD_ID_OFFSET
)) {
140 if (!tx_chn
&& (thread_id
& K3_PSIL_DST_THREAD_ID_OFFSET
)) {
145 /* get psil endpoint config */
146 ep_config
= psil_get_ep_config(thread_id
);
147 if (IS_ERR(ep_config
)) {
149 "No configuration for psi-l thread 0x%04x\n",
151 ret
= PTR_ERR(ep_config
);
155 common
->epib
= ep_config
->needs_epib
;
156 common
->psdata_size
= ep_config
->psd_size
;
159 common
->dst_thread
= thread_id
;
161 common
->src_thread
= thread_id
;
163 ret
= of_k3_udma_glue_parse(dma_spec
.np
, common
);
166 of_node_put(dma_spec
.np
);
170 static void k3_udma_glue_dump_tx_chn(struct k3_udma_glue_tx_channel
*tx_chn
)
172 struct device
*dev
= tx_chn
->common
.dev
;
174 dev_dbg(dev
, "dump_tx_chn:\n"
175 "udma_tchan_id: %d\n"
177 "dst_thread: %08x\n",
178 tx_chn
->udma_tchan_id
,
179 tx_chn
->common
.src_thread
,
180 tx_chn
->common
.dst_thread
);
183 static void k3_udma_glue_dump_tx_rt_chn(struct k3_udma_glue_tx_channel
*chn
,
186 struct device
*dev
= chn
->common
.dev
;
188 dev_dbg(dev
, "=== dump ===> %s\n", mark
);
189 dev_dbg(dev
, "0x%08X: %08X\n", UDMA_TCHAN_RT_CTL_REG
,
190 xudma_tchanrt_read(chn
->udma_tchanx
, UDMA_TCHAN_RT_CTL_REG
));
191 dev_dbg(dev
, "0x%08X: %08X\n", UDMA_TCHAN_RT_PEER_RT_EN_REG
,
192 xudma_tchanrt_read(chn
->udma_tchanx
,
193 UDMA_TCHAN_RT_PEER_RT_EN_REG
));
194 dev_dbg(dev
, "0x%08X: %08X\n", UDMA_TCHAN_RT_PCNT_REG
,
195 xudma_tchanrt_read(chn
->udma_tchanx
, UDMA_TCHAN_RT_PCNT_REG
));
196 dev_dbg(dev
, "0x%08X: %08X\n", UDMA_TCHAN_RT_BCNT_REG
,
197 xudma_tchanrt_read(chn
->udma_tchanx
, UDMA_TCHAN_RT_BCNT_REG
));
198 dev_dbg(dev
, "0x%08X: %08X\n", UDMA_TCHAN_RT_SBCNT_REG
,
199 xudma_tchanrt_read(chn
->udma_tchanx
, UDMA_TCHAN_RT_SBCNT_REG
));
202 static int k3_udma_glue_cfg_tx_chn(struct k3_udma_glue_tx_channel
*tx_chn
)
204 const struct udma_tisci_rm
*tisci_rm
= tx_chn
->common
.tisci_rm
;
205 struct ti_sci_msg_rm_udmap_tx_ch_cfg req
;
207 memset(&req
, 0, sizeof(req
));
209 req
.valid_params
= TI_SCI_MSG_VALUE_RM_UDMAP_CH_PAUSE_ON_ERR_VALID
|
210 TI_SCI_MSG_VALUE_RM_UDMAP_CH_TX_FILT_EINFO_VALID
|
211 TI_SCI_MSG_VALUE_RM_UDMAP_CH_TX_FILT_PSWORDS_VALID
|
212 TI_SCI_MSG_VALUE_RM_UDMAP_CH_CHAN_TYPE_VALID
|
213 TI_SCI_MSG_VALUE_RM_UDMAP_CH_TX_SUPR_TDPKT_VALID
|
214 TI_SCI_MSG_VALUE_RM_UDMAP_CH_FETCH_SIZE_VALID
|
215 TI_SCI_MSG_VALUE_RM_UDMAP_CH_CQ_QNUM_VALID
|
216 TI_SCI_MSG_VALUE_RM_UDMAP_CH_ATYPE_VALID
;
217 req
.nav_id
= tisci_rm
->tisci_dev_id
;
218 req
.index
= tx_chn
->udma_tchan_id
;
219 if (tx_chn
->tx_pause_on_err
)
220 req
.tx_pause_on_err
= 1;
221 if (tx_chn
->tx_filt_einfo
)
222 req
.tx_filt_einfo
= 1;
223 if (tx_chn
->tx_filt_pswords
)
224 req
.tx_filt_pswords
= 1;
225 req
.tx_chan_type
= TI_SCI_RM_UDMAP_CHAN_TYPE_PKT_PBRR
;
226 if (tx_chn
->tx_supr_tdpkt
)
227 req
.tx_supr_tdpkt
= 1;
228 req
.tx_fetch_size
= tx_chn
->common
.hdesc_size
>> 2;
229 req
.txcq_qnum
= k3_ringacc_get_ring_id(tx_chn
->ringtxcq
);
230 req
.tx_atype
= tx_chn
->common
.atype
;
232 return tisci_rm
->tisci_udmap_ops
->tx_ch_cfg(tisci_rm
->tisci
, &req
);
235 struct k3_udma_glue_tx_channel
*k3_udma_glue_request_tx_chn(struct device
*dev
,
236 const char *name
, struct k3_udma_glue_tx_channel_cfg
*cfg
)
238 struct k3_udma_glue_tx_channel
*tx_chn
;
241 tx_chn
= devm_kzalloc(dev
, sizeof(*tx_chn
), GFP_KERNEL
);
243 return ERR_PTR(-ENOMEM
);
245 tx_chn
->common
.dev
= dev
;
246 tx_chn
->common
.swdata_size
= cfg
->swdata_size
;
247 tx_chn
->tx_pause_on_err
= cfg
->tx_pause_on_err
;
248 tx_chn
->tx_filt_einfo
= cfg
->tx_filt_einfo
;
249 tx_chn
->tx_filt_pswords
= cfg
->tx_filt_pswords
;
250 tx_chn
->tx_supr_tdpkt
= cfg
->tx_supr_tdpkt
;
252 /* parse of udmap channel */
253 ret
= of_k3_udma_glue_parse_chn(dev
->of_node
, name
,
254 &tx_chn
->common
, true);
258 tx_chn
->common
.hdesc_size
= cppi5_hdesc_calc_size(tx_chn
->common
.epib
,
259 tx_chn
->common
.psdata_size
,
260 tx_chn
->common
.swdata_size
);
262 /* request and cfg UDMAP TX channel */
263 tx_chn
->udma_tchanx
= xudma_tchan_get(tx_chn
->common
.udmax
, -1);
264 if (IS_ERR(tx_chn
->udma_tchanx
)) {
265 ret
= PTR_ERR(tx_chn
->udma_tchanx
);
266 dev_err(dev
, "UDMAX tchanx get err %d\n", ret
);
269 tx_chn
->udma_tchan_id
= xudma_tchan_get_id(tx_chn
->udma_tchanx
);
271 atomic_set(&tx_chn
->free_pkts
, cfg
->txcq_cfg
.size
);
273 /* request and cfg rings */
274 tx_chn
->ringtx
= k3_ringacc_request_ring(tx_chn
->common
.ringacc
,
275 tx_chn
->udma_tchan_id
, 0);
276 if (!tx_chn
->ringtx
) {
278 dev_err(dev
, "Failed to get TX ring %u\n",
279 tx_chn
->udma_tchan_id
);
283 tx_chn
->ringtxcq
= k3_ringacc_request_ring(tx_chn
->common
.ringacc
,
285 if (!tx_chn
->ringtxcq
) {
287 dev_err(dev
, "Failed to get TXCQ ring\n");
291 ret
= k3_ringacc_ring_cfg(tx_chn
->ringtx
, &cfg
->tx_cfg
);
293 dev_err(dev
, "Failed to cfg ringtx %d\n", ret
);
297 ret
= k3_ringacc_ring_cfg(tx_chn
->ringtxcq
, &cfg
->txcq_cfg
);
299 dev_err(dev
, "Failed to cfg ringtx %d\n", ret
);
303 /* request and cfg psi-l */
304 tx_chn
->common
.src_thread
=
305 xudma_dev_get_psil_base(tx_chn
->common
.udmax
) +
306 tx_chn
->udma_tchan_id
;
308 ret
= k3_udma_glue_cfg_tx_chn(tx_chn
);
310 dev_err(dev
, "Failed to cfg tchan %d\n", ret
);
314 ret
= xudma_navss_psil_pair(tx_chn
->common
.udmax
,
315 tx_chn
->common
.src_thread
,
316 tx_chn
->common
.dst_thread
);
318 dev_err(dev
, "PSI-L request err %d\n", ret
);
322 tx_chn
->psil_paired
= true;
324 /* reset TX RT registers */
325 k3_udma_glue_disable_tx_chn(tx_chn
);
327 k3_udma_glue_dump_tx_chn(tx_chn
);
332 k3_udma_glue_release_tx_chn(tx_chn
);
335 EXPORT_SYMBOL_GPL(k3_udma_glue_request_tx_chn
);
337 void k3_udma_glue_release_tx_chn(struct k3_udma_glue_tx_channel
*tx_chn
)
339 if (tx_chn
->psil_paired
) {
340 xudma_navss_psil_unpair(tx_chn
->common
.udmax
,
341 tx_chn
->common
.src_thread
,
342 tx_chn
->common
.dst_thread
);
343 tx_chn
->psil_paired
= false;
346 if (!IS_ERR_OR_NULL(tx_chn
->udma_tchanx
))
347 xudma_tchan_put(tx_chn
->common
.udmax
,
348 tx_chn
->udma_tchanx
);
350 if (tx_chn
->ringtxcq
)
351 k3_ringacc_ring_free(tx_chn
->ringtxcq
);
354 k3_ringacc_ring_free(tx_chn
->ringtx
);
356 EXPORT_SYMBOL_GPL(k3_udma_glue_release_tx_chn
);
358 int k3_udma_glue_push_tx_chn(struct k3_udma_glue_tx_channel
*tx_chn
,
359 struct cppi5_host_desc_t
*desc_tx
,
364 if (!atomic_add_unless(&tx_chn
->free_pkts
, -1, 0))
367 ringtxcq_id
= k3_ringacc_get_ring_id(tx_chn
->ringtxcq
);
368 cppi5_desc_set_retpolicy(&desc_tx
->hdr
, 0, ringtxcq_id
);
370 return k3_ringacc_ring_push(tx_chn
->ringtx
, &desc_dma
);
372 EXPORT_SYMBOL_GPL(k3_udma_glue_push_tx_chn
);
374 int k3_udma_glue_pop_tx_chn(struct k3_udma_glue_tx_channel
*tx_chn
,
375 dma_addr_t
*desc_dma
)
379 ret
= k3_ringacc_ring_pop(tx_chn
->ringtxcq
, desc_dma
);
381 atomic_inc(&tx_chn
->free_pkts
);
385 EXPORT_SYMBOL_GPL(k3_udma_glue_pop_tx_chn
);
387 int k3_udma_glue_enable_tx_chn(struct k3_udma_glue_tx_channel
*tx_chn
)
391 txrt_ctl
= UDMA_PEER_RT_EN_ENABLE
;
392 xudma_tchanrt_write(tx_chn
->udma_tchanx
,
393 UDMA_TCHAN_RT_PEER_RT_EN_REG
,
396 txrt_ctl
= xudma_tchanrt_read(tx_chn
->udma_tchanx
,
397 UDMA_TCHAN_RT_CTL_REG
);
398 txrt_ctl
|= UDMA_CHAN_RT_CTL_EN
;
399 xudma_tchanrt_write(tx_chn
->udma_tchanx
, UDMA_TCHAN_RT_CTL_REG
,
402 k3_udma_glue_dump_tx_rt_chn(tx_chn
, "txchn en");
405 EXPORT_SYMBOL_GPL(k3_udma_glue_enable_tx_chn
);
407 void k3_udma_glue_disable_tx_chn(struct k3_udma_glue_tx_channel
*tx_chn
)
409 k3_udma_glue_dump_tx_rt_chn(tx_chn
, "txchn dis1");
411 xudma_tchanrt_write(tx_chn
->udma_tchanx
, UDMA_TCHAN_RT_CTL_REG
, 0);
413 xudma_tchanrt_write(tx_chn
->udma_tchanx
,
414 UDMA_TCHAN_RT_PEER_RT_EN_REG
, 0);
415 k3_udma_glue_dump_tx_rt_chn(tx_chn
, "txchn dis2");
417 EXPORT_SYMBOL_GPL(k3_udma_glue_disable_tx_chn
);
419 void k3_udma_glue_tdown_tx_chn(struct k3_udma_glue_tx_channel
*tx_chn
,
425 k3_udma_glue_dump_tx_rt_chn(tx_chn
, "txchn tdown1");
427 xudma_tchanrt_write(tx_chn
->udma_tchanx
, UDMA_TCHAN_RT_CTL_REG
,
428 UDMA_CHAN_RT_CTL_EN
| UDMA_CHAN_RT_CTL_TDOWN
);
430 val
= xudma_tchanrt_read(tx_chn
->udma_tchanx
, UDMA_TCHAN_RT_CTL_REG
);
432 while (sync
&& (val
& UDMA_CHAN_RT_CTL_EN
)) {
433 val
= xudma_tchanrt_read(tx_chn
->udma_tchanx
,
434 UDMA_TCHAN_RT_CTL_REG
);
436 if (i
> K3_UDMAX_TDOWN_TIMEOUT_US
) {
437 dev_err(tx_chn
->common
.dev
, "TX tdown timeout\n");
443 val
= xudma_tchanrt_read(tx_chn
->udma_tchanx
,
444 UDMA_TCHAN_RT_PEER_RT_EN_REG
);
445 if (sync
&& (val
& UDMA_PEER_RT_EN_ENABLE
))
446 dev_err(tx_chn
->common
.dev
, "TX tdown peer not stopped\n");
447 k3_udma_glue_dump_tx_rt_chn(tx_chn
, "txchn tdown2");
449 EXPORT_SYMBOL_GPL(k3_udma_glue_tdown_tx_chn
);
451 void k3_udma_glue_reset_tx_chn(struct k3_udma_glue_tx_channel
*tx_chn
,
453 void (*cleanup
)(void *data
, dma_addr_t desc_dma
))
458 /* reset TXCQ as it is not input for udma - expected to be empty */
459 if (tx_chn
->ringtxcq
)
460 k3_ringacc_ring_reset(tx_chn
->ringtxcq
);
463 * TXQ reset need to be special way as it is input for udma and its
464 * state cached by udma, so:
466 * 2) clean up TXQ and call callback .cleanup() for each desc
467 * 3) reset TXQ in a special way
469 occ_tx
= k3_ringacc_ring_get_occ(tx_chn
->ringtx
);
470 dev_dbg(tx_chn
->common
.dev
, "TX reset occ_tx %u\n", occ_tx
);
472 for (i
= 0; i
< occ_tx
; i
++) {
473 ret
= k3_ringacc_ring_pop(tx_chn
->ringtx
, &desc_dma
);
475 dev_err(tx_chn
->common
.dev
, "TX reset pop %d\n", ret
);
478 cleanup(data
, desc_dma
);
481 k3_ringacc_ring_reset_dma(tx_chn
->ringtx
, occ_tx
);
483 EXPORT_SYMBOL_GPL(k3_udma_glue_reset_tx_chn
);
485 u32
k3_udma_glue_tx_get_hdesc_size(struct k3_udma_glue_tx_channel
*tx_chn
)
487 return tx_chn
->common
.hdesc_size
;
489 EXPORT_SYMBOL_GPL(k3_udma_glue_tx_get_hdesc_size
);
491 u32
k3_udma_glue_tx_get_txcq_id(struct k3_udma_glue_tx_channel
*tx_chn
)
493 return k3_ringacc_get_ring_id(tx_chn
->ringtxcq
);
495 EXPORT_SYMBOL_GPL(k3_udma_glue_tx_get_txcq_id
);
497 int k3_udma_glue_tx_get_irq(struct k3_udma_glue_tx_channel
*tx_chn
)
499 tx_chn
->virq
= k3_ringacc_get_ring_irq_num(tx_chn
->ringtxcq
);
503 EXPORT_SYMBOL_GPL(k3_udma_glue_tx_get_irq
);
505 static int k3_udma_glue_cfg_rx_chn(struct k3_udma_glue_rx_channel
*rx_chn
)
507 const struct udma_tisci_rm
*tisci_rm
= rx_chn
->common
.tisci_rm
;
508 struct ti_sci_msg_rm_udmap_rx_ch_cfg req
;
511 memset(&req
, 0, sizeof(req
));
513 req
.valid_params
= TI_SCI_MSG_VALUE_RM_UDMAP_CH_FETCH_SIZE_VALID
|
514 TI_SCI_MSG_VALUE_RM_UDMAP_CH_CQ_QNUM_VALID
|
515 TI_SCI_MSG_VALUE_RM_UDMAP_CH_CHAN_TYPE_VALID
|
516 TI_SCI_MSG_VALUE_RM_UDMAP_CH_RX_FLOWID_START_VALID
|
517 TI_SCI_MSG_VALUE_RM_UDMAP_CH_RX_FLOWID_CNT_VALID
|
518 TI_SCI_MSG_VALUE_RM_UDMAP_CH_ATYPE_VALID
;
520 req
.nav_id
= tisci_rm
->tisci_dev_id
;
521 req
.index
= rx_chn
->udma_rchan_id
;
522 req
.rx_fetch_size
= rx_chn
->common
.hdesc_size
>> 2;
524 * TODO: we can't support rxcq_qnum/RCHAN[a]_RCQ cfg with current sysfw
525 * and udmax impl, so just configure it to invalid value.
526 * req.rxcq_qnum = k3_ringacc_get_ring_id(rx_chn->flows[0].ringrx);
528 req
.rxcq_qnum
= 0xFFFF;
529 if (rx_chn
->flow_num
&& rx_chn
->flow_id_base
!= rx_chn
->udma_rchan_id
) {
530 /* Default flow + extra ones */
531 req
.flowid_start
= rx_chn
->flow_id_base
;
532 req
.flowid_cnt
= rx_chn
->flow_num
;
534 req
.rx_chan_type
= TI_SCI_RM_UDMAP_CHAN_TYPE_PKT_PBRR
;
535 req
.rx_atype
= rx_chn
->common
.atype
;
537 ret
= tisci_rm
->tisci_udmap_ops
->rx_ch_cfg(tisci_rm
->tisci
, &req
);
539 dev_err(rx_chn
->common
.dev
, "rchan%d cfg failed %d\n",
540 rx_chn
->udma_rchan_id
, ret
);
545 static void k3_udma_glue_release_rx_flow(struct k3_udma_glue_rx_channel
*rx_chn
,
548 struct k3_udma_glue_rx_flow
*flow
= &rx_chn
->flows
[flow_num
];
550 if (IS_ERR_OR_NULL(flow
->udma_rflow
))
554 k3_ringacc_ring_free(flow
->ringrxfdq
);
557 k3_ringacc_ring_free(flow
->ringrx
);
559 xudma_rflow_put(rx_chn
->common
.udmax
, flow
->udma_rflow
);
560 flow
->udma_rflow
= NULL
;
561 rx_chn
->flows_ready
--;
564 static int k3_udma_glue_cfg_rx_flow(struct k3_udma_glue_rx_channel
*rx_chn
,
566 struct k3_udma_glue_rx_flow_cfg
*flow_cfg
)
568 struct k3_udma_glue_rx_flow
*flow
= &rx_chn
->flows
[flow_idx
];
569 const struct udma_tisci_rm
*tisci_rm
= rx_chn
->common
.tisci_rm
;
570 struct device
*dev
= rx_chn
->common
.dev
;
571 struct ti_sci_msg_rm_udmap_flow_cfg req
;
576 flow
->udma_rflow
= xudma_rflow_get(rx_chn
->common
.udmax
,
577 flow
->udma_rflow_id
);
578 if (IS_ERR(flow
->udma_rflow
)) {
579 ret
= PTR_ERR(flow
->udma_rflow
);
580 dev_err(dev
, "UDMAX rflow get err %d\n", ret
);
584 if (flow
->udma_rflow_id
!= xudma_rflow_get_id(flow
->udma_rflow
)) {
589 /* request and cfg rings */
590 flow
->ringrx
= k3_ringacc_request_ring(rx_chn
->common
.ringacc
,
591 flow_cfg
->ring_rxq_id
, 0);
594 dev_err(dev
, "Failed to get RX ring\n");
598 flow
->ringrxfdq
= k3_ringacc_request_ring(rx_chn
->common
.ringacc
,
599 flow_cfg
->ring_rxfdq0_id
, 0);
600 if (!flow
->ringrxfdq
) {
602 dev_err(dev
, "Failed to get RXFDQ ring\n");
603 goto err_ringrx_free
;
606 ret
= k3_ringacc_ring_cfg(flow
->ringrx
, &flow_cfg
->rx_cfg
);
608 dev_err(dev
, "Failed to cfg ringrx %d\n", ret
);
609 goto err_ringrxfdq_free
;
612 ret
= k3_ringacc_ring_cfg(flow
->ringrxfdq
, &flow_cfg
->rxfdq_cfg
);
614 dev_err(dev
, "Failed to cfg ringrxfdq %d\n", ret
);
615 goto err_ringrxfdq_free
;
618 if (rx_chn
->remote
) {
619 rx_ring_id
= TI_SCI_RESOURCE_NULL
;
620 rx_ringfdq_id
= TI_SCI_RESOURCE_NULL
;
622 rx_ring_id
= k3_ringacc_get_ring_id(flow
->ringrx
);
623 rx_ringfdq_id
= k3_ringacc_get_ring_id(flow
->ringrxfdq
);
626 memset(&req
, 0, sizeof(req
));
629 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_EINFO_PRESENT_VALID
|
630 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_PSINFO_PRESENT_VALID
|
631 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_ERROR_HANDLING_VALID
|
632 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DESC_TYPE_VALID
|
633 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DEST_QNUM_VALID
|
634 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_SRC_TAG_HI_SEL_VALID
|
635 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_SRC_TAG_LO_SEL_VALID
|
636 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DEST_TAG_HI_SEL_VALID
|
637 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DEST_TAG_LO_SEL_VALID
|
638 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ0_SZ0_QNUM_VALID
|
639 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ1_QNUM_VALID
|
640 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ2_QNUM_VALID
|
641 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ3_QNUM_VALID
;
642 req
.nav_id
= tisci_rm
->tisci_dev_id
;
643 req
.flow_index
= flow
->udma_rflow_id
;
644 if (rx_chn
->common
.epib
)
645 req
.rx_einfo_present
= 1;
646 if (rx_chn
->common
.psdata_size
)
647 req
.rx_psinfo_present
= 1;
648 if (flow_cfg
->rx_error_handling
)
649 req
.rx_error_handling
= 1;
650 req
.rx_desc_type
= 0;
651 req
.rx_dest_qnum
= rx_ring_id
;
652 req
.rx_src_tag_hi_sel
= 0;
653 req
.rx_src_tag_lo_sel
= flow_cfg
->src_tag_lo_sel
;
654 req
.rx_dest_tag_hi_sel
= 0;
655 req
.rx_dest_tag_lo_sel
= 0;
656 req
.rx_fdq0_sz0_qnum
= rx_ringfdq_id
;
657 req
.rx_fdq1_qnum
= rx_ringfdq_id
;
658 req
.rx_fdq2_qnum
= rx_ringfdq_id
;
659 req
.rx_fdq3_qnum
= rx_ringfdq_id
;
661 ret
= tisci_rm
->tisci_udmap_ops
->rx_flow_cfg(tisci_rm
->tisci
, &req
);
663 dev_err(dev
, "flow%d config failed: %d\n", flow
->udma_rflow_id
,
665 goto err_ringrxfdq_free
;
668 rx_chn
->flows_ready
++;
669 dev_dbg(dev
, "flow%d config done. ready:%d\n",
670 flow
->udma_rflow_id
, rx_chn
->flows_ready
);
675 k3_ringacc_ring_free(flow
->ringrxfdq
);
678 k3_ringacc_ring_free(flow
->ringrx
);
681 xudma_rflow_put(rx_chn
->common
.udmax
, flow
->udma_rflow
);
682 flow
->udma_rflow
= NULL
;
687 static void k3_udma_glue_dump_rx_chn(struct k3_udma_glue_rx_channel
*chn
)
689 struct device
*dev
= chn
->common
.dev
;
691 dev_dbg(dev
, "dump_rx_chn:\n"
692 "udma_rchan_id: %d\n"
702 chn
->common
.src_thread
,
703 chn
->common
.dst_thread
,
705 chn
->common
.hdesc_size
,
706 chn
->common
.psdata_size
,
707 chn
->common
.swdata_size
,
712 static void k3_udma_glue_dump_rx_rt_chn(struct k3_udma_glue_rx_channel
*chn
,
715 struct device
*dev
= chn
->common
.dev
;
717 dev_dbg(dev
, "=== dump ===> %s\n", mark
);
719 dev_dbg(dev
, "0x%08X: %08X\n", UDMA_RCHAN_RT_CTL_REG
,
720 xudma_rchanrt_read(chn
->udma_rchanx
, UDMA_RCHAN_RT_CTL_REG
));
721 dev_dbg(dev
, "0x%08X: %08X\n", UDMA_RCHAN_RT_PEER_RT_EN_REG
,
722 xudma_rchanrt_read(chn
->udma_rchanx
,
723 UDMA_RCHAN_RT_PEER_RT_EN_REG
));
724 dev_dbg(dev
, "0x%08X: %08X\n", UDMA_RCHAN_RT_PCNT_REG
,
725 xudma_rchanrt_read(chn
->udma_rchanx
, UDMA_RCHAN_RT_PCNT_REG
));
726 dev_dbg(dev
, "0x%08X: %08X\n", UDMA_RCHAN_RT_BCNT_REG
,
727 xudma_rchanrt_read(chn
->udma_rchanx
, UDMA_RCHAN_RT_BCNT_REG
));
728 dev_dbg(dev
, "0x%08X: %08X\n", UDMA_RCHAN_RT_SBCNT_REG
,
729 xudma_rchanrt_read(chn
->udma_rchanx
, UDMA_RCHAN_RT_SBCNT_REG
));
733 k3_udma_glue_allocate_rx_flows(struct k3_udma_glue_rx_channel
*rx_chn
,
734 struct k3_udma_glue_rx_channel_cfg
*cfg
)
739 if (cfg
->flow_id_use_rxchan_id
)
742 /* not a GP rflows */
743 if (rx_chn
->flow_id_base
!= -1 &&
744 !xudma_rflow_is_gp(rx_chn
->common
.udmax
, rx_chn
->flow_id_base
))
747 /* Allocate range of GP rflows */
748 ret
= xudma_alloc_gp_rflow_range(rx_chn
->common
.udmax
,
749 rx_chn
->flow_id_base
,
752 dev_err(rx_chn
->common
.dev
, "UDMAX reserve_rflow %d cnt:%d err: %d\n",
753 rx_chn
->flow_id_base
, rx_chn
->flow_num
, ret
);
756 rx_chn
->flow_id_base
= ret
;
761 static struct k3_udma_glue_rx_channel
*
762 k3_udma_glue_request_rx_chn_priv(struct device
*dev
, const char *name
,
763 struct k3_udma_glue_rx_channel_cfg
*cfg
)
765 struct k3_udma_glue_rx_channel
*rx_chn
;
768 if (cfg
->flow_id_num
<= 0)
769 return ERR_PTR(-EINVAL
);
771 if (cfg
->flow_id_num
!= 1 &&
772 (cfg
->def_flow_cfg
|| cfg
->flow_id_use_rxchan_id
))
773 return ERR_PTR(-EINVAL
);
775 rx_chn
= devm_kzalloc(dev
, sizeof(*rx_chn
), GFP_KERNEL
);
777 return ERR_PTR(-ENOMEM
);
779 rx_chn
->common
.dev
= dev
;
780 rx_chn
->common
.swdata_size
= cfg
->swdata_size
;
781 rx_chn
->remote
= false;
783 /* parse of udmap channel */
784 ret
= of_k3_udma_glue_parse_chn(dev
->of_node
, name
,
785 &rx_chn
->common
, false);
789 rx_chn
->common
.hdesc_size
= cppi5_hdesc_calc_size(rx_chn
->common
.epib
,
790 rx_chn
->common
.psdata_size
,
791 rx_chn
->common
.swdata_size
);
793 /* request and cfg UDMAP RX channel */
794 rx_chn
->udma_rchanx
= xudma_rchan_get(rx_chn
->common
.udmax
, -1);
795 if (IS_ERR(rx_chn
->udma_rchanx
)) {
796 ret
= PTR_ERR(rx_chn
->udma_rchanx
);
797 dev_err(dev
, "UDMAX rchanx get err %d\n", ret
);
800 rx_chn
->udma_rchan_id
= xudma_rchan_get_id(rx_chn
->udma_rchanx
);
802 rx_chn
->flow_num
= cfg
->flow_id_num
;
803 rx_chn
->flow_id_base
= cfg
->flow_id_base
;
805 /* Use RX channel id as flow id: target dev can't generate flow_id */
806 if (cfg
->flow_id_use_rxchan_id
)
807 rx_chn
->flow_id_base
= rx_chn
->udma_rchan_id
;
809 rx_chn
->flows
= devm_kcalloc(dev
, rx_chn
->flow_num
,
810 sizeof(*rx_chn
->flows
), GFP_KERNEL
);
811 if (!rx_chn
->flows
) {
816 ret
= k3_udma_glue_allocate_rx_flows(rx_chn
, cfg
);
820 for (i
= 0; i
< rx_chn
->flow_num
; i
++)
821 rx_chn
->flows
[i
].udma_rflow_id
= rx_chn
->flow_id_base
+ i
;
823 /* request and cfg psi-l */
824 rx_chn
->common
.dst_thread
=
825 xudma_dev_get_psil_base(rx_chn
->common
.udmax
) +
826 rx_chn
->udma_rchan_id
;
828 ret
= k3_udma_glue_cfg_rx_chn(rx_chn
);
830 dev_err(dev
, "Failed to cfg rchan %d\n", ret
);
834 /* init default RX flow only if flow_num = 1 */
835 if (cfg
->def_flow_cfg
) {
836 ret
= k3_udma_glue_cfg_rx_flow(rx_chn
, 0, cfg
->def_flow_cfg
);
841 ret
= xudma_navss_psil_pair(rx_chn
->common
.udmax
,
842 rx_chn
->common
.src_thread
,
843 rx_chn
->common
.dst_thread
);
845 dev_err(dev
, "PSI-L request err %d\n", ret
);
849 rx_chn
->psil_paired
= true;
851 /* reset RX RT registers */
852 k3_udma_glue_disable_rx_chn(rx_chn
);
854 k3_udma_glue_dump_rx_chn(rx_chn
);
859 k3_udma_glue_release_rx_chn(rx_chn
);
863 static struct k3_udma_glue_rx_channel
*
864 k3_udma_glue_request_remote_rx_chn(struct device
*dev
, const char *name
,
865 struct k3_udma_glue_rx_channel_cfg
*cfg
)
867 struct k3_udma_glue_rx_channel
*rx_chn
;
870 if (cfg
->flow_id_num
<= 0 ||
871 cfg
->flow_id_use_rxchan_id
||
873 cfg
->flow_id_base
< 0)
874 return ERR_PTR(-EINVAL
);
877 * Remote RX channel is under control of Remote CPU core, so
878 * Linux can only request and manipulate by dedicated RX flows
881 rx_chn
= devm_kzalloc(dev
, sizeof(*rx_chn
), GFP_KERNEL
);
883 return ERR_PTR(-ENOMEM
);
885 rx_chn
->common
.dev
= dev
;
886 rx_chn
->common
.swdata_size
= cfg
->swdata_size
;
887 rx_chn
->remote
= true;
888 rx_chn
->udma_rchan_id
= -1;
889 rx_chn
->flow_num
= cfg
->flow_id_num
;
890 rx_chn
->flow_id_base
= cfg
->flow_id_base
;
891 rx_chn
->psil_paired
= false;
893 /* parse of udmap channel */
894 ret
= of_k3_udma_glue_parse_chn(dev
->of_node
, name
,
895 &rx_chn
->common
, false);
899 rx_chn
->common
.hdesc_size
= cppi5_hdesc_calc_size(rx_chn
->common
.epib
,
900 rx_chn
->common
.psdata_size
,
901 rx_chn
->common
.swdata_size
);
903 rx_chn
->flows
= devm_kcalloc(dev
, rx_chn
->flow_num
,
904 sizeof(*rx_chn
->flows
), GFP_KERNEL
);
905 if (!rx_chn
->flows
) {
910 ret
= k3_udma_glue_allocate_rx_flows(rx_chn
, cfg
);
914 for (i
= 0; i
< rx_chn
->flow_num
; i
++)
915 rx_chn
->flows
[i
].udma_rflow_id
= rx_chn
->flow_id_base
+ i
;
917 k3_udma_glue_dump_rx_chn(rx_chn
);
922 k3_udma_glue_release_rx_chn(rx_chn
);
926 struct k3_udma_glue_rx_channel
*
927 k3_udma_glue_request_rx_chn(struct device
*dev
, const char *name
,
928 struct k3_udma_glue_rx_channel_cfg
*cfg
)
931 return k3_udma_glue_request_remote_rx_chn(dev
, name
, cfg
);
933 return k3_udma_glue_request_rx_chn_priv(dev
, name
, cfg
);
935 EXPORT_SYMBOL_GPL(k3_udma_glue_request_rx_chn
);
937 void k3_udma_glue_release_rx_chn(struct k3_udma_glue_rx_channel
*rx_chn
)
941 if (IS_ERR_OR_NULL(rx_chn
->common
.udmax
))
944 if (rx_chn
->psil_paired
) {
945 xudma_navss_psil_unpair(rx_chn
->common
.udmax
,
946 rx_chn
->common
.src_thread
,
947 rx_chn
->common
.dst_thread
);
948 rx_chn
->psil_paired
= false;
951 for (i
= 0; i
< rx_chn
->flow_num
; i
++)
952 k3_udma_glue_release_rx_flow(rx_chn
, i
);
954 if (xudma_rflow_is_gp(rx_chn
->common
.udmax
, rx_chn
->flow_id_base
))
955 xudma_free_gp_rflow_range(rx_chn
->common
.udmax
,
956 rx_chn
->flow_id_base
,
959 if (!IS_ERR_OR_NULL(rx_chn
->udma_rchanx
))
960 xudma_rchan_put(rx_chn
->common
.udmax
,
961 rx_chn
->udma_rchanx
);
963 EXPORT_SYMBOL_GPL(k3_udma_glue_release_rx_chn
);
965 int k3_udma_glue_rx_flow_init(struct k3_udma_glue_rx_channel
*rx_chn
,
967 struct k3_udma_glue_rx_flow_cfg
*flow_cfg
)
969 if (flow_idx
>= rx_chn
->flow_num
)
972 return k3_udma_glue_cfg_rx_flow(rx_chn
, flow_idx
, flow_cfg
);
974 EXPORT_SYMBOL_GPL(k3_udma_glue_rx_flow_init
);
976 u32
k3_udma_glue_rx_flow_get_fdq_id(struct k3_udma_glue_rx_channel
*rx_chn
,
979 struct k3_udma_glue_rx_flow
*flow
;
981 if (flow_idx
>= rx_chn
->flow_num
)
984 flow
= &rx_chn
->flows
[flow_idx
];
986 return k3_ringacc_get_ring_id(flow
->ringrxfdq
);
988 EXPORT_SYMBOL_GPL(k3_udma_glue_rx_flow_get_fdq_id
);
990 u32
k3_udma_glue_rx_get_flow_id_base(struct k3_udma_glue_rx_channel
*rx_chn
)
992 return rx_chn
->flow_id_base
;
994 EXPORT_SYMBOL_GPL(k3_udma_glue_rx_get_flow_id_base
);
996 int k3_udma_glue_rx_flow_enable(struct k3_udma_glue_rx_channel
*rx_chn
,
999 struct k3_udma_glue_rx_flow
*flow
= &rx_chn
->flows
[flow_idx
];
1000 const struct udma_tisci_rm
*tisci_rm
= rx_chn
->common
.tisci_rm
;
1001 struct device
*dev
= rx_chn
->common
.dev
;
1002 struct ti_sci_msg_rm_udmap_flow_cfg req
;
1007 if (!rx_chn
->remote
)
1010 rx_ring_id
= k3_ringacc_get_ring_id(flow
->ringrx
);
1011 rx_ringfdq_id
= k3_ringacc_get_ring_id(flow
->ringrxfdq
);
1013 memset(&req
, 0, sizeof(req
));
1016 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DEST_QNUM_VALID
|
1017 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ0_SZ0_QNUM_VALID
|
1018 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ1_QNUM_VALID
|
1019 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ2_QNUM_VALID
|
1020 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ3_QNUM_VALID
;
1021 req
.nav_id
= tisci_rm
->tisci_dev_id
;
1022 req
.flow_index
= flow
->udma_rflow_id
;
1023 req
.rx_dest_qnum
= rx_ring_id
;
1024 req
.rx_fdq0_sz0_qnum
= rx_ringfdq_id
;
1025 req
.rx_fdq1_qnum
= rx_ringfdq_id
;
1026 req
.rx_fdq2_qnum
= rx_ringfdq_id
;
1027 req
.rx_fdq3_qnum
= rx_ringfdq_id
;
1029 ret
= tisci_rm
->tisci_udmap_ops
->rx_flow_cfg(tisci_rm
->tisci
, &req
);
1031 dev_err(dev
, "flow%d enable failed: %d\n", flow
->udma_rflow_id
,
1037 EXPORT_SYMBOL_GPL(k3_udma_glue_rx_flow_enable
);
1039 int k3_udma_glue_rx_flow_disable(struct k3_udma_glue_rx_channel
*rx_chn
,
1042 struct k3_udma_glue_rx_flow
*flow
= &rx_chn
->flows
[flow_idx
];
1043 const struct udma_tisci_rm
*tisci_rm
= rx_chn
->common
.tisci_rm
;
1044 struct device
*dev
= rx_chn
->common
.dev
;
1045 struct ti_sci_msg_rm_udmap_flow_cfg req
;
1048 if (!rx_chn
->remote
)
1051 memset(&req
, 0, sizeof(req
));
1053 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_DEST_QNUM_VALID
|
1054 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ0_SZ0_QNUM_VALID
|
1055 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ1_QNUM_VALID
|
1056 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ2_QNUM_VALID
|
1057 TI_SCI_MSG_VALUE_RM_UDMAP_FLOW_FDQ3_QNUM_VALID
;
1058 req
.nav_id
= tisci_rm
->tisci_dev_id
;
1059 req
.flow_index
= flow
->udma_rflow_id
;
1060 req
.rx_dest_qnum
= TI_SCI_RESOURCE_NULL
;
1061 req
.rx_fdq0_sz0_qnum
= TI_SCI_RESOURCE_NULL
;
1062 req
.rx_fdq1_qnum
= TI_SCI_RESOURCE_NULL
;
1063 req
.rx_fdq2_qnum
= TI_SCI_RESOURCE_NULL
;
1064 req
.rx_fdq3_qnum
= TI_SCI_RESOURCE_NULL
;
1066 ret
= tisci_rm
->tisci_udmap_ops
->rx_flow_cfg(tisci_rm
->tisci
, &req
);
1068 dev_err(dev
, "flow%d disable failed: %d\n", flow
->udma_rflow_id
,
1074 EXPORT_SYMBOL_GPL(k3_udma_glue_rx_flow_disable
);
1076 int k3_udma_glue_enable_rx_chn(struct k3_udma_glue_rx_channel
*rx_chn
)
1083 if (rx_chn
->flows_ready
< rx_chn
->flow_num
)
1086 rxrt_ctl
= xudma_rchanrt_read(rx_chn
->udma_rchanx
,
1087 UDMA_RCHAN_RT_CTL_REG
);
1088 rxrt_ctl
|= UDMA_CHAN_RT_CTL_EN
;
1089 xudma_rchanrt_write(rx_chn
->udma_rchanx
, UDMA_RCHAN_RT_CTL_REG
,
1092 xudma_rchanrt_write(rx_chn
->udma_rchanx
,
1093 UDMA_RCHAN_RT_PEER_RT_EN_REG
,
1094 UDMA_PEER_RT_EN_ENABLE
);
1096 k3_udma_glue_dump_rx_rt_chn(rx_chn
, "rxrt en");
1099 EXPORT_SYMBOL_GPL(k3_udma_glue_enable_rx_chn
);
1101 void k3_udma_glue_disable_rx_chn(struct k3_udma_glue_rx_channel
*rx_chn
)
1103 k3_udma_glue_dump_rx_rt_chn(rx_chn
, "rxrt dis1");
1105 xudma_rchanrt_write(rx_chn
->udma_rchanx
,
1106 UDMA_RCHAN_RT_PEER_RT_EN_REG
,
1108 xudma_rchanrt_write(rx_chn
->udma_rchanx
, UDMA_RCHAN_RT_CTL_REG
, 0);
1110 k3_udma_glue_dump_rx_rt_chn(rx_chn
, "rxrt dis2");
1112 EXPORT_SYMBOL_GPL(k3_udma_glue_disable_rx_chn
);
1114 void k3_udma_glue_tdown_rx_chn(struct k3_udma_glue_rx_channel
*rx_chn
,
1123 k3_udma_glue_dump_rx_rt_chn(rx_chn
, "rxrt tdown1");
1125 xudma_rchanrt_write(rx_chn
->udma_rchanx
, UDMA_RCHAN_RT_PEER_RT_EN_REG
,
1126 UDMA_PEER_RT_EN_ENABLE
| UDMA_PEER_RT_EN_TEARDOWN
);
1128 val
= xudma_rchanrt_read(rx_chn
->udma_rchanx
, UDMA_RCHAN_RT_CTL_REG
);
1130 while (sync
&& (val
& UDMA_CHAN_RT_CTL_EN
)) {
1131 val
= xudma_rchanrt_read(rx_chn
->udma_rchanx
,
1132 UDMA_RCHAN_RT_CTL_REG
);
1134 if (i
> K3_UDMAX_TDOWN_TIMEOUT_US
) {
1135 dev_err(rx_chn
->common
.dev
, "RX tdown timeout\n");
1141 val
= xudma_rchanrt_read(rx_chn
->udma_rchanx
,
1142 UDMA_RCHAN_RT_PEER_RT_EN_REG
);
1143 if (sync
&& (val
& UDMA_PEER_RT_EN_ENABLE
))
1144 dev_err(rx_chn
->common
.dev
, "TX tdown peer not stopped\n");
1145 k3_udma_glue_dump_rx_rt_chn(rx_chn
, "rxrt tdown2");
1147 EXPORT_SYMBOL_GPL(k3_udma_glue_tdown_rx_chn
);
1149 void k3_udma_glue_reset_rx_chn(struct k3_udma_glue_rx_channel
*rx_chn
,
1150 u32 flow_num
, void *data
,
1151 void (*cleanup
)(void *data
, dma_addr_t desc_dma
), bool skip_fdq
)
1153 struct k3_udma_glue_rx_flow
*flow
= &rx_chn
->flows
[flow_num
];
1154 struct device
*dev
= rx_chn
->common
.dev
;
1155 dma_addr_t desc_dma
;
1158 /* reset RXCQ as it is not input for udma - expected to be empty */
1159 occ_rx
= k3_ringacc_ring_get_occ(flow
->ringrx
);
1160 dev_dbg(dev
, "RX reset flow %u occ_rx %u\n", flow_num
, occ_rx
);
1162 k3_ringacc_ring_reset(flow
->ringrx
);
1164 /* Skip RX FDQ in case one FDQ is used for the set of flows */
1169 * RX FDQ reset need to be special way as it is input for udma and its
1170 * state cached by udma, so:
1171 * 1) save RX FDQ occ
1172 * 2) clean up RX FDQ and call callback .cleanup() for each desc
1173 * 3) reset RX FDQ in a special way
1175 occ_rx
= k3_ringacc_ring_get_occ(flow
->ringrxfdq
);
1176 dev_dbg(dev
, "RX reset flow %u occ_rx_fdq %u\n", flow_num
, occ_rx
);
1178 for (i
= 0; i
< occ_rx
; i
++) {
1179 ret
= k3_ringacc_ring_pop(flow
->ringrxfdq
, &desc_dma
);
1181 dev_err(dev
, "RX reset pop %d\n", ret
);
1184 cleanup(data
, desc_dma
);
1187 k3_ringacc_ring_reset_dma(flow
->ringrxfdq
, occ_rx
);
1189 EXPORT_SYMBOL_GPL(k3_udma_glue_reset_rx_chn
);
1191 int k3_udma_glue_push_rx_chn(struct k3_udma_glue_rx_channel
*rx_chn
,
1192 u32 flow_num
, struct cppi5_host_desc_t
*desc_rx
,
1193 dma_addr_t desc_dma
)
1195 struct k3_udma_glue_rx_flow
*flow
= &rx_chn
->flows
[flow_num
];
1197 return k3_ringacc_ring_push(flow
->ringrxfdq
, &desc_dma
);
1199 EXPORT_SYMBOL_GPL(k3_udma_glue_push_rx_chn
);
1201 int k3_udma_glue_pop_rx_chn(struct k3_udma_glue_rx_channel
*rx_chn
,
1202 u32 flow_num
, dma_addr_t
*desc_dma
)
1204 struct k3_udma_glue_rx_flow
*flow
= &rx_chn
->flows
[flow_num
];
1206 return k3_ringacc_ring_pop(flow
->ringrx
, desc_dma
);
1208 EXPORT_SYMBOL_GPL(k3_udma_glue_pop_rx_chn
);
1210 int k3_udma_glue_rx_get_irq(struct k3_udma_glue_rx_channel
*rx_chn
,
1213 struct k3_udma_glue_rx_flow
*flow
;
1215 flow
= &rx_chn
->flows
[flow_num
];
1217 flow
->virq
= k3_ringacc_get_ring_irq_num(flow
->ringrx
);
1221 EXPORT_SYMBOL_GPL(k3_udma_glue_rx_get_irq
);