[U-Boot] [PATCH 3/5] nand: sunxi: Add secondary U-Boot offset on second syndrome partition
Scott Wood
scottwood at freescale.com
Tue May 19 01:10:33 CEST 2015
On Wed, 2015-04-29 at 17:02 +0200, Daniel Kochmański wrote:
> diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
> index 9d59fbb..7c44de1 100644
> --- a/common/spl/spl_nand.c
> +++ b/common/spl/spl_nand.c
> @@ -2,6 +2,9 @@
> * Copyright (C) 2011
> * Corscience GmbH & Co. KG - Simon Schwarz <schwarz at corscience.de>
> *
> + * Copyright (C) 2015
> + * Turtle Solutions - Daniel Kochmański <dkochmanski at turtle-solutions.eu>
> + *
> * SPDX-License-Identifier: GPL-2.0+
> */
> #include <common.h>
> @@ -90,9 +93,28 @@ void spl_nand_load_image(void)
> nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
> sizeof(*header), (void *)header);
> spl_parse_image_header(header);
> - nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
> - spl_image.size,
> - (void *)(unsigned long)spl_image.load_addr);
> + if (header->ih_os == IH_OS_U_BOOT) {
> + nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
> + spl_image.size,
> + (void *)(unsigned long)spl_image.load_addr);
> + nand_deselect();
> + return;
> + }
> + puts("U-boot header didn't match.\n");
> +#ifdef CONFIG_SYS_NAND_U_BOOT_BACKUP_OFFS
> + puts("Trying to start backup u-boot now...\n");
> + nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_BACKUP_OFFS,
> + sizeof(*header), (void *)header);
> + spl_parse_image_header(header);
> + if (header->ih_os == IH_OS_U_BOOT) {
> + nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_BACKUP_OFFS,
> + spl_image.size,
> + (void *)(unsigned long)spl_image.load_addr);
> + nand_deselect();
> + return;
> + }
> +#endif
Factor this code into a function that is called twice rather than
repeating everything.
-Scott
More information about the U-Boot
mailing list