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:
parent
7c2478e547
commit
f754e09dcd
@ -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, \
|
||||
|
||||
@ -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, (;), \
|
||||
|
||||
@ -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";
|
||||
};
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user