
Hello,
I've been working on a QorIQ P1022 board (controlcenterd) to run the newest U-Boot on it, and I encountered some strange behavior.
During boot, we get these error messages
" ERROR: Cannot import environment: errno = 12
at common/env_common.c:221/env_import() *** Warning - import failed, using default environment
ERROR: Environment import failed: errno = 12
at common/env_common.c:123/set_default_env() ## Can't malloc 9 bytes "
After bisecting, I found out that the commit 4683b22 (mmc:fsl_esdhc invalidate dcache before read) apparently causes this. With the additional d-cache invalidations in place, malloc and free calls fail.
Now, after some experimenting, I found out that deactivating the d-cache invalidation when reading the first sector is enough; that is, if one replaces the first invalidation
" if (data->flags & MMC_DATA_READ) check_and_invalidate_dcache_range(cmd, data); "
with
" if (data->flags & MMC_DATA_READ && (cmd->cmdidx != MMC_CMD_READ_SINGLE_BLOCK || cmd->cmdarg != 0)) check_and_invalidate_dcache_range(cmd, data); "
in fsl_esdhc.c, it seems to work, but I have no idea why that is the case.
Any ideas would be greatly appreciated.
Best regards, Mario