qspi: stm32: Add support for 'flash-id' property in 'stm32-qspi' banks

The 'flash-id' property defines the number of QSPI's dedicated GPIO
bank (and flash ID), which will be used to communicate with flash
memory.

For example, on stm32h7xx it is possible to use 'quadspi_bk1_*' and
'quadspi_bk2_*' set of pins, so one may need to select between them
when required.

By default - pins from 'quadspi_bk1_*' bank are used, so the
'flash-id = <2>;' property, when your use case (e.g. PCB design)
requires it, forces usage of 'quadspi_bk2_*' pins.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
Lukasz Majewski 2021-11-29 23:11:32 +01:00 committed by Anas Nashif
commit 44676a9d3e
2 changed files with 17 additions and 0 deletions

View file

@ -749,6 +749,12 @@ static int flash_stm32_qspi_init(const struct device *dev)
HAL_QSPI_Init(&dev_data->hqspi);
#if DT_NODE_HAS_PROP(DT_NODELABEL(quadspi), flash_id)
uint8_t qspi_flash_id = DT_PROP(DT_NODELABEL(quadspi), flash_id);
HAL_QSPI_SetFlashID(&dev_data->hqspi,
(qspi_flash_id - 1) << QUADSPI_CR_FSEL_Pos);
#endif
/* Initialize semaphores */
k_sem_init(&dev_data->sem, 1, 1);
k_sem_init(&dev_data->sync, 0, 1);