Skip to content

Conversation

erwango
Copy link
Member

@erwango erwango commented Aug 29, 2025

This PR targets to fix 2 known issues around xspi devices configuration on stm32n6 based boards:

  • Kernel clock copy/paste issue between xspi1 and xspi2
  • Impossibility to run NOR device at expected freq of 200Mhz

For this second issue, I chose fixing the specific issue of the NOR configuration on the 2 impacted boards.
As metionned in the commit message, fixing the larger problem of configuring xspi devices more closely according to their type and specification is what MSPI API intends to solve, so I prefer let this general issue on MSPI driver development and for now
focus on fixing reported issues on flash xspi driver.

… HCLK5

Fix copy/paste issue on XSPI_SEL macro and use HCLK5 as kernel clk.
This has no functional impact on NOR as HCLK5 is the default clk which
was used due to the copy/paste error.
Remove now useless ic3 nodes.

Signed-off-by: Erwan Gouriou <[email protected]>
This commit is fixing configuration of mx66uw1g45g NOR when working
at 200MHz.
According to its specification, when running at 200MHz, this memory should
use a Number Dummy Cycles configuration of 20 (DC bits in CFGR2), which is
the device's default configuration.
Applying the 66MHz configuration as done today was preventing flash to run
at frequency higher than 100Mhz.

This commit doesn't solve the more generic problem of this driver which
is applying this 66MHz configuration universally, irrespective of the
frequency and the memory device, but fixes the configuration which was
reported broken today.

Providing a global change would require starting a clear split between XSPI
controller configuration an bus device configuration, which is what new
MSPI API intend to solve, so this will be tackled once this driver will be
available.

Signed-off-by: Erwan Gouriou <[email protected]>
Copy link

@erwango erwango added the DNM This PR should not be merged (Do Not Merge) label Aug 29, 2025
@erwango
Copy link
Member Author

erwango commented Aug 29, 2025

DNM as I see glitches when testing with west build -p auto -b stm32n6570_dk/stm32n657xx --sysbuild samples/drivers/video/capture_to_lvgl/ -- -DSHIELD=st_b_cams_imx_mb1854.
This might require some more testing.

@erwango
Copy link
Member Author

erwango commented Aug 29, 2025

DNM as I see glitches when testing with west build -p auto -b stm32n6570_dk/stm32n657xx --sysbuild samples/drivers/video/capture_to_lvgl/ -- -DSHIELD=st_b_cams_imx_mb1854. This might require some more testing.

Not a regression due to these changes from what I can test. Removing DNM.

@erwango erwango removed the DNM This PR should not be merged (Do Not Merge) label Aug 29, 2025
Comment on lines +579 to +582
if (dev_cfg->max_frequency == MHZ(200)) {
/* Use memory default value */
return 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a N6-specific hack? If so, a if (IS_ENABLED(CONFIG_SOC_SERIES_STM32N6X) should be added

Copy link
Member Author

@erwango erwango Sep 1, 2025

Choose a reason for hiding this comment

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

This configuration is related to the specific NOR device, not the SoC.
As mentioned in the commit description, this fix is definitely not ideal, but these flash drivers are not designed to take into account devices specifics, so I'm minimizing the impact.
In its current shape, this piece code is not correct for some of the configuration that are already in tree, but no issue were reported, so I prefer not touch it more.
A proper change would require to have knowledge about the memory type and implement the full table for each device. In the end what we need is a proper split between devices and controllers ... which will come with MSPI drivers. It would not be duplicated work to start this task on this driver.
Not satisfying but more reasonable from my point of view.

@erwango erwango assigned de-nordic and unassigned erwango Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants