[PATCH v13 17/20] dmaengine: ti: k3-udma-v2: New driver for K3 BCDMA_V2

Frank Li Frank.li at oss.nxp.com
Thu Dec 3 14:13:46 PST 2026


On Tue, Nov 24, 2026 at 05:15:19PM +0530, Sai Sree Kartheek Adivi via B4 Relay wrote:
> [You don't often get email from devnull+s-adivi.ti.com at kernel.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Sai Sree Kartheek Adivi <s-adivi at ti.com>
>
> Add support for BCDMA_V2.
>
> The BCDMA_V2 is different than the existing BCDMA supported by the
> k3-udma driver.
>
> The changes in BCDMA_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 is otherwise handled by DMA, so PEER
>   register writes are not needed for START / PAUSE, but a PEER register
>   FLUSH write is still required during TEARDOWN as a hardware
>   workaround.
> - 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.
>
> Also, since a version member is introduced in the match_data, Add
> version v1 in match_data of SoCs using v1 DMA.
>
> Reviewed-by: Vignesh Raghavendra <vigneshr at ti.com>
> Signed-off-by: Sai Sree Kartheek Adivi <s-adivi at ti.com>
> ---
>  drivers/dma/ti/Kconfig            |   15 +-
>  drivers/dma/ti/Makefile           |    1 +
>  drivers/dma/ti/k3-udma-common.c   |  132 +++-
>  drivers/dma/ti/k3-udma-v2.c       | 1377 +++++++++++++++++++++++++++++++++++++
>  drivers/dma/ti/k3-udma.c          |    9 +
>  drivers/dma/ti/k3-udma.h          |  124 ++--
>  include/linux/soc/ti/k3-ringacc.h |    3 +
>  7 files changed, 1586 insertions(+), 75 deletions(-)
>
> diff --git a/drivers/dma/ti/Kconfig b/drivers/dma/ti/Kconfig
> index a389ae04ec930..e6a2cf37062e7 100644
> --- a/drivers/dma/ti/Kconfig
> +++ b/drivers/dma/ti/Kconfig
> @@ -49,6 +49,19 @@ config TI_K3_UDMA
>           Enable support for the TI UDMA (Unified DMA) controller. This
>           DMA engine is used in AM65x and j721e.
>
> +config TI_K3_UDMA_V2
> +       tristate "Texas Instruments K3 UDMA v2 support"
> +       depends on ARCH_K3 || COMPILE_TEST
> +       depends on TI_SCI_INTA_IRQCHIP
> +       select DMA_ENGINE
> +       select DMA_VIRTUAL_CHANNELS
> +       select TI_K3_UDMA_COMMON
> +       select TI_K3_RINGACC
> +       select TI_K3_PSIL
> +        help
> +         Enable support for the TI UDMA (Unified DMA) v2 controller. This
> +         DMA engine is used in AM62L.
> +
>  config TI_K3_UDMA_COMMON
>         tristate
>
> @@ -62,7 +75,7 @@ config TI_K3_UDMA_GLUE_LAYER
>
>  config TI_K3_PSIL
>         tristate
> -       default TI_K3_UDMA
> +       default TI_K3_UDMA || TI_K3_UDMA_V2
>
>  config TI_DMA_CROSSBAR
>         bool
> diff --git a/drivers/dma/ti/Makefile b/drivers/dma/ti/Makefile
> index 41bfba944dc6c..296aa3421e71b 100644
> --- a/drivers/dma/ti/Makefile
> +++ b/drivers/dma/ti/Makefile
> @@ -3,6 +3,7 @@ obj-$(CONFIG_TI_CPPI41) += cppi41.o
>  obj-$(CONFIG_TI_EDMA) += edma.o
>  obj-$(CONFIG_DMA_OMAP) += omap-dma.o
>  obj-$(CONFIG_TI_K3_UDMA) += k3-udma.o
> +obj-$(CONFIG_TI_K3_UDMA_V2) += k3-udma-v2.o
>  obj-$(CONFIG_TI_K3_UDMA_COMMON) += k3-udma-common.o
>  obj-$(CONFIG_TI_K3_UDMA_GLUE_LAYER) += k3-udma-glue.o
>  k3-psil-lib-objs := k3-psil.o \
> diff --git a/drivers/dma/ti/k3-udma-common.c b/drivers/dma/ti/k3-udma-common.c
> index ff5c9aedaecf3..42d918c6ba168 100644
> --- a/drivers/dma/ti/k3-udma-common.c
> +++ b/drivers/dma/ti/k3-udma-common.c
> @@ -178,8 +178,13 @@ bool udma_is_desc_really_done(struct udma_chan *uc, struct udma_desc *d)
>             uc->config.dir != DMA_MEM_TO_DEV || !(uc->config.tx_flags & DMA_PREP_INTERRUPT))
>                 return true;
>
> -       peer_bcnt = udma_tchanrt_read(uc, UDMA_CHAN_RT_PEER_BCNT_REG);
> -       bcnt = udma_tchanrt_read(uc, UDMA_CHAN_RT_BCNT_REG);
> +       if (uc->ud->match_data->version == K3_UDMA_V1) {
> +               peer_bcnt = udma_tchanrt_read(uc, UDMA_CHAN_RT_PEER_BCNT_REG);
> +               bcnt = udma_tchanrt_read(uc, UDMA_CHAN_RT_BCNT_REG);
> +       } else {
> +               peer_bcnt = udma_chanrt_read(uc, UDMA_CHAN_RT_PERIPH_BCNT_REG);
> +               bcnt = udma_chanrt_read(uc, UDMA_CHAN_RT_BCNT_REG);
> +       }

use callback other method, don't check K3_UDMA_V1, incase V<n> change again
to make compare complex.

>
>         /* Transfer is incomplete, store current residue and time stamp */
>         if (peer_bcnt < bcnt) {
> @@ -326,6 +331,7 @@ udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl,
>         size_t tr_size;
>         int num_tr = 0;
>         int tr_idx = 0;
> +       u32 extra_flags = 0;
>         u64 asel;
>
>         /* estimate the number of TRs we will need */
> @@ -349,6 +355,16 @@ udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl,
>         else
>                 asel = (u64)uc->config.asel << K3_ADDRESS_ASEL_SHIFT;
>
> +       /*
> +        * BCDMA V2 stalls and stops processing further TRs if a TR's ICNT0
> +        * is not a multiple of 16 bytes. Setting EOP on every TR (not just
> +        * the last one) avoids that stall condition. Intentional, not a bug.
> +        */
> +       if (uc->ud->match_data->type == DMA_TYPE_BCDMA &&
> +           uc->ud->match_data->version == K3_UDMA_V2 &&

Add new field at match_data, to avoid complex check and direct use

	extra_flags = uc->ud->match_data->extra_flags;

check others, avoid direct check version number

Frank



More information about the linux-arm-kernel mailing list