@@ -58,6 +58,7 @@ struct dma_gd32_config {
5858 uint32_t reg ;
5959 uint32_t channels ;
6060 uint16_t clkid ;
61+ bool mem2mem ;
6162#ifdef CONFIG_SOC_SERIES_GD32F4XX
6263 struct reset_dt_spec reset ;
6364#endif
@@ -403,6 +404,11 @@ static int dma_gd32_config(const struct device *dev, uint32_t channel,
403404 return - ENOTSUP ;
404405 }
405406
407+ if (dma_cfg -> channel_direction == MEMORY_TO_MEMORY && !cfg -> mem2mem ) {
408+ LOG_ERR ("not supporting MEMORY_TO_MEMORY" );
409+ return - ENOTSUP ;
410+ }
411+
406412#ifdef CONFIG_SOC_SERIES_GD32F4XX
407413 if (dma_cfg -> dma_slot > 0xF ) {
408414 LOG_ERR ("dma_slot must be <7 (%" PRIu32 ")" ,
@@ -665,10 +671,11 @@ static const struct dma_driver_api dma_gd32_driver_api = {
665671 } \
666672 static const struct dma_gd32_config dma_gd32##inst##_config = { \
667673 .reg = DT_INST_REG_ADDR(inst), \
674+ .channels = DT_INST_PROP(inst, dma_channels), \
668675 .clkid = DT_INST_CLOCKS_CELL(inst, id), \
676+ .mem2mem = DT_INST_PROP(inst, gd_mem2mem), \
669677 IF_ENABLED(CONFIG_SOC_SERIES_GD32F4XX, \
670678 (.reset = RESET_DT_SPEC_INST_GET(inst),)) \
671- .channels = DT_INST_PROP(inst, dma_channels), \
672679 .irq_configure = dma_gd32##inst##_irq_configure, \
673680 }; \
674681 \
0 commit comments