Skip to content

Conversation

GeorgeCGV
Copy link
Contributor

@GeorgeCGV GeorgeCGV commented Jul 19, 2025

The driver gets the FMC bank address using the FMC_BANK1_<parent_register_value> macro.

This approach has some flaws:

  1. The parent (bank) register's value might not correspond sequentially to the expected bank number. For example, STM32_FMC_NORSRAM_BANK3 maps to FMC_BANK1_5, instead of FMC_BANK1_3, STM32_FMC_NORSRAM_BANK4 to FMC_BANK1_7. It works for existing boards only because they define the bank as STM32_FMC_NORSRAM_BANK1, which has a value of 0, and we get the desired FMC_BANK1_1 in the driver.
  2. Some families don't even define the necessary FMC_BANK1_x macros.

To address this, an optional bank-address property is added, providing a direct way to define the FMC bank address for the driver. If the property is undefined, then the original behavior is used.

Another approach could be to define missing FMC_BANK1_x base address macros; however, it seems like the majority of recent families don't have them. Also, we would need to move away from using the bank's reg for the macro construction, and account for possible bank remaps (some families).

However, this PR doesn't fix the 1st issue. It is more like a workaround for both problems.
Does someone have a better idea how to handle that?

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]>
@GeorgeCGV GeorgeCGV force-pushed the stm32_fmc_mipi_dbi_address_fix branch from 9417322 to fecb665 Compare July 22, 2025 08:08
Copy link

@cfriedt cfriedt merged commit e0899d3 into zephyrproject-rtos:main Jul 28, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants