Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 87457ea

Browse files
committedMar 6, 2025·
drivers: dma: dma_xilinx_axi_dma: Make descriptors per-instance
Move the descriptor storage into the per-instance data structure rather than being global, as they should not be shared between instances. Signed-off-by: Robert Hancock <[email protected]>
1 parent d20a04d commit 87457ea

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed
 

‎drivers/dma/dma_xilinx_axi_dma.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,6 @@ struct __attribute__((__packed__)) dma_xilinx_axi_dma_sg_descriptor {
165165
uint32_t app4;
166166
} __aligned(64);
167167

168-
__aligned(64) static struct dma_xilinx_axi_dma_sg_descriptor
169-
descriptors_tx[CONFIG_DMA_XILINX_AXI_DMA_SG_DESCRIPTOR_NUM_TX] = {0};
170-
__aligned(64) static struct dma_xilinx_axi_dma_sg_descriptor
171-
descriptors_rx[CONFIG_DMA_XILINX_AXI_DMA_SG_DESCRIPTOR_NUM_RX] = {0};
172-
173168
enum AxiDmaDirectionRegister {
174169
/* DMA control register */
175170
/* bitfield, masks defined above */
@@ -234,6 +229,11 @@ struct dma_xilinx_axi_dma_channel {
234229
struct dma_xilinx_axi_dma_data {
235230
struct dma_context ctx;
236231
struct dma_xilinx_axi_dma_channel *channels;
232+
233+
__aligned(64) struct dma_xilinx_axi_dma_sg_descriptor
234+
descriptors_tx[CONFIG_DMA_XILINX_AXI_DMA_SG_DESCRIPTOR_NUM_TX];
235+
__aligned(64) struct dma_xilinx_axi_dma_sg_descriptor
236+
descriptors_rx[CONFIG_DMA_XILINX_AXI_DMA_SG_DESCRIPTOR_NUM_RX];
237237
};
238238

239239
static inline int dma_xilinx_axi_dma_lock_irq(const struct device *dev, const uint32_t channel_num)
@@ -916,14 +916,16 @@ static int dma_xilinx_axi_dma_init(const struct device *dev)
916916
return -EINVAL;
917917
}
918918

919-
data->channels[XILINX_AXI_DMA_TX_CHANNEL_NUM].descriptors = descriptors_tx;
920-
data->channels[XILINX_AXI_DMA_TX_CHANNEL_NUM].num_descriptors = ARRAY_SIZE(descriptors_tx);
919+
data->channels[XILINX_AXI_DMA_TX_CHANNEL_NUM].descriptors = data->descriptors_tx;
920+
data->channels[XILINX_AXI_DMA_TX_CHANNEL_NUM].num_descriptors =
921+
ARRAY_SIZE(data->descriptors_tx);
921922
data->channels[XILINX_AXI_DMA_TX_CHANNEL_NUM].channel_regs =
922923
cfg->reg + XILINX_AXI_DMA_MM2S_REG_OFFSET;
923924
data->channels[XILINX_AXI_DMA_TX_CHANNEL_NUM].direction = MEMORY_TO_PERIPHERAL;
924925

925-
data->channels[XILINX_AXI_DMA_RX_CHANNEL_NUM].descriptors = descriptors_rx;
926-
data->channels[XILINX_AXI_DMA_RX_CHANNEL_NUM].num_descriptors = ARRAY_SIZE(descriptors_rx);
926+
data->channels[XILINX_AXI_DMA_RX_CHANNEL_NUM].descriptors = data->descriptors_rx;
927+
data->channels[XILINX_AXI_DMA_RX_CHANNEL_NUM].num_descriptors =
928+
ARRAY_SIZE(data->descriptors_rx);
927929
data->channels[XILINX_AXI_DMA_RX_CHANNEL_NUM].channel_regs =
928930
cfg->reg + XILINX_AXI_DMA_S2MM_REG_OFFSET;
929931
data->channels[XILINX_AXI_DMA_TX_CHANNEL_NUM].direction = PERIPHERAL_TO_MEMORY;

0 commit comments

Comments
 (0)
Please sign in to comment.