Hello Horatiu,

just tried current mainline U-Boot on imx6ull based board with
Env in SPI NOR. Your commit "9a9d66f5eff0"

env: add spi_flash_read_env function

breaks reading Env from SPI NOR in my case...

If I interprete your patch correct, you only read until the 2 0x0
in the env ... but for the env crc, the hole CONFIG_ENV_SIZE
must be read ... else missing for crc calculation ...

Hmm... following patch fixes for me the issue:

hs@threadripper:git  [master] $ git diff env/sf.c
diff --git a/env/sf.c b/env/sf.c
index b3dec82c35..dc4b56d4a4 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -98,7 +104,7 @@ static int spi_flash_read_env(struct spi_flash *flash, u32 
offset, size_t len,
        u32 addr = 0;
        u32 page_size = flash->page_size;

-       memset(buf, 0x0, len);
+       memset(buf, 0xff, len);
        for (int i = 0; i < len / page_size; ++i) {
                int ret = spi_flash_read(flash, offset, page_size,
                                         &((char *)buf)[addr]);

But if I make a bigger ENV_SIZE this may break again...

bye,
Heiko
--
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to