On Sun, 19 Jun 2016 19:07:47 -0500 Scott Wood <[email protected]> wrote:
> On Mon, Jun 06, 2016 at 10:16:58AM +0200, Boris Brezillon wrote: > > 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 <[email protected]> > > Acked-by: Hans de Goede <[email protected]> > > > > # Conflicts: > > # common/spl/spl_nand.c > > # drivers/mtd/nand/Kconfig > > --- > > common/spl/spl_nand.c | 5 +++++ > > drivers/mtd/nand/Kconfig | 8 ++++++++ > > 2 files changed, 13 insertions(+) > > > > diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c > > index bbd9546..d8c5b9e 100644 > > --- a/common/spl/spl_nand.c > > +++ b/common/spl/spl_nand.c > > @@ -107,6 +107,11 @@ int spl_nand_load_image(void) > > #endif > > /* Load u-boot */ > > err = spl_nand_load_element(CONFIG_SYS_NAND_U_BOOT_OFFS, header); > > +#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 > > nand_deselect(); > > return err; > > } > > diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig > > index 5fe169f..8c46a2f 100644 > > --- a/drivers/mtd/nand/Kconfig > > +++ b/drivers/mtd/nand/Kconfig > > @@ -117,6 +117,14 @@ config SYS_NAND_U_BOOT_OFFS > > Set the offset from the start of the nand where u-boot should be > > loaded from. > > > > +config SYS_NAND_U_BOOT_OFFS_REDUND > > + hex "Location in NAND to read U-Boot from" > > + default SYS_NAND_U_BOOT_OFFS > > + depends on SYS_NAND_U_BOOT_LOCATIONS > > + help > > + Set the offset from the start of the nand where the redundant u-boot > > + should be loaded from. > > + > > config SPL_NAND_DENALI > > bool "Support Denali NAND controller for SPL" > > help > > I'm adding the below ifdef while applying, so that the build doesn't > break on targets that don't define CONFIG_SYS_NAND_U_BOOT_LOCATIONS. Oops. I previously had #ifndef CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND #define CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND CONFIG_SYS_NAND_U_BOOT_OFFS #endif at the beginning of the file, but I removed it when switching to the approach you suggested. Thanks for fixing that. Regards, Boris > > diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c > index 952f644..0e35e0f 100644 > --- a/common/spl/spl_nand.c > +++ b/common/spl/spl_nand.c > @@ -134,11 +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; > } > > > -Scott _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

