Skip to content

Commit e0899d3

Browse files
GeorgeCGVcfriedt
authored andcommitted
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 <[email protected]>
1 parent 7f3a728 commit e0899d3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/mipi_dbi/mipi_dbi_stm32_fmc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,9 @@ static DEVICE_API(mipi_dbi, mipi_dbi_stm32_fmc_driver_api) = {
182182
.write_display = mipi_dbi_stm32_fmc_write_display,
183183
};
184184

185-
#define MIPI_DBI_FMC_GET_ADDRESS(n) _CONCAT(FMC_BANK1_, \
186-
UTIL_INC(DT_REG_ADDR_RAW(DT_INST_PARENT(n))))
185+
#define MIPI_DBI_FMC_GET_ADDRESS(n) \
186+
DT_INST_PROP_OR(n, bank_address, \
187+
_CONCAT(FMC_BANK1_, UTIL_INC(DT_REG_ADDR_RAW(DT_INST_PARENT(n)))))
187188

188189
#define MIPI_DBI_FMC_GET_DATA_ADDRESS(n) \
189190
MIPI_DBI_FMC_GET_ADDRESS(n) + (1 << (DT_INST_PROP(n, register_select_pin) + 1))

dts/bindings/mipi-dbi/st,mipi-dbi-fmc.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ compatible: "st,stm32-fmc-mipi-dbi"
77
include: ["mipi-dbi-controller.yaml"]
88

99
properties:
10+
bank-address:
11+
type: int
12+
description: |
13+
Optional property to provide FMC Bank address.
14+
1015
reset-gpios:
1116
type: phandle-array
1217
description: |

0 commit comments

Comments
 (0)