[PATCH v1 0/2] board: toradex: improve env badblock management for NAND variant boards

Use the complete 512kb (4 blocks) nand partition reserved for u-boot environment instead of just the first block, this allows the module to have a working environment even if 3 blocks are bad.
Francesco Dolcini (2): colibri-imx6ull: improve env badblock management colibri-imx7: improve env badblock management
include/configs/colibri-imx6ull.h | 5 +++++ include/configs/colibri_imx7.h | 5 +++++ 2 files changed, 10 insertions(+)

Use the complete 512kb (4 blocks) nand partition reserved for u-boot environment instead of just the first block, this allows the module to have a working environment even if 3 blocks are bad.
Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com ---
include/configs/colibri-imx6ull.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/configs/colibri-imx6ull.h b/include/configs/colibri-imx6ull.h index 2fa3485173..a2753f8840 100644 --- a/include/configs/colibri-imx6ull.h +++ b/include/configs/colibri-imx6ull.h @@ -124,6 +124,11 @@ #define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
+/* environment organization */ +#if defined(CONFIG_ENV_IS_IN_NAND) +#define CONFIG_ENV_RANGE (4 * CONFIG_ENV_SIZE) +#endif + /* NAND stuff */ #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* used to initialize CONFIG_SYS_NAND_BASE_LIST which is unused */

Use the complete 512kb (4 blocks) nand partition reserved for u-boot environment instead of just the first block, this allows the module to have a working environment even if 3 blocks are bad.
Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com
---
include/configs/colibri_imx7.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h index 2fffaa39c0..c3e12c81c9 100644 --- a/include/configs/colibri_imx7.h +++ b/include/configs/colibri_imx7.h @@ -192,6 +192,11 @@ #define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
+/* environment organization */ +#if defined(CONFIG_ENV_IS_IN_NAND) +#define CONFIG_ENV_RANGE (4 * CONFIG_ENV_SIZE) +#endif + #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND /* NAND stuff */ #define CONFIG_SYS_MAX_NAND_DEVICE 1

Use the complete 512kb (4 blocks) nand partition reserved for u-boot environment instead of just the first block, this allows the module to have a working environment even if 3 blocks are bad. Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

Hi Francesco,
On 01.09.21 09:48, Francesco Dolcini wrote:
Use the complete 512kb (4 blocks) nand partition reserved for u-boot environment instead of just the first block, this allows the module to have a working environment even if 3 blocks are bad.
Francesco Dolcini (2): colibri-imx6ull: improve env badblock management colibri-imx7: improve env badblock management
include/configs/colibri-imx6ull.h | 5 +++++ include/configs/colibri_imx7.h | 5 +++++ 2 files changed, 10 insertions(+)
Sure, but is it not time to move CONFIG_ENV_RANGE into Kconfig (and drop it from whitelist= ?
Best regards, Stefano Babic

Hello Stefano,
On Thu, Oct 21, 2021 at 12:16:33PM +0200, Stefano Babic wrote:
On 01.09.21 09:48, Francesco Dolcini wrote:
Use the complete 512kb (4 blocks) nand partition reserved for u-boot environment instead of just the first block, this allows the module to have a working environment even if 3 blocks are bad.
Francesco Dolcini (2): colibri-imx6ull: improve env badblock management colibri-imx7: improve env badblock management
include/configs/colibri-imx6ull.h | 5 +++++ include/configs/colibri_imx7.h | 5 +++++ 2 files changed, 10 insertions(+)
Sure, but is it not time to move CONFIG_ENV_RANGE into Kconfig (and drop it from whitelist= ?
I'll try to have a look at it later tonight, I cannot warrant anything at the moment.
Francesco

Hello Stefano,
On Thu, Oct 21, 2021 at 01:08:16PM +0200, Francesco Dolcini wrote:
On Thu, Oct 21, 2021 at 12:16:33PM +0200, Stefano Babic wrote:
On 01.09.21 09:48, Francesco Dolcini wrote:
Use the complete 512kb (4 blocks) nand partition reserved for u-boot environment instead of just the first block, this allows the module to have a working environment even if 3 blocks are bad.
Francesco Dolcini (2): colibri-imx6ull: improve env badblock management colibri-imx7: improve env badblock management
include/configs/colibri-imx6ull.h | 5 +++++ include/configs/colibri_imx7.h | 5 +++++ 2 files changed, 10 insertions(+)
Sure, but is it not time to move CONFIG_ENV_RANGE into Kconfig (and drop it from whitelist= ?
I'll try to have a look at it later tonight, I cannot warrant anything at the moment.
So, I gave it a try, but it is not trivial (CONFIG_ENV_RANGE is using most of the time other CONFIG options that are not in kconfig yet) :-/
At the moment I have no much time to invest on this topic, I hope it would be fine to merge these 2 patches as they are.
Francesco

Hi Francesco,
On 22.10.21 09:59, Francesco Dolcini wrote:
Hello Stefano,
On Thu, Oct 21, 2021 at 01:08:16PM +0200, Francesco Dolcini wrote:
On Thu, Oct 21, 2021 at 12:16:33PM +0200, Stefano Babic wrote:
On 01.09.21 09:48, Francesco Dolcini wrote:
Use the complete 512kb (4 blocks) nand partition reserved for u-boot environment instead of just the first block, this allows the module to have a working environment even if 3 blocks are bad.
Francesco Dolcini (2): colibri-imx6ull: improve env badblock management colibri-imx7: improve env badblock management
include/configs/colibri-imx6ull.h | 5 +++++ include/configs/colibri_imx7.h | 5 +++++ 2 files changed, 10 insertions(+)
Sure, but is it not time to move CONFIG_ENV_RANGE into Kconfig (and drop it from whitelist= ?
I'll try to have a look at it later tonight, I cannot warrant anything at the moment.
So, I gave it a try, but it is not trivial (CONFIG_ENV_RANGE is using most of the time other CONFIG options that are not in kconfig yet) :-/
At the moment I have no much time to invest on this topic, I hope it would be fine to merge these 2 patches as they are.
Ok, I will merge your patches into u-boot-imx.
Best regards, Stefano
participants (3)
-
Francesco Dolcini
-
sbabic@denx.de
-
Stefano Babic