drivers: mipi_dbi: stm32: fmc: add bank address property

The driver gets FMC bank address using
`FMC_BANK1_<parent_register_value>` define.

This approach has some flaws:
- The parent (bank) register's value might not correspond
  sequentially to the expected bank number.
  For example: `STM32_FMC_NOSRAM_BANK3` maps to `FMC_BANK1_4`,
  instead of `FMC_BANK1_3`.
- Some families don't even define the necessary `FMC_BANK1_x` macros.

To address this, the commit adds an optional `bank-address` property,
providing a direct way to define the FMC bank address for the driver.

Signed-off-by: Georgij Černyšiov <geo.cgv@gmail.com>
This commit is contained in:
Georgij Černyšiov 2025-07-19 18:05:15 +02:00 committed by Chris Friedt
parent 7f3a728aaa
commit e0899d347e
2 changed files with 8 additions and 2 deletions

View File

@ -182,8 +182,9 @@ static DEVICE_API(mipi_dbi, mipi_dbi_stm32_fmc_driver_api) = {
.write_display = mipi_dbi_stm32_fmc_write_display,
};
#define MIPI_DBI_FMC_GET_ADDRESS(n) _CONCAT(FMC_BANK1_, \
UTIL_INC(DT_REG_ADDR_RAW(DT_INST_PARENT(n))))
#define MIPI_DBI_FMC_GET_ADDRESS(n) \
DT_INST_PROP_OR(n, bank_address, \
_CONCAT(FMC_BANK1_, UTIL_INC(DT_REG_ADDR_RAW(DT_INST_PARENT(n)))))
#define MIPI_DBI_FMC_GET_DATA_ADDRESS(n) \
MIPI_DBI_FMC_GET_ADDRESS(n) + (1 << (DT_INST_PROP(n, register_select_pin) + 1))

View File

@ -7,6 +7,11 @@ compatible: "st,stm32-fmc-mipi-dbi"
include: ["mipi-dbi-controller.yaml"]
properties:
bank-address:
type: int
description: |
Optional property to provide FMC Bank address.
reset-gpios:
type: phandle-array
description: |