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 <laurentiu.mihalcea@nxp.com>
This commit is contained in:
Laurentiu Mihalcea 2024-10-16 11:18:24 +03:00 committed by Anas Nashif
parent 7c2478e547
commit f754e09dcd
4 changed files with 18 additions and 23 deletions

View File

@ -604,6 +604,19 @@ static const struct dma_driver_api edma_api = {
.chan_filter = edma_channel_filter,
};
static edma_config_t *edma_hal_cfg_get(const struct edma_config *cfg)
{
int i;
for (i = 0; i < ARRAY_SIZE(s_edmaConfigs); i++) {
if (cfg->regmap_phys == s_edmaConfigs[i].regmap) {
return s_edmaConfigs + i;
}
}
return NULL;
}
static int edma_init(const struct device *dev)
{
const struct edma_config *cfg;
@ -613,6 +626,11 @@ static int edma_init(const struct device *dev)
data = dev->data;
cfg = dev->config;
data->hal_cfg = edma_hal_cfg_get(cfg);
if (!data->hal_cfg) {
return -ENODEV;
}
/* map instance MMIO */
device_map(&regmap, cfg->regmap_phys, cfg->regmap_size, K_MEM_CACHE_NONE);
@ -678,7 +696,6 @@ static struct edma_config edma_config_##inst = { \
static struct edma_data edma_data_##inst = { \
.channels = channels_##inst, \
.ctx.magic = DMA_MAGIC, \
.hal_cfg = &EDMA_HAL_CFG_GET(inst), \
}; \
\
DEVICE_DT_INST_DEFINE(inst, &edma_init, NULL, \

View File

@ -88,11 +88,6 @@ LOG_MODULE_REGISTER(nxp_edma);
(_EDMA_CHANNEL_ARRAY_EXPLICIT(inst)), \
(_EDMA_CHANNEL_ARRAY(inst)))
#define EDMA_HAL_CFG_GET(inst) \
COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(inst, DT_DRV_COMPAT), hal_cfg_index), \
(s_edmaConfigs[DT_INST_PROP(inst, hal_cfg_index)]), \
(s_edmaConfigs[0]))
/* used to register edma_isr for all specified interrupts */
#define EDMA_CONNECT_INTERRUPTS(inst) \
FOR_EACH_FIXED_ARG(_EDMA_INT_CONNECT, (;), \

View File

@ -359,7 +359,6 @@
interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>,
<GIC_SPI 128 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
#dma-cells = <2>;
hal-cfg-index = <1>;
status = "disabled";
};

View File

@ -23,22 +23,6 @@ properties:
and "dma-channels" are mutually exclusive, meaning you
can't specify both properties as this will lead to a
BUILD_ASSERT() failure.
hal-cfg-index:
type: int
description: |
Use this property to specify which HAL configuration
should be used. In the case of some SoCs (e.g: i.MX93),
there can be multiple eDMA variants, each of them having
different configurations (e.g: i.MX93 eDMA3 has 31 channels,
i.MX93 eDMA4 has 64 channels and both of them have slightly
different register layouts). To overcome this issue, the HAL
exposes an array of configurations called "edma_hal_configs".
To perform various operations, the HAL uses an eDMA configuration
which will tell it what register layout the IP has, the number of
channels, various flags and offsets. As such, if there's multiple
configurations available, the user will have to specify which
configuration to use through this property. If missing, the
configuration found at index 0 will be used.
"#dma-cells":
const: 2