Skip to content

Commit ab57d54

Browse files
smalaekartben
authored andcommitted
drivers: dma: siwx91x: Fix burst length processing
1. Corrected the burst length processing to be handled in bytes for the siwx917 DMA drivers. 2. Removed overlay and configuration files associated with the chan_blen_transfer test application. The chan_blen_transfer test application attempted to use 8 and 16 byte bursts, which are not supported by the siwx91x UDMA. Signed-off-by: Sai Santhosh Malae <[email protected]>
1 parent e94a545 commit ab57d54

File tree

3 files changed

+20
-35
lines changed

3 files changed

+20
-35
lines changed

drivers/dma/dma_silabs_siwx91x.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,29 @@ static int siwx91x_transfer_direction(uint32_t dir)
6262
return -EINVAL;
6363
}
6464

65-
static int siwx91x_data_width(uint32_t data_width)
65+
static bool siwx91x_is_data_width_valid(uint32_t data_width)
6666
{
6767
switch (data_width) {
6868
case 1:
69-
return SRC_SIZE_8;
7069
case 2:
71-
return SRC_SIZE_16;
7270
case 4:
73-
return SRC_SIZE_32;
71+
return true;
7472
default:
75-
return -EINVAL;
73+
return false;
7674
}
7775
}
7876

79-
static bool siwx91x_is_burst_length_valid(uint32_t blen)
77+
static int siwx91x_burst_length(uint32_t blen)
8078
{
81-
switch (blen / 8) {
79+
switch (blen) {
8280
case 1:
83-
return true; /* 8-bit burst */
81+
return SRC_INC_8;
82+
case 2:
83+
return SRC_INC_16;
84+
case 4:
85+
return SRC_INC_32;
8486
default:
85-
return false;
87+
return -EINVAL;
8688
}
8789
}
8890

@@ -101,7 +103,7 @@ static int siwx91x_addr_adjustment(uint32_t adjustment)
101103
static int siwx91x_channel_config(const struct device *dev, RSI_UDMA_HANDLE_T udma_handle,
102104
uint32_t channel, const struct dma_config *config)
103105
{
104-
uint32_t dma_transfer_num = config->head_block->block_size / config->source_data_size;
106+
uint32_t dma_transfer_num = config->head_block->block_size / config->source_burst_length;
105107
const struct dma_siwx91x_config *cfg = dev->config;
106108
struct dma_siwx91x_data *data = dev->data;
107109
UDMA_RESOURCES udma_resources = {
@@ -140,30 +142,30 @@ static int siwx91x_channel_config(const struct device *dev, RSI_UDMA_HANDLE_T ud
140142
channel_control.totalNumOfDMATrans = dma_transfer_num;
141143
}
142144

143-
if (siwx91x_data_width(config->source_data_size) < 0 ||
144-
siwx91x_data_width(config->dest_data_size) < 0) {
145+
if (!siwx91x_is_data_width_valid(config->source_data_size) ||
146+
!siwx91x_is_data_width_valid(config->dest_data_size)) {
145147
return -EINVAL;
146148
}
147-
if (siwx91x_is_burst_length_valid(config->source_burst_length) == false ||
148-
siwx91x_is_burst_length_valid(config->dest_burst_length) == false) {
149+
if (siwx91x_burst_length(config->source_burst_length) < 0 ||
150+
siwx91x_burst_length(config->dest_burst_length) < 0) {
149151
return -EINVAL;
150152
}
151153

152-
channel_control.srcSize = siwx91x_data_width(config->source_data_size);
153-
channel_control.dstSize = siwx91x_data_width(config->dest_data_size);
154+
channel_control.srcSize = siwx91x_burst_length(config->source_burst_length);
155+
channel_control.dstSize = siwx91x_burst_length(config->dest_burst_length);
154156
if (siwx91x_addr_adjustment(config->head_block->source_addr_adj) < 0 ||
155157
siwx91x_addr_adjustment(config->head_block->dest_addr_adj) < 0) {
156158
return -EINVAL;
157159
}
158160

159161
if (siwx91x_addr_adjustment(config->head_block->source_addr_adj) == 0) {
160-
channel_control.srcInc = channel_control.srcSize;
162+
channel_control.srcInc = siwx91x_burst_length(config->source_burst_length);
161163
} else {
162164
channel_control.srcInc = UDMA_SRC_INC_NONE;
163165
}
164166

165167
if (siwx91x_addr_adjustment(config->head_block->dest_addr_adj) == 0) {
166-
channel_control.dstInc = channel_control.dstSize;
168+
channel_control.dstInc = siwx91x_burst_length(config->dest_burst_length);
167169
} else {
168170
channel_control.dstInc = UDMA_DST_INC_NONE;
169171
}

tests/drivers/dma/chan_blen_transfer/boards/siwx917_rb4338a.conf

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/drivers/dma/chan_blen_transfer/boards/siwx917_rb4338a.overlay

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)