drivers: flash: stm32 ospi: configure ospim io ports
Allows to configure OSPI Manager IO ports with devicetree. If properties are absent, then original default values are preserved for compatibility. Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
This commit is contained in:
parent
5cde75688e
commit
f09e3abbcb
|
@ -31,6 +31,11 @@ LOG_MODULE_REGISTER(flash_stm32_ospi, CONFIG_FLASH_LOG_LEVEL);
|
|||
|
||||
#define STM32_OSPI_NODE DT_INST_PARENT(0)
|
||||
|
||||
#define DT_OSPI_IO_PORT_PROP_OR(prop, default_value) \
|
||||
COND_CODE_1(DT_NODE_HAS_PROP(STM32_OSPI_NODE, prop), \
|
||||
(_CONCAT(HAL_OSPIM_, DT_STRING_TOKEN(STM32_OSPI_NODE, prop))), \
|
||||
((default_value)))
|
||||
|
||||
#define STM32_OSPI_RESET_GPIO DT_INST_NODE_HAS_PROP(0, reset_gpios)
|
||||
|
||||
#define STM32_OSPI_DLYB_BYPASSED DT_PROP(STM32_OSPI_NODE, dlyb_bypass)
|
||||
|
@ -2069,14 +2074,18 @@ static int flash_stm32_ospi_init(const struct device *dev)
|
|||
ospi_mgr_cfg.ClkPort = 1;
|
||||
ospi_mgr_cfg.DQSPort = 1;
|
||||
ospi_mgr_cfg.NCSPort = 1;
|
||||
ospi_mgr_cfg.IOLowPort = HAL_OSPIM_IOPORT_1_LOW;
|
||||
ospi_mgr_cfg.IOHighPort = HAL_OSPIM_IOPORT_1_HIGH;
|
||||
ospi_mgr_cfg.IOLowPort = DT_OSPI_IO_PORT_PROP_OR(io_low_port,
|
||||
HAL_OSPIM_IOPORT_1_LOW);
|
||||
ospi_mgr_cfg.IOHighPort = DT_OSPI_IO_PORT_PROP_OR(io_high_port,
|
||||
HAL_OSPIM_IOPORT_1_HIGH);
|
||||
} else if (dev_data->hospi.Instance == OCTOSPI2) {
|
||||
ospi_mgr_cfg.ClkPort = 2;
|
||||
ospi_mgr_cfg.DQSPort = 2;
|
||||
ospi_mgr_cfg.NCSPort = 2;
|
||||
ospi_mgr_cfg.IOLowPort = HAL_OSPIM_IOPORT_2_LOW;
|
||||
ospi_mgr_cfg.IOHighPort = HAL_OSPIM_IOPORT_2_HIGH;
|
||||
ospi_mgr_cfg.IOLowPort = DT_OSPI_IO_PORT_PROP_OR(io_low_port,
|
||||
HAL_OSPIM_IOPORT_2_LOW);
|
||||
ospi_mgr_cfg.IOHighPort = DT_OSPI_IO_PORT_PROP_OR(io_high_port,
|
||||
HAL_OSPIM_IOPORT_2_HIGH);
|
||||
}
|
||||
#if defined(OCTOSPIM_CR_MUXEN)
|
||||
ospi_mgr_cfg.Req2AckTime = 1;
|
||||
|
|
Loading…
Reference in a new issue