Skip to content

Commit b29daba

Browse files
aviscontigalak
authored andcommitted
drivers/dma: dma_stm32f4x: use dma_slot to select peripheral
The DMA API provides dma_slot field as a method to configure at runtime which peripheral DMA_request the DMA controller should select. This method allows to specify different selections for different stm32 DMA streams. So, all the Kconfig definitions, which by the way where fixing the same selection for all DMA streams, have been deleted. Signed-off-by: Armando Visconti <armando.visconti@st.com>
1 parent 86de204 commit b29daba

File tree

2 files changed

+2
-67
lines changed

2 files changed

+2
-67
lines changed

drivers/dma/Kconfig.stm32f4x

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -11,57 +11,3 @@ menuconfig DMA_STM32F4X
1111
depends on SOC_SERIES_STM32F4X
1212
help
1313
DMA driver for STM32F4x series SoCs.
14-
15-
config DMA_0_RX_SUB_CHANNEL_ID
16-
int "Requested RX sub-channel ID"
17-
default 0
18-
depends on DMA_STM32F4X
19-
help
20-
This configuration is required to choose a valid sub-channel
21-
for communication from a peripheral/device. Not required
22-
for memory to memory comms.
23-
24-
config DMA_0_TX_SUB_CHANNEL_ID
25-
int "Requested TX sub-channel ID"
26-
default 0
27-
depends on DMA_STM32F4X
28-
help
29-
This configuration is required to choose a valid sub-channel
30-
for communication to a peripheral/device. Not required
31-
for memory to memory comms.
32-
33-
config DMA_1_RX_SUB_CHANNEL_ID
34-
int "Requested RX sub-channel ID"
35-
default 0
36-
depends on DMA_STM32F4X
37-
help
38-
This configuration is required to choose a valid sub-channel
39-
for communication from a peripheral/device. Not required
40-
for memory to memory comms.
41-
42-
config DMA_1_TX_SUB_CHANNEL_ID
43-
int "Requested TX sub-channel ID"
44-
default 0
45-
depends on DMA_STM32F4X
46-
help
47-
This configuration is required to choose a valid sub-channel
48-
for communication to a peripheral/device. Not required
49-
for memory to memory comms.
50-
51-
config DMA_2_RX_SUB_CHANNEL_ID
52-
int "Requested RX sub-channel ID"
53-
default 0
54-
depends on DMA_STM32F4X
55-
help
56-
This configuration is required to choose a valid sub-channel
57-
for communication from a peripheral/device. Not required
58-
for memory to memory comms.
59-
60-
config DMA_2_TX_SUB_CHANNEL_ID
61-
int "Requested TX sub-channel ID"
62-
default 0
63-
depends on DMA_STM32F4X
64-
help
65-
This configuration is required to choose a valid sub-channel
66-
for communication to a peripheral/device. Not required
67-
for memory to memory comms.

drivers/dma/dma_stm32f4x.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525

2626
#define DMA_STM32_IRQ_PRI CONFIG_DMA_0_IRQ_PRI
2727

28-
#define DMA_STM32_1_RX_CHANNEL_ID CONFIG_DMA_1_RX_SUB_CHANNEL_ID
29-
#define DMA_STM32_1_TX_CHANNEL_ID CONFIG_DMA_1_TX_SUB_CHANNEL_ID
30-
#define DMA_STM32_2_RX_CHANNEL_ID CONFIG_DMA_2_RX_SUB_CHANNEL_ID
31-
#define DMA_STM32_2_TX_CHANNEL_ID CONFIG_DMA_2_TX_SUB_CHANNEL_ID
32-
3328
struct dma_stm32_stream_reg {
3429
/* Shared registers */
3530
u32_t lisr;
@@ -61,8 +56,6 @@ static struct dma_stm32_device {
6156
struct device *clk;
6257
struct dma_stm32_stream stream[DMA_STM32_MAX_STREAMS];
6358
bool mem2mem;
64-
u8_t channel_rx;
65-
u8_t channel_tx;
6659
} device_data[DMA_STM32_MAX_DEVS];
6760

6861
struct dma_stm32_config {
@@ -311,7 +304,7 @@ static int dma_stm32_config_devcpy(struct device *dev, u32_t id,
311304
DMA_STM32_SCR_MSIZE(src_bus_width) |
312305
DMA_STM32_SCR_PBURST(dst_burst_size) |
313306
DMA_STM32_SCR_MBURST(src_burst_size) |
314-
DMA_STM32_SCR_REQ(ddata->channel_tx) |
307+
DMA_STM32_SCR_REQ(config->dma_slot) |
315308
DMA_STM32_SCR_TCIE | DMA_STM32_SCR_TEIE |
316309
DMA_STM32_SCR_MINC;
317310
break;
@@ -321,7 +314,7 @@ static int dma_stm32_config_devcpy(struct device *dev, u32_t id,
321314
DMA_STM32_SCR_MSIZE(dst_bus_width) |
322315
DMA_STM32_SCR_PBURST(src_burst_size) |
323316
DMA_STM32_SCR_MBURST(dst_burst_size) |
324-
DMA_STM32_SCR_REQ(ddata->channel_rx) |
317+
DMA_STM32_SCR_REQ(config->dma_slot) |
325318
DMA_STM32_SCR_TCIE | DMA_STM32_SCR_TEIE |
326319
DMA_STM32_SCR_MINC;
327320
break;
@@ -548,8 +541,6 @@ static void dma_stm32_irq_7(void *arg) { dma_stm32_irq_handler(arg, 7); }
548541
static void dma_stm32_1_config(struct dma_stm32_device *ddata)
549542
{
550543
ddata->base = DMA_STM32_1_BASE;
551-
ddata->channel_tx = DMA_STM32_1_TX_CHANNEL_ID;
552-
ddata->channel_rx = DMA_STM32_1_RX_CHANNEL_ID;
553544

554545
IRQ_CONNECT(DMA1_Stream0_IRQn, DMA_STM32_IRQ_PRI,
555546
dma_stm32_irq_0, DEVICE_GET(dma_stm32_1), 0);
@@ -588,8 +579,6 @@ static void dma_stm32_2_config(struct dma_stm32_device *ddata)
588579
{
589580
ddata->base = DMA_STM32_2_BASE;
590581
ddata->mem2mem = true;
591-
ddata->channel_tx = DMA_STM32_2_TX_CHANNEL_ID;
592-
ddata->channel_rx = DMA_STM32_2_RX_CHANNEL_ID;
593582

594583
IRQ_CONNECT(DMA2_Stream0_IRQn, DMA_STM32_IRQ_PRI,
595584
dma_stm32_irq_0, DEVICE_GET(dma_stm32_2), 0);

0 commit comments

Comments
 (0)