drivers: flash: soc_flash_mcux: remove CMD_MARGIN_CHECK

The CMD_BLANK_CHECK can return errors when the flash is readable, and
should only be used after programming, not in is_area_readable().  From
the LPC55S69 datasheet: "As cells age and lose charge, a correctly
programmed address will fail this check, while still being able to be
read successfully for the remaining duration of the data retention time."

Signed-off-by: Derek Snell <derek.snell@nxp.com>
This commit is contained in:
Derek Snell 2024-12-31 09:19:33 -05:00 committed by Fabio Baltieri
parent f9bff7f32f
commit 88b9cb6efc

View file

@ -93,7 +93,7 @@ static uint32_t get_cmd_status(uint32_t cmd, uint32_t addr, size_t len)
} }
/* This function prevents erroneous reading. Some ECC enabled devices will /* This function prevents erroneous reading. Some ECC enabled devices will
* crash when reading an erased or wrongly programmed area. * crash when reading an erased area.
*/ */
static status_t is_area_readable(uint32_t addr, size_t len) static status_t is_area_readable(uint32_t addr, size_t len)
{ {
@ -102,21 +102,13 @@ static status_t is_area_readable(uint32_t addr, size_t len)
key = irq_lock(); key = irq_lock();
/* Check if the are is correctly programmed and can be read. */ /* If the area was erased, ECC errors are triggered on read. */
status = get_cmd_status(FMC_CMD_MARGIN_CHECK, addr, len); status = get_cmd_status(FMC_CMD_BLANK_CHECK, addr, len);
if (status & FMC_STATUS_FAILURES) { if (!(status & FMC_STATUS_FAIL)) {
/* If the area was erased, ECC errors are triggered on read. */ LOG_DBG("read request on erased addr:0x%08x size:%d",
status = get_cmd_status(FMC_CMD_BLANK_CHECK, addr, len);
if (!(status & FMC_STATUS_FAIL)) {
LOG_DBG("read request on erased addr:0x%08x size:%d",
addr, len);
irq_unlock(key);
return -ENODATA;
}
LOG_DBG("read request error for addr:0x%08x size:%d",
addr, len); addr, len);
irq_unlock(key); irq_unlock(key);
return -EIO; return -ENODATA;
} }
irq_unlock(key); irq_unlock(key);