drivers: flash: max32: Wrap flash read to utilize ECC workaround

Use wrapper function for read operations to allow using the new HAL
function that handles ECC checks and erased page detection.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
This commit is contained in:
Tahsin Mutlugun
2025-04-07 15:41:19 +03:00
committed by Fabio Baltieri
parent c86c1efbc0
commit 94a962e87e

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024 Analog Devices, Inc.
* Copyright (c) 2023-2025 Analog Devices, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -52,17 +52,18 @@ static inline void max32_sem_give(const struct device *dev)
static int api_read(const struct device *dev, off_t address, void *buffer, size_t length)
{
const struct max32_flash_dev_config *const cfg = dev->config;
int ret = 0;
unsigned int key = 0;
address += cfg->flash_base;
key = irq_lock();
MXC_FLC_Read(address, buffer, length);
ret = Wrap_MXC_FLC_Read(address, buffer, length);
irq_unlock(key);
return 0;
return ret != 0 ? -EIO : 0;
}
static int api_write(const struct device *dev, off_t address, const void *buffer, size_t length)