zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.96k stars 6.68k forks source link

drivers: flash: spi_nor: "requires-ulbpr" in devicetree not applied with CONFIG_SPI_NOR_SFDP_RUNTIME #77603

Open rw-wep opened 3 months ago

rw-wep commented 3 months ago

Describe the bug https://github.com/zephyrproject-rtos/zephyr/commit/adedf14c42594d167cb8f12855f7ae6097e285f1 added flags for struct spi_nor_config to check if among other things "requires_ulbpr" is enabled in the devicetree:

https://github.com/zephyrproject-rtos/zephyr/commit/adedf14c42594d167cb8f12855f7ae6097e285f1#diff-68c9be8932318c5396390b7264802c5e6f4e495f60a136d01a2c7bdac9c08d5aR154-R162

As far as I see it, these flags are set with the macro GENERATE_CONFIG_STRUCT() and if CONFIG_SPI_NOR_SFDP_RUNTIME=y is configured, these flags are not initialized: https://github.com/zephyrproject-rtos/zephyr/commit/adedf14c42594d167cb8f12855f7ae6097e285f1#diff-68c9be8932318c5396390b7264802c5e6f4e495f60a136d01a2c7bdac9c08d5aR1688-R1691

Before this change the check if "requires_ulbpr" is set in the devicetree was read out directly with the devicetree macros at the corresponding location (and it did not depend on CONFIG_SPI_NOR_SFDP_RUNTIME): https://github.com/zephyrproject-rtos/zephyr/commit/adedf14c42594d167cb8f12855f7ae6097e285f1#diff-68c9be8932318c5396390b7264802c5e6f4e495f60a136d01a2c7bdac9c08d5aR970-R975

So to summarize:

To Reproduce

Expected behavior That flags in the config struct are initialized independently if SFDP information is retrieved at runtime (CONFIG_SPI_NOR_SFDP_RUNTIME=y) or not.

Impact I switched from reading out SFDP at runtime to configuring SFDP in the devicetree so right now there is no impact. But I had to invest some time to find out why the behaviour is different after switching to a new Zeyphr version.

Additional context I am using NCS v2.7.0 which contains this change in their used Zephyr version. As spi_nor is a Zephyr driver I created this issue here.

github-actions[bot] commented 3 months ago

Hi @rw-wep! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

github-actions[bot] commented 1 month ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.