Skip to content

Commit f754e09

Browse files
LaurentiuM1234nashif
authored andcommitted
dma: dma_nxp_edma: drop the hal-cfg-index property
The HAL configuration binding can be done dynamically based on the IP's address space. The `hal-cfg-index` property is more tied to software rather than hardware so remove it as an attempt to clean up the binding. Signed-off-by: Laurentiu Mihalcea <[email protected]>
1 parent 7c2478e commit f754e09

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

drivers/dma/dma_nxp_edma.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,19 @@ static const struct dma_driver_api edma_api = {
604604
.chan_filter = edma_channel_filter,
605605
};
606606

607+
static edma_config_t *edma_hal_cfg_get(const struct edma_config *cfg)
608+
{
609+
int i;
610+
611+
for (i = 0; i < ARRAY_SIZE(s_edmaConfigs); i++) {
612+
if (cfg->regmap_phys == s_edmaConfigs[i].regmap) {
613+
return s_edmaConfigs + i;
614+
}
615+
}
616+
617+
return NULL;
618+
}
619+
607620
static int edma_init(const struct device *dev)
608621
{
609622
const struct edma_config *cfg;
@@ -613,6 +626,11 @@ static int edma_init(const struct device *dev)
613626
data = dev->data;
614627
cfg = dev->config;
615628

629+
data->hal_cfg = edma_hal_cfg_get(cfg);
630+
if (!data->hal_cfg) {
631+
return -ENODEV;
632+
}
633+
616634
/* map instance MMIO */
617635
device_map(&regmap, cfg->regmap_phys, cfg->regmap_size, K_MEM_CACHE_NONE);
618636

@@ -678,7 +696,6 @@ static struct edma_config edma_config_##inst = { \
678696
static struct edma_data edma_data_##inst = { \
679697
.channels = channels_##inst, \
680698
.ctx.magic = DMA_MAGIC, \
681-
.hal_cfg = &EDMA_HAL_CFG_GET(inst), \
682699
}; \
683700
\
684701
DEVICE_DT_INST_DEFINE(inst, &edma_init, NULL, \

drivers/dma/dma_nxp_edma.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ LOG_MODULE_REGISTER(nxp_edma);
8888
(_EDMA_CHANNEL_ARRAY_EXPLICIT(inst)), \
8989
(_EDMA_CHANNEL_ARRAY(inst)))
9090

91-
#define EDMA_HAL_CFG_GET(inst) \
92-
COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(inst, DT_DRV_COMPAT), hal_cfg_index), \
93-
(s_edmaConfigs[DT_INST_PROP(inst, hal_cfg_index)]), \
94-
(s_edmaConfigs[0]))
95-
9691
/* used to register edma_isr for all specified interrupts */
9792
#define EDMA_CONNECT_INTERRUPTS(inst) \
9893
FOR_EACH_FIXED_ARG(_EDMA_INT_CONNECT, (;), \

dts/arm64/nxp/nxp_mimx93_a55.dtsi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@
359359
interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>,
360360
<GIC_SPI 128 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
361361
#dma-cells = <2>;
362-
hal-cfg-index = <1>;
363362
status = "disabled";
364363
};
365364

dts/bindings/dma/nxp,edma.yaml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,6 @@ properties:
2323
and "dma-channels" are mutually exclusive, meaning you
2424
can't specify both properties as this will lead to a
2525
BUILD_ASSERT() failure.
26-
hal-cfg-index:
27-
type: int
28-
description: |
29-
Use this property to specify which HAL configuration
30-
should be used. In the case of some SoCs (e.g: i.MX93),
31-
there can be multiple eDMA variants, each of them having
32-
different configurations (e.g: i.MX93 eDMA3 has 31 channels,
33-
i.MX93 eDMA4 has 64 channels and both of them have slightly
34-
different register layouts). To overcome this issue, the HAL
35-
exposes an array of configurations called "edma_hal_configs".
36-
To perform various operations, the HAL uses an eDMA configuration
37-
which will tell it what register layout the IP has, the number of
38-
channels, various flags and offsets. As such, if there's multiple
39-
configurations available, the user will have to specify which
40-
configuration to use through this property. If missing, the
41-
configuration found at index 0 will be used.
4226
"#dma-cells":
4327
const: 2
4428

0 commit comments

Comments
 (0)