[U-Boot] [PATCH] NAND: Allow nand_scan to be replaced by user

Scott Wood scottwood at freescale.com
Tue Dec 6 00:21:28 CET 2011


On 12/05/2011 05:16 PM, Marek Vasut wrote:
> This patch allows user to supply nand_scan() call replacement via the usual
> method. This will be beneficial for PXA3XX NAND driver, which does further init
> of the chip at this stage.
> 
> Signed-off-by: Marek Vasut <marek.vasut at gmail.com>
> Cc: Scott Wood <scottwood at freescale.com>
> ---
>  drivers/mtd/nand/nand_base.c |   12 +++++++++---
>  include/linux/mtd/nand.h     |    2 ++
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 27f6c77..baf7622 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -2974,10 +2974,16 @@ int nand_scan_tail(struct mtd_info *mtd)
>  int nand_scan(struct mtd_info *mtd, int maxchips)
>  {
>  	int ret;
> +	struct nand_chip *nand = mtd->priv;
> +
> +	if (nand->scan) {
> +		ret = nand->scan(mtd);
> +	} else {
> +		ret = nand_scan_ident(mtd, maxchips, NULL);
> +		if (!ret)
> +			ret = nand_scan_tail(mtd);
> +	}
>  
> -	ret = nand_scan_ident(mtd, maxchips, NULL);
> -	if (!ret)
> -		ret = nand_scan_tail(mtd);
>  	return ret;
>  }

There is no need to change this code.  Instead, we should stop calling
nand_scan in the first place if we want to insert code between ident and
tail.

Does the approach in the following patch work for you?
http://patchwork.ozlabs.org/patch/128816/

-Scott



More information about the U-Boot mailing list