summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-06-06 10:16:58 +0200
committerScott Wood <oss@buserror.net>2016-06-19 19:11:57 -0500
commit80ef700f8df1f85dd3b0880584e2e2a998a9b3dd (patch)
tree05a15967c467ee18b442443fb2de292b3b8ecc73 /common
parent494e108651a3c55b85d060202e941e4d8d68ce5e (diff)
downloadu-boot-imx-80ef700f8df1f85dd3b0880584e2e2a998a9b3dd.zip
u-boot-imx-80ef700f8df1f85dd3b0880584e2e2a998a9b3dd.tar.gz
u-boot-imx-80ef700f8df1f85dd3b0880584e2e2a998a9b3dd.tar.bz2
spl: nand: support redundant u-boot image
On modern NAND it's more than recommended to have a backup copy of the u-boot binary to recover from corruption: bitflips are quite common on MLC NANDs, and the read-disturbance will corrupt your u-boot partitition more quickly than what you would see on an SLC NAND. Add an extra Kconfig option to specify the offset of the redundant u-boot image. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Hans de Goede <hdegoede@redhat.com> [scottwood: added ifdef to fix build break] Signed-off-by: Scott Wood <oss@buserror.net>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_nand.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 7cf0d1b..0e35e0f 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -134,6 +134,13 @@ int spl_nand_load_image(void)
#endif
/* Load u-boot */
err = spl_nand_load_element(CONFIG_SYS_NAND_U_BOOT_OFFS, header);
+#ifdef CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND
+#if CONFIG_SYS_NAND_U_BOOT_OFFS != CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND
+ if (err)
+ err = spl_nand_load_element(CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND,
+ header);
+#endif
+#endif
nand_deselect();
return err;
}