public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ian Campbell <ijc@hellion.org.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 15/15] sunxi_nand_spl: Add support for backup boot partitions
Date: Mon, 17 Aug 2015 09:34:14 +0100	[thread overview]
Message-ID: <1439800454.3480.69.camel@hellion.org.uk> (raw)
In-Reply-To: <1439668968-3882-16-git-send-email-hdegoede@redhat.com>

On Sat, 2015-08-15 at 22:02 +0200, Hans de Goede wrote:
> The BROM does not care / use bad page markings, instead it deals with
> any bad pages in the first erase-block by simply trying to load "boot0"
> from the first next erase-block.


           "first/next"? Maybe, or maybe s/first //?

> This commit implements the same strategy for the sunxi spl nand code,
> allowing it to boot from the backup boot partition when the main boot
> partition is bad (tested by erasing the main boot partition).
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

> ---
>  drivers/mtd/nand/sunxi_nand_spl.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/mtd/nand/sunxi_nand_spl.c 
> b/drivers/mtd/nand/sunxi_nand_spl.c
> index 5687cd8..a75e674 100644
> --- a/drivers/mtd/nand/sunxi_nand_spl.c
> +++ b/drivers/mtd/nand/sunxi_nand_spl.c
> @@ -348,6 +348,23 @@ static int nand_read_buffer(uint32_t offs, 
> unsigned int size, void *dest,
>  
>  int nand_spl_load_image(uint32_t offs, unsigned int size, void 
> *dest)
>  {
> +	const uint32_t boot_offsets[] = {
> +		0 * 1024 * 1024 + CONFIG_SYS_NAND_U_BOOT_OFFS,
> +		1 * 1024 * 1024 + CONFIG_SYS_NAND_U_BOOT_OFFS,
> +		2 * 1024 * 1024 + CONFIG_SYS_NAND_U_BOOT_OFFS,
> +		4 * 1024 * 1024 + CONFIG_SYS_NAND_U_BOOT_OFFS,
> +	};
> +	int i;
> +
> +	if (offs == CONFIG_SYS_NAND_U_BOOT_OFFS) {
> +		for (i = 0; i < ARRAY_SIZE(boot_offsets); i++) {
> +			if (nand_read_buffer(boot_offsets[i], size,
> +					     dest, 1) == 0)
> +				return 0;
> +		}
> +		return -1;
> +	}
> +
>  	return nand_read_buffer(offs, size, dest, 1);
>  }
>  

      reply	other threads:[~2015-08-17  8:34 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-15 20:02 [U-Boot] [PATCH 00/15] sunxi_nand_spl: cleanups, auto config and bad block handling Hans de Goede
2015-08-15 20:02 ` [U-Boot] [PATCH 01/15] sunxi_nand_spl: Fix CONFIG_SPL_NAND_SUNXI handling Hans de Goede
2015-08-17  8:11   ` Ian Campbell
2015-08-19 13:45   ` Maxime Ripard
2015-08-20  6:33     ` Hans de Goede
2015-08-27 12:36       ` Maxime Ripard
2015-08-15 20:02 ` [U-Boot] [PATCH 02/15] sunxi_nand_spl: Drop unnecessary temp buf Hans de Goede
2015-08-17  7:22   ` Chen-Yu Tsai
2015-08-17  8:14     ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 03/15] sunxi_nand_spl: We only need to reset the nand chip once Hans de Goede
2015-08-17  8:14   ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 04/15] sunxi_nand_spl: Do not bother writing the spare-area reg in syndrome mode Hans de Goede
2015-08-17  8:19   ` Ian Campbell
2015-08-17  8:59     ` Hans de Goede
2015-08-17 11:28       ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 05/15] sunxi_nand_spl: Use SYS_NAND_SELF_INIT and only do nand init when necessary Hans de Goede
2015-08-17  8:20   ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 06/15] sunxi_nand_spl: Make sure the DMA controller is enabled Hans de Goede
2015-08-17  8:21   ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 07/15] sunxi_nand_spl: Turn off clocks when we're done with the nand Hans de Goede
2015-08-17  8:22   ` Ian Campbell
2015-08-19 13:48   ` Maxime Ripard
2015-08-20  6:35     ` Hans de Goede
2015-08-24 14:54       ` Maxime Ripard
2015-08-15 20:02 ` [U-Boot] [PATCH 08/15] sunxi_nand_spl: Add proper cache flusing Hans de Goede
2015-08-17  8:22   ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 09/15] sunxi_nand_spl: Use kernel driver algorithm for determining ecc_mode / _off Hans de Goede
2015-08-17  8:24   ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 10/15] sunxi_nand_spl: Remove NAND_SUNXI_SPL_SYNDROME_PARTITIONS_END Hans de Goede
2015-08-17  8:27   ` Ian Campbell
2015-08-17  9:05     ` Hans de Goede
2015-08-15 20:02 ` [U-Boot] [PATCH 11/15] sunxi_nand_spl: Add support for sun4i and sun5i SoCs Hans de Goede
2015-08-17  8:29   ` Ian Campbell
2015-08-17  8:31     ` Hans de Goede
2015-08-17  8:35       ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 12/15] sunxi_nand_spl: Properly config page-size in the nand ctl register Hans de Goede
2015-08-17  8:29   ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 13/15] sunxi_nand_spl: Parametrize lowlevel read functions Hans de Goede
2015-08-17  8:31   ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 14/15] sunxi_nand_spl: Auto detect nand configuration parameters Hans de Goede
2015-08-17  8:32   ` Ian Campbell
2015-08-15 20:02 ` [U-Boot] [PATCH 15/15] sunxi_nand_spl: Add support for backup boot partitions Hans de Goede
2015-08-17  8:34   ` Ian Campbell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439800454.3480.69.camel@hellion.org.uk \
    --to=ijc@hellion.org.uk \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox