Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions drivers/memc/Kconfig.mcux
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,29 @@ config MEMC_MCUX_FLEXSPI_INIT_XIP
used for the FLEXSPI are compatible with those needed for XIP from
the flash device.

config FLASH_MCUX_FLEXSPI_FORCE_USING_OVRDVAL
bool "Force using the FLEXSPI Target Clock Delay Line Override Value"
help
Enable this setting to force using a specific raw value for the OVRDVAL
field in the DLLCR registers.

This option gives more granularity than the 'data-valid-time' field in
the dts. The unit of 'data-valid-time' is nanoseconds while the unit of
OVRDVAL are raw delay cells.

Normally the 'data-valid-time' on any 'nxp,imx-flexspi-device' device
will set the OVRDVAL and OVRDEN fields in the DLLCR register
but works only when the 'rx-clock-source' is configured to '#0 External
input from DQS pad' and the frequency <= 100MHz.

config FLASH_MCUX_FLEXSPI_OVRDVAL
int "FLEXSPI Target Clock Delay Line Override Value"
range 0 63
default 27
depends on FLASH_MCUX_FLEXSPI_FORCE_USING_OVRDVAL
help
Raw value to be stored in the DDLCR->OVRDVAL field.

config MEMC_MCUX_FLEXSPI
bool
select PINCTRL
Expand Down
6 changes: 6 additions & 0 deletions drivers/memc/memc_mcux_flexspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ int memc_flexspi_set_device_config(const struct device *dev,
/* Lock IRQs before reconfiguring FlexSPI, to prevent XIP */
key = irq_lock();
FLEXSPI_SetFlashConfig(data->base, &tmp_config, port);

#if (CONFIG_FLASH_MCUX_FLEXSPI_FORCE_USING_OVRDVAL == 1)
data->base->DLLCR[port >> 1U] = FLEXSPI_DLLCR_OVRDEN(1) |
FLEXSPI_DLLCR_OVRDVAL(CONFIG_FLASH_MCUX_FLEXSPI_OVRDVAL);
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @AndreHeinemans-NXP, May I ask about your motivation or a specific use case for proposing these changes?
In the function FLEXSPI_SetFlashConfig(), there is a mechanism that allows override and calculates the override value based on flexspirootclk.
Did you find that this function does not meet your use case requirements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are referring to 'data-valid-time' which can be configured in the dts. I tried to use it but it seems that this field is only effective when rx-clock-source=3 (external DQS). See src. In the other cases, the boolean isUnifiedConfig will be set and results in having a default value being used.

I'm am working on the NavQ95 and currently there are some problems with the DQS signal. So I need to configure the rx-clock-source to 1 (Loopback from DQS pad). Within this mode it is not possible to get the correct value set by using the 'data-valid-time'.

Besides, it allows more granularity since the unit of 'data-valid-time' is nanoseconds while the unit of OVRDVAL are raw delay cells.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @AndreHeinemans-NXP, thank you for your explanations. It is clear to me.


FLEXSPI_UpdateLUT(data->base, data->port_luts[port].lut_offset,
lut_ptr, lut_count);
irq_unlock(key);
Expand Down