drivers: flash: fix hyperflash write operations

Hyperflash write operations resulted in invalid writes. This commit
fixes the issue by temporarily lowering the clock during writes.
This aligns with the mcux-sdk-examples.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/53855

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
This commit is contained in:
Jeppe Odgaard 2023-01-17 10:42:24 +01:00 committed by Carles Cufí
parent cd59e74412
commit ecd2f51386

View file

@ -427,6 +427,9 @@ static int flash_flexspi_hyperflash_write(const struct device *dev, off_t offset
key = irq_lock();
}
(void)memc_flexspi_update_clock(data->controller, &data->config,
data->port, MEMC_FLEXSPI_CLOCK_42M);
while (len) {
/* Writing between two page sizes crashes the platform so we
* have to write the part that fits in the first page and then
@ -466,6 +469,9 @@ static int flash_flexspi_hyperflash_write(const struct device *dev, off_t offset
len -= i;
}
(void)memc_flexspi_update_clock(data->controller, &data->config,
data->port, MEMC_FLEXSPI_CLOCK_166M);
if (memc_flexspi_is_running_xip(data->controller)) {
/* ==== EXIT CRITICAL SECTION ==== */
irq_unlock(key);