Re: [PATCH v4 5/5] dmaengine: sun6i-dma: Add support for Allwinner A733 DMA controller
From: Frank Li
Date: Wed Aug 26 2026 - 12:30:55 EST
On Wed, Aug 26, 2026 at 01:30:07AM +0000, Yuanshen Cao wrote:
> Implement support for the Allwinner A733 DMA controller by defining
> A733-specific register offsets, bitfield masks, and the
> `sun60i_a733_dma_cfg` configuration structure.
>
> This includes the IRQ stride, offsets, and channel counts specific to the
> A733, as well as the 32G mask for high-address fields in the LLI. Add
> `sun60i_a733_dma_cfg`, which ties all the refactored functionality
> together for A733.
>
> Signed-off-by: Yuanshen Cao <alex.caoys@xxxxxxxxx>
> ---
> drivers/dma/sun6i-dma.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> index b96d7d90f6b5..fb371b57d792 100644
> --- a/drivers/dma/sun6i-dma.c
> +++ b/drivers/dma/sun6i-dma.c
> @@ -57,10 +57,14 @@
> * Interrupts specific registers
> */
> #define DMA_IRQ_STRIDE_A31 0x04
> +#define DMA_IRQ_STRIDE_A733 0x40
> #define DMA_IRQ_EN_OFFSET_A31 0x00
> +#define DMA_IRQ_EN_OFFSET_A733 0x134
> #define DMA_IRQ_STAT_OFFSET_A31 0x10
> +#define DMA_IRQ_STAT_OFFSET_A733 0x138
>
> #define DMA_IRQ_CHAN_NR_A31 8
> +#define DMA_IRQ_CHAN_NR_A733 1
>
> /*
> * Channels specific registers
> @@ -110,6 +114,8 @@
> */
> #define SRC_HIGH_ADDR_MASK GENMASK(17, 16)
> #define DST_HIGH_ADDR_MASK GENMASK(19, 18)
> +#define SRC_HIGH_ADDR_32G_MASK GENMASK(13, 11)
> +#define DST_HIGH_ADDR_32G_MASK GENMASK(17, 15)
>
> /*
> * Various hardware related defines
> @@ -1321,6 +1327,29 @@ static struct sun6i_dma_config sun50i_h6_dma_cfg = {
> SUN6I_DMA_IRQ_A31_COMMON_CFG
> };
>
> +/*
> + * The A733 binding uses the number of dma channels from the
> + * device tree node.
> + */
> +static struct sun6i_dma_config sun60i_a733_dma_cfg = {
> + .clock_autogate_enable = sun6i_enable_clock_autogate_h3,
> + .src_burst_lengths = BIT(1) | BIT(4) | BIT(8) | BIT(16),
> + .dst_burst_lengths = BIT(1) | BIT(4) | BIT(8) | BIT(16),
> + .src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
> + BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
> + BIT(DMA_SLAVE_BUSWIDTH_4_BYTES),
> + .dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
> + BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
> + BIT(DMA_SLAVE_BUSWIDTH_4_BYTES),
> + .src_high_addr_mask = SRC_HIGH_ADDR_32G_MASK,
> + .dst_high_addr_mask = DST_HIGH_ADDR_32G_MASK,
> + .has_mbus_clk = true,
> + .irq_stride = DMA_IRQ_STRIDE_A733,
> + .irq_en_offset = DMA_IRQ_EN_OFFSET_A733,
> + .irq_stat_offset = DMA_IRQ_STAT_OFFSET_A733,
> + .num_channels_per_reg = DMA_IRQ_CHAN_NR_A733,
Nit: if only use once, needn't define macro, you can put value to here.
Also please check previous prepare patch.
Frank
> +};
> +
> /*
> * The V3s have only 8 physical channels, a maximum DRQ port id of 23,
> * and a total of 24 usable source and destination endpoints.
> @@ -1355,6 +1384,7 @@ static const struct of_device_id sun6i_dma_match[] = {
> { .compatible = "allwinner,sun50i-a64-dma", .data = &sun50i_a64_dma_cfg },
> { .compatible = "allwinner,sun50i-a100-dma", .data = &sun50i_a100_dma_cfg },
> { .compatible = "allwinner,sun50i-h6-dma", .data = &sun50i_h6_dma_cfg },
> + { .compatible = "allwinner,sun60i-a733-dma", .data = &sun60i_a733_dma_cfg },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, sun6i_dma_match);
>
> --
> 2.55.0
>