diff --git a/drivers/dma/dma_nxp_edma.c b/drivers/dma/dma_nxp_edma.c index 93484bd5e73..7d4f6e8b449 100644 --- a/drivers/dma/dma_nxp_edma.c +++ b/drivers/dma/dma_nxp_edma.c @@ -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(®map, 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, \ diff --git a/drivers/dma/dma_nxp_edma.h b/drivers/dma/dma_nxp_edma.h index ca345ad3fbe..f45740d981d 100644 --- a/drivers/dma/dma_nxp_edma.h +++ b/drivers/dma/dma_nxp_edma.h @@ -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, (;), \ diff --git a/dts/arm64/nxp/nxp_mimx93_a55.dtsi b/dts/arm64/nxp/nxp_mimx93_a55.dtsi index abc12cffee6..cedba4ebdc3 100644 --- a/dts/arm64/nxp/nxp_mimx93_a55.dtsi +++ b/dts/arm64/nxp/nxp_mimx93_a55.dtsi @@ -359,7 +359,6 @@ interrupts = , ; #dma-cells = <2>; - hal-cfg-index = <1>; status = "disabled"; }; diff --git a/dts/bindings/dma/nxp,edma.yaml b/dts/bindings/dma/nxp,edma.yaml index 37a5bcc3cac..d5c58f624ad 100644 --- a/dts/bindings/dma/nxp,edma.yaml +++ b/dts/bindings/dma/nxp,edma.yaml @@ -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