[U-Boot] [PATCH 07/13] fastboot: Implement NAND backend

Boris Brezillon boris.brezillon at free-electrons.com
Thu Sep 10 09:41:51 CEST 2015


Hi Maxime,

On Mon, 31 Aug 2015 16:46:07 +0200
Maxime Ripard <maxime.ripard at free-electrons.com> wrote:

> So far the fastboot code was only supporting MMC-backed devices for its
> flashing operations (flash and erase).
> 
> Add a storage backend for NAND-backed devices.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>
> ---

[...]

> +
> +static int _fb_nand_write(nand_info_t *nand, struct part_info *part,
> +			  void *buffer, unsigned int offset,
> +			  unsigned int length)
> +{
> +	int flags = WITH_WR_VERIFY;
> +	int ret;
> +
> +#ifdef CONFIG_FASTBOOT_FLASH_NAND_TRIMFFS
> +	flags |= WITH_DROP_FFS;
> +#endif
> +	ret = nand_write_skip_bad(nand, offset, &length, NULL,
> +				  part->size - (offset - part->offset),
> +				  buffer, flags);

Hm, you seem to ignore skipped blocks here (the 'actual' parameter is
NULL), which means you won't adapt the offset accordingly and will
likely override some data if you appear to have bad blocks in the
section you're writing with the sparse method.

> +
> +	if (ret)
> +		return ret;
> +
> +	return ret;
> +}
> +
> +static unsigned int fb_nand_sparse_write(struct sparse_storage *storage,
> +					 void *priv,
> +					 unsigned int offset,

Maybe you should pass a pointer here, so that you can properly update it
with the number of skipped blocks (the same goes for the _fb_nand_write
function).

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


More information about the U-Boot mailing list