Skip to content

STM32 nor flash controller gets address and size #68274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 2, 2024

Conversation

FRASTM
Copy link
Collaborator

@FRASTM FRASTM commented Jan 30, 2024

the stm32 qspi and ospi flash drivers can retrieve the NOR flash address and size directly from the device tree
of their compatible = "st,stm32-qspi-nor"; or compatible = "st,stm32-ospi-nor";
This is done with the property of the qspi-nor-flash or ospi-nor-flash node as follows:

 mx25lm51245: ospi-nor-flash@70000000 {
                 compatible = "st,stm32-ospi-nor";
                reg = <0x70000000 DT_SIZE_M(64)>; /* 512 Mbits */

That will make the nor-flash controller driver using the address and size property and will prepare the flash controller for the memory mapped mode (XIP).
That will avoid confusion around the expressed in bits or in byte : here is the reg second param a size in Bytes.

Address and size are given by the DTS register property
of the ospi nor. The size Property becomes useless

Signed-off-by: Francois Ramu <[email protected]>
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update migration guide doc/releases/migration-guide-3.6.rst

@FRASTM
Copy link
Collaborator Author

FRASTM commented Jan 30, 2024

CI twister failure is due to #68284

@FRASTM
Copy link
Collaborator Author

FRASTM commented Jan 30, 2024

updated : migration guide v3.6

@FRASTM FRASTM marked this pull request as ready for review January 30, 2024 15:48
@zephyrbot zephyrbot added the Release Notes To be mentioned in the release notes label Jan 30, 2024
Laczen
Laczen previously approved these changes Jan 31, 2024
Copy link
Collaborator

@Laczen Laczen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it is nice to see the size removed.

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

Address and size are given by the DTS register property
of the ospi nor : to be used by the ospi driver.

Signed-off-by: Francois Ramu <[email protected]>
Define the reg and size property for the stm32u585 and stm32l562
disco kit.
Refer to the dts/bindings/flash_controller/st,stm32-ospi-nor.yaml.
The stm32l562 reads the sfdp table from the flash itself.

Signed-off-by: Francois Ramu <[email protected]>
Address and size are given by the DTS register property
of the qspi nor. The size Property becomes useless.

Signed-off-by: Francois Ramu <[email protected]>
Address and size are given by the DTS register property
of the qspi nor : to be used by the qspi driver.

Signed-off-by: Francois Ramu <[email protected]>
Define the reg and size property for the stm32 boards with qspi inside
Refer to the dts/bindings/flash_controller/st,stm32-ospi-nor.yaml.

Signed-off-by: Francois Ramu <[email protected]>
Update the migration guide for release v3.6 to detail the change about
the bindings of `st,stm32-ospi-nor` and `st,stm32-qspi-nor` compatible

Signed-off-by: Francois Ramu <[email protected]>
@FRASTM
Copy link
Collaborator Author

FRASTM commented Jan 31, 2024

same with DT_INST_REG_ADDR(0) and DT_INST_REG_ADDR_BY_IDX(0, 1) macro

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@erwango erwango requested a review from Laczen January 31, 2024 10:35
@erwango erwango requested a review from fabiobaltieri January 31, 2024 12:42
@erwango
Copy link
Member

erwango commented Jan 31, 2024

CI issue under fix in #68285

@erwango erwango added this to the v3.6.0 milestone Feb 1, 2024
@@ -2235,6 +2238,10 @@ static int flash_stm32_ospi_init(const struct device *dev)
}
#endif /* CONFIG_FLASH_PAGE_LAYOUT */

LOG_INF("NOR octo-flash at 0x%lx (0x%x bytes)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this meant to use LOG_INF()?

Comment on lines +1370 to +1372
LOG_INF("NOR quad-flash at 0x%lx (0x%x bytes)",
(long)(STM32_QSPI_BASE_ADDRESS),
dev_cfg->flash_size);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

@fabiobaltieri
Copy link
Member

/__w/zephyr/zephyr/samples/sensor/lsm6dsl/src/main.c:150:59: error: implicit conversion from 'float' to 'double' when passing argument to function [-Werror=double-promotion]
  150 |                                                           out_ev(&accel_x_out),
      |                                                           ^~~~~~~~~~~~~~~~~~~~

CI is sad

@erwango
Copy link
Member

erwango commented Feb 1, 2024

CI is sad

CI issue under fix in #68285

@FRASTM
Copy link
Collaborator Author

FRASTM commented Feb 2, 2024

CI is sad

CI issue under fix in #68285

#68274 (comment)

@carlescufi carlescufi merged commit 9059b6a into zephyrproject-rtos:main Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: File System area: Flash area: Samples Samples platform: STM32 ST Micro STM32 Release Notes To be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants