Skip to content

Commit 35396b1

Browse files
AndreHeinemans-NXPcfriedt
authored andcommitted
drivers: memc_mcux_flexspi: force applying OVRDVAL
Enable this kconfig 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. Signed-off-by: Andre Heinemans <[email protected]>
1 parent 43c223e commit 35396b1

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

drivers/memc/Kconfig.mcux

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,29 @@ config MEMC_MCUX_FLEXSPI_INIT_XIP
5656
used for the FLEXSPI are compatible with those needed for XIP from
5757
the flash device.
5858

59+
config FLASH_MCUX_FLEXSPI_FORCE_USING_OVRDVAL
60+
bool "Force using the FLEXSPI Target Clock Delay Line Override Value"
61+
help
62+
Enable this setting to force using a specific raw value for the OVRDVAL
63+
field in the DLLCR registers.
64+
65+
This option gives more granularity than the 'data-valid-time' field in
66+
the dts. The unit of 'data-valid-time' is nanoseconds while the unit of
67+
OVRDVAL are raw delay cells.
68+
69+
Normally the 'data-valid-time' on any 'nxp,imx-flexspi-device' device
70+
will set the OVRDVAL and OVRDEN fields in the DLLCR register
71+
but works only when the 'rx-clock-source' is configured to '#0 External
72+
input from DQS pad' and the frequency <= 100MHz.
73+
74+
config FLASH_MCUX_FLEXSPI_OVRDVAL
75+
int "FLEXSPI Target Clock Delay Line Override Value"
76+
range 0 63
77+
default 27
78+
depends on FLASH_MCUX_FLEXSPI_FORCE_USING_OVRDVAL
79+
help
80+
Raw value to be stored in the DDLCR->OVRDVAL field.
81+
5982
config MEMC_MCUX_FLEXSPI
6083
bool
6184
select PINCTRL

drivers/memc/memc_mcux_flexspi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ int memc_flexspi_set_device_config(const struct device *dev,
233233
/* Lock IRQs before reconfiguring FlexSPI, to prevent XIP */
234234
key = irq_lock();
235235
FLEXSPI_SetFlashConfig(data->base, &tmp_config, port);
236+
237+
#if (CONFIG_FLASH_MCUX_FLEXSPI_FORCE_USING_OVRDVAL == 1)
238+
data->base->DLLCR[port >> 1U] = FLEXSPI_DLLCR_OVRDEN(1) |
239+
FLEXSPI_DLLCR_OVRDVAL(CONFIG_FLASH_MCUX_FLEXSPI_OVRDVAL);
240+
#endif
241+
236242
FLEXSPI_UpdateLUT(data->base, data->port_luts[port].lut_offset,
237243
lut_ptr, lut_count);
238244
irq_unlock(key);

0 commit comments

Comments
 (0)