Re: [PATCH v8 17/19] dmaengine: ti: k3-udma-v2: Add support for PKTDMA V2

From: Vignesh Raghavendra

Date: Tue Sep 15 2026 - 02:53:00 EST


> The PKTDMA V2 is different than the existing PKTDMA supported by the
> k3-udma driver.
>
> The changes in PKTDMA V2 are:
> - Autopair: There is no longer a need for PSIL pair and AUTOPAIR bit
> needs to set in the RT_CTL register.
> - Static channel mapping: Each channel is mapped to a single
> peripheral.
> - Direct IRQs: There is no INT-A and interrupt lines from DMA are
> directly connected to GIC.
> - Remote side configuration handled by DMA. So no need to write to
> PEER registers to START / STOP / PAUSE / TEARDOWN.
> - Unified Channel Space: Tx and Rx channels share a single register
> space. Each channel index is specifically fixed in hardware as either
> Tx or Rx in an interleaved manner.
>
> Signed-off-by: Sai Sree Kartheek Adivi <s-adivi@xxxxxx>
>
> diff --git a/drivers/dma/ti/k3-udma-common.c b/drivers/dma/ti/k3-udma-common.c
> index f9dd6edf3eac..d5d7158a37f8 100644
> --- a/drivers/dma/ti/k3-udma-common.c
> +++ b/drivers/dma/ti/k3-udma-common.c
> @@ -2461,9 +2461,16 @@ static int pktdma_setup_resources(struct udma_dev *ud)
> ud->tchan_map = devm_bitmap_zalloc(dev, ud->tchan_cnt, GFP_KERNEL);
> ud->tchans = devm_kcalloc(dev, ud->tchan_cnt, sizeof(*ud->tchans),
> GFP_KERNEL);
> - ud->rchan_map = devm_bitmap_zalloc(dev, ud->rchan_cnt, GFP_KERNEL);
> - ud->rchans = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rchans),
> - GFP_KERNEL);
> + if (ud->match_data->version == K3_UDMA_V1) {
> + ud->rchan_map = devm_bitmap_zalloc(dev, ud->rchan_cnt, GFP_KERNEL);
> + ud->rchans = devm_kcalloc(dev, ud->rchan_cnt, sizeof(*ud->rchans),
> + GFP_KERNEL);
> + } else {
> + ud->rchan_map = ud->tchan_map;
> + ud->rchans = ud->tchans;
> + ud->chan_map = ud->tchan_map;
> + ud->chans = ud->tchans;
> + }
> ud->rflow_in_use = devm_kcalloc(dev, BITS_TO_LONGS(ud->rflow_cnt),
> sizeof(unsigned long),
> GFP_KERNEL);
> @@ -2562,13 +2569,21 @@ int k3_udma_setup_resources(struct udma_dev *ud)
> }
> break;
> case DMA_TYPE_PKTDMA:
> - dev_info(dev,
> - "Channels: %d (tchan: %u, rchan: %u)\n",
> - ch_count,
> - ud->tchan_cnt - bitmap_weight(ud->tchan_map,
> - ud->tchan_cnt),
> - ud->rchan_cnt - bitmap_weight(ud->rchan_map,
> - ud->rchan_cnt));
> + if (ud->match_data->version == K3_UDMA_V1) {
> + dev_info(dev,
> + "Channels: %d (tchan: %u, rchan: %u)\n",
> + ch_count,
> + ud->tchan_cnt - bitmap_weight(ud->tchan_map,
> + ud->tchan_cnt),
> + ud->rchan_cnt - bitmap_weight(ud->rchan_map,
> + ud->rchan_cnt));
> + } else {
> + dev_info(dev,
> + "Channels: %d (tchan + rchan: %u)\n",
> + ch_count,
> + ud->chan_cnt - bitmap_weight(ud->chan_map,
> + ud->chan_cnt));
> + }
> break;
> default:
> break;
> diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c
> index 686dc140293e..bec4deb480e6 100644
> --- a/drivers/dma/ti/k3-udma-glue.c
> +++ b/drivers/dma/ti/k3-udma-glue.c
> @@ -166,6 +166,29 @@ static int of_k3_udma_glue_parse_chn(struct device_node *chn_np,
> goto out_put_spec;
>
> thread_id = dma_spec.args[0];
> +
> + /*
> + * V2 PKTDMA DT specifiers encode the hardware flow/channel ID in
> + * args[0] rather than the PSI-L thread ID used by V1. Resolve the
> + * PSI-L thread ID before the common path checks the direction bit.
> + */
> + if (common->udmax->match_data->version == K3_UDMA_V2 &&
> + xudma_is_pktdma(common->udmax)) {
> + struct psil_endpoint_config *ep_cfg;
> + u32 psil_thread_id;
> + bool dev_to_mem;
> +
> + ep_cfg = psil_get_ep_config_by_id(thread_id, DMA_TYPE_PKTDMA,
> + &psil_thread_id, &dev_to_mem);
> + if (IS_ERR(ep_cfg)) {
> + dev_err(common->dev,
> + "No PSI-L config for flow %u\n", thread_id);
> + ret = PTR_ERR(ep_cfg);
> + goto out_put_spec;
> + }
> + thread_id = psil_thread_id;
> + }
> +
> if (dma_spec.args_count == 2) {
> if (dma_spec.args[1] > 2 && !xudma_is_pktdma(common->udmax)) {
> dev_err(common->dev, "Invalid channel atype: %u\n",
> diff --git a/drivers/dma/ti/k3-udma-private.c b/drivers/dma/ti/k3-udma-private.c
> index 44c097fff5ee..92d44ef9593d 100644
> --- a/drivers/dma/ti/k3-udma-private.c
> +++ b/drivers/dma/ti/k3-udma-private.c
> @@ -174,16 +174,20 @@ EXPORT_SYMBOL(xudma_is_pktdma);
>
> int xudma_pktdma_tflow_get_irq(struct udma_dev *ud, int udma_tflow_id)
> {
> - const struct udma_oes_offsets *oes = &ud->soc_data->oes;
> + struct platform_device *pdev = to_platform_device(ud->dev);
> + char irq_name[10];
>
> - return msi_get_virq(ud->dev, udma_tflow_id + oes->pktdma_tchan_flow);

this is need for K3_UDMA_V1 gen to continue to function. In fact, you
bring it back in 18/19. Instead only add whats needed for K3_UDMA_V2 to
be functional and move this chunk to 18/19 where rest of the glue layer
updates are made?

> + snprintf(irq_name, sizeof(irq_name), "tx-%u", udma_tflow_id);
> + return platform_get_irq_byname(pdev, irq_name);
> }
> EXPORT_SYMBOL(xudma_pktdma_tflow_get_irq);
>
> int xudma_pktdma_rflow_get_irq(struct udma_dev *ud, int udma_rflow_id)
> {
> - const struct udma_oes_offsets *oes = &ud->soc_data->oes;
> + struct platform_device *pdev = to_platform_device(ud->dev);
> + char irq_name[10];
>
> - return msi_get_virq(ud->dev, udma_rflow_id + oes->pktdma_rchan_flow);

Same here

--
Vignesh